MySQL Forums
Forum List  »  Newbie

Re: How to escape SQL thinking a variable is a table?
Posted by: Felix Geerinckx
Date: June 28, 2005 12:45AM

kamen.kozarev wrote:

> $name = $result["name"]; (name is something like m42ix_im26May2004.003575)
>
> $data2 = mysql_query("select * from band_ref where name = $name");
>
> and the error I get is "Invalid query: Unknown table 'm42ix_im26May2004' in where clause"


$data2 = mysql_query("select * from band_ref where name = '$name'");
(note the single quotes around $name)

--
felix
Please use BBCode to format your messages in this forum.

Options: ReplyQuote


Subject
Written By
Posted
Re: How to escape SQL thinking a variable is a table?
June 28, 2005 12:45AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.