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
https://forums.phpfreaks.com/topic/190540-data-error-question/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.