simple sql_query need help pleeeeease!!!


#1

I am a newbie to php and i’ve got that small stupid problem.
Below is the sript i use, i’ve tried lots of things but it returns me" Couldn’t execute query" every time. Please help…

SQL Query <? $connection = mysql_connect("host","user","password") or die ("Couldn't Connect to the server.");
$db = mysql_select_db("database", $connection) or die ("Couldn't select database");

$sql = "CREATE TABLE INFO (FRIEND_ID char(5))";

$sql_result = mysql_query ($sql) or die("Couldn't execute query."); 

?>


#2

instead of just putting something like “couldn’t execute query” for the die statement, put something like “'couldn’t execute query: (line #) - '.mysql_error()” that’ll tell you exactly what the error is and provide a little bit more insight.


#3

Man thanks a lot, i fixed it, i was dum enough not to realize that the table name already exists in the database. What can i say-- newbie!
Thanks a lot.


#4

cool. did you try what i suggested to find that out? if you didn’t, that’s cool. just remember it next time you’re having a problem with mysql. very useful.


#5

TO: gogglecollector
Ye man thanks, i did what you told me and that’s the way i fixed it. :)