Zugzwang152
Lifer
$db = mysql_connect("localhost","root");
mysql_query("CREATE DATABASE mydb",$db);
mysql_select_db("mydb", $db);
mysql_query("CREATE TABLE testtable (col1 varchar,col2 varchar)",$db);
mysql_query("INSERT INTO testtable VALUES('Zach','sucks')",$db);
mysql_query("INSERT INTO testtable VALUES('Mike','sucks2')",$db);
$result = mysql_query("SELECT * FROM testtable",$db);
printf("col1: %s
", mysql_result($result,0,"col1"));
I'm getting a "mysql_result(): supplied argument is not a valid MySQL result resource" error...whats the problem here? I basically copied it straight out of an example which worked...but now mine doesnt...
mysql_query("CREATE DATABASE mydb",$db);
mysql_select_db("mydb", $db);
mysql_query("CREATE TABLE testtable (col1 varchar,col2 varchar)",$db);
mysql_query("INSERT INTO testtable VALUES('Zach','sucks')",$db);
mysql_query("INSERT INTO testtable VALUES('Mike','sucks2')",$db);
$result = mysql_query("SELECT * FROM testtable",$db);
printf("col1: %s
", mysql_result($result,0,"col1"));
I'm getting a "mysql_result(): supplied argument is not a valid MySQL result resource" error...whats the problem here? I basically copied it straight out of an example which worked...but now mine doesnt...