Jump to content

php special characters help


clinton_pillay

Recommended Posts

Hi experts. 

I am received a GET variable into a page which is a id with a value as uuid:3242_2323_4444_9909_433/child_repeat[1]. Which is being used in my mysql query. 

So my query will be SELECT * from table_1 WHERE id = $id.  

However php is treating this string differently, my query fails, it says that it has a error near :3242_2323_4444_9909_433/child_repeat[1]. 

So it seems that its interpreting the colon as something else and removing the text before the colon. 

Link to comment
Share on other sites

Probably need quotes around the value.

Of course, the proper way to write your query is to NOT use the * but rather specify the column names (fields) that you want to retrieve.

	$q = "select * from table_1 where id='$id'";
	
Edited by ginerjm
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.