i'm a newbie at PHP prodramming and i want to add data to an existing data base, but unfortunately, the " Warning: mysql_query() expects parameter 2 to be resource, "always pops up @@ here are my codes
<?php
$con=mysql_connect("localhost","root","duane");
// Check connection
if(!$con){
echo ("Could not connect." .mysql_error());
}
echo ("Connected successfully");
$selected = mysql_select_db("dummy") or die ("No existing database".mysql_error());
mysql_query($selected,"INSERT INTO prepurchase (ID, Sum, Reply, items, time) VALUES ('080392',15,1,'2m2','5:46'')") or die(mysql_error());
mysql_query($selected,"INSERT INTO prepurchase (ID, Sum, Reply, items, time) VALUES ('080390',20,1,'2m3','9:46'')") or die(mysql_error());
$data = mysql_query($selected, "SELECT * from prepurchase") or die (mysql_error());
while ($row = mysql_fetch_array($data)) {
echo "FN: ".$row{'Firstname'}." LN: ".$row{'Lastname'}." Age: ".$row{'Age'}."<br>";//display the results
}
mysql_close($con);
?>
the italic and bold codes are the error..please enlighten me with your knowledge. attached is the database i'm planning to modify using ph