Help! SQL/PHP problem :-\

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
Bratik
Forum Newbie
Posts: 2
Joined: Wed Aug 07, 2002 12:29 pm

Help! SQL/PHP problem :-\

Post 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
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post 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
Bratik
Forum Newbie
Posts: 2
Joined: Wed Aug 07, 2002 12:29 pm

Post 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!!! :)
User avatar
llimllib
Moderator
Posts: 466
Joined: Mon Jul 01, 2002 2:19 pm
Location: Baltimore, MD

Post by llimllib »

not to be a jerk, but google for 'php search tutorial' or something like that. there's plenty of them out there.
Post Reply