PHP/SQL dropbox stuck

Im trying to display the songs for an artist i select on a drop down menu but i just cant get it to work, ive been trying for hours but i have got nowhere.

This is my dropbox code, it debugs fine and i can click on my artists and submit fine but when the browser moves onto my process3.php it does’nt show the artist with their data (title, artist, genre, year, price)

View grocery current quantity in stock? -- Please select band to view-- <?php $con = mysql_connect("localhost","root"); mysql_select_db("cd_online", $con); $query = "SELECT id, artist FROM songs"; $result=mysql_query($query); while ($row=mysql_fetch_array($result)) { echo " {$row['artist']} \n"; } mysql_close($con); ?>


The sample code i’ve been given is below i’ll give you this version as when i change it it doesn’t work (it does’nt debug as it is they give it as an outline but im completly lost)

<?php $selectedfruit = $_POST['fruit']; print "$selectedfruit"; $con = mysql_connect("localhost","root"); mysql_select_db("grocery_db", $con); $query = "SELECT `curr_qty` FROM grocery_inventory WHERE item_name =\"$selectedfruit\""; print "$query"; $result = mysql_query($query, $con); while($myrow = mysql_fetch_array($result)) {print $myrow["curr_qty"]; } mysql_close($con); ?>

You should be able to leave the drop down box the way it is and use this initially in your process3.php
[php]
if(isset($_POST[‘submit’]))
{
$id = (int)$_POST[‘band’];

$get = mysql_query("SELECT * FROM `songs` WHERE `id` = {$id}");
print_r(mysql_fetch_assoc($get));

}

[/php]

Sponsor our Newsletter | Privacy Policy | Terms of Service