sql broke down
Posted by: bro (---.dsl.ip.tiscali.nl)
Date: May 29, 2006 09:58PM

Since I freshly installed WAMP on my new laptop my code broke down. I get a sql error though the site works fine online (and i didn't change comma). The sql query is:

$query = "SELECT plaats, adres, tel, mail, story, schema FROM centers WHERE plaats=$subj";

The database, table and all definitely exist. The rest of the site works fine, just links that call this query don't.

Options: ReplyQuote
Re: sql broke down
Posted by: CyberSpatium (67.170.181.---)
Date: May 29, 2006 10:02PM

try
$query = "SELECT plaats, adres, tel, mail, story, schema FROM centers WHERE plaats='$subj'";

Options: ReplyQuote
Re: sql broke down
Posted by: bro (---.dsl.ip.tiscali.nl)
Date: May 29, 2006 10:07PM

Thanx, but it doesn't work, the messages is just:

....for the right syntax to use near 'FROM centers WHERE plaats=''groningen''' at line 1

instead of

....for the right syntax to use near 'FROM centers WHERE plaats='groningen'' at line 1

Options: ReplyQuote
Re: sql broke down
Posted by: CyberSpatium (67.170.181.---)
Date: May 29, 2006 10:17PM

this sql syntax is right
$query = "SELECT , adres, tel, mail, story, schema FROM centers WHERE plaats='$subj'";

make sure you have all your row and table names correct. for example plaats is spelled plats, so try
$query = "SELECT , adres, tel, mail, story, schema FROM centers WHERE plats='$subj'";

Options: ReplyQuote
Re: sql broke down
Posted by: bro (---.dsl.ip.tiscali.nl)
Date: May 29, 2006 10:33PM

thnx, but i didn't work.
I just rebuild the php file from the first line up. I dunno what I changed, to my best knowledge I just copied everything line by line. It works. tada.
'plats'? Is it an english word? 'Plaats' is a correct word in Dutch (meaning place or city). Sorry for being such a smart-...

Options: ReplyQuote
Re: sql broke down
Posted by: bro (---.dsl.ip.tiscali.nl)
Date: May 29, 2006 10:42PM

**** I did find it!!! It doesn't accept 'schema' as a table field name. I changed is, it works.

Options: ReplyQuote
Re: sql broke down
Posted by: CyberSpatium (67.170.181.---)
Date: May 29, 2006 11:14PM

yea, there are some reserved words you should not use as table names in mysql, or they will cause these kind of erros, and run in to serious problems
[dev.mysql.com]

Options: ReplyQuote


Sorry, only registered users may post in this forum.