Jump to content

Data Error Question


overlordofevil

Recommended Posts

Hello all,

 

I am having a minor issue with my scripts when I have php pull data from mysql.  Some times data put into the table have ' or " included in the text.

So when php pulls that data and I include the variable I get a php error check the manual message.

 

example:

 

I am working with names the the following names are put in the table

 

John

Mike

Joshua

M'ekal

 

So I am workign with the data and I need to add a note to the system that includes the names so I have something like this.

 

$note = "order was updated for $name";

 

I then insert this into the table. Everything works just fine until it gets to the last name in the list. 

 

Then I get this error

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'ekal')' at line 1

 

So what I am wondering is there a way to turn the variable into a string so the ' stops kicking out this error anytime I try to insert it into a table?

 

Any info or suggestions would be appreciated.

Thanks

Bill

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.