PDA

View Full Version : first php problems!


goldfish
07-05-03, 07:22
$db = mysql_connet("localhost","goldfishphp","my password") or mysql_die("Unable to connect to database");
mysql_select_db("goldfishphp_uk_db","$db);
$sqlquery = "SELECT * FROM articles WHERE id = 1";
$result = mysql_query($sqlquery,$db) or mysql_die("No record found!");
$article = mysql_fetch_object($result);
mysql_free_result($result);


whats wrong?

the DB is right ,the password is right (in my script anyway ;)) and all the table names are right.... whats wrong?

iamien
07-05-03, 07:42
mysql_select_db("goldfishphp_uk_db","$db);
should be
mysql_select_db("goldfishphp_uk_db","$db");

And

$db = mysql_connet(
should be
$db = mysql_connect(

goldfish
07-05-03, 07:43
im dumb, alright? LOL!

that was easy enough to solve...

†T-Rex †
07-13-03, 02:14
The most common bugs are the smallest mundane detail you could think of... irritates me to no end! Seems to take longer to find those kind of mistakes than it is to find logic or syntax errors... like finding a decimal point in a haystack :)