Topic: Query Failing

Ok... I have been at work all night (not working on this problem though tongue) and this is starting to annoy me now.

I have this bit of code...

$result = $db->query('SELECT subject FROM '.$db->prefix.'topics WHERE id='.$id) or error('Unable to fetch topic subject', __FILE__, __LINE__, $db->error());

When a topic has been deleted it gives me the "unable to fetch topic subject" error instead of the normal "message(Bad request)" error.

Come on, someone point out the obvious for me... please....

2 (edited by Utchin 2008-04-11 10:02)

Re: Query Failing

('SELECT subject FROM '.$db->prefix.'topics WHERE id='.$id ) its that bit (so i think)

could be '.$id.' ')
or just with the '.$id ')

Sorry. Unactive due to personal life.

Re: Query Failing

matt: No, that code is perfectly fine.
StevenBullen: You need to give us context, what file/around what line?

Re: Query Failing

Enable PUN_SHOW_QUERIES and paste the query. I guess the id is missing...

FluxBB - v1.4.8

5 (edited by StevenBullen 2008-04-11 17:26)

Re: Query Failing

lie2815 wrote:

I guess the id is missing...

Correct! big_smile

User error on my part... sad

6

Re: Query Failing

StevenBullen wrote:
lie2815 wrote:

I guess the id is missing...

Correct! big_smile

User error on my part... sad

Nice to know I'm not the only one who does that trick on occasion. big_smile