Page 1 of 1

Help! SQL/PHP problem :-\

Posted: Wed Aug 07, 2002 12:29 pm
by Bratik
Hi, thanks for reading.
Heres the problem. I am helping create a website, and i thought it would be so much easier to have a database and then basically do it from there - it's more or less a stores website lots of items. I created a mySQL database, and now i'm simply trying to get somethig from it and i'm having problems. here's the error and the snipit of code:
'Table'Couldn't execute query.
and the code i use is :

Code: Select all

//create sql statement 
         
        $sql = "SELECT 'Stuff' FROM 'Table'"; 
    //execute sql query and get results     
        $sql_result = mysql_query($sql) or die("Couldn't execute query.");
Am i doing something wrong? why would i get that error? please help!
Thanks alot!!!!
--Iggs

Posted: Wed Aug 07, 2002 1:44 pm
by twigletmac
Try using mysql_error() it gives a more useful error message:

Code: Select all

$sql = "SELECT 'Stuff' FROM 'Table'"; 
    //execute sql query and get results      
        $sql_result = mysql_query($sql) or die(mysql_error().'<p>'.$sql.'</p>');
Mac

Posted: Wed Aug 07, 2002 1:56 pm
by Bratik
I'm sorry i was a shmuck, it was a connection problem, turns out i wasn't a user on that specific database. So i'm sorry :( i have finally managed to get access to the database, now if i could only search it ;)
(I will take aaaanyyy suggestions!!)
--Iggs

ps: thanks alot!!! :)

Posted: Wed Aug 07, 2002 2:10 pm
by llimllib
not to be a jerk, but google for 'php search tutorial' or something like that. there's plenty of them out there.