Jump to content

[SOLVED] Encryption Insert


sseeley

Recommended Posts

I am trying to insert an encrypted line into MYSQL.  However each time I try I get an error.

 

I am using

$updateDataRow=mysql_query(" UPDATE tbluser SET `firstName` = '$encryptedFirstName' ");

However the encrypted string contains a ' therefore I am getting the following 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 'N(« íwÊ픦÷Ýøª<"˜©ÙÀ'' at line 1'

 

The encryped string is as follows...

 

'™–w> ‚©'N(« íwÊ픦÷Ýøª<"˜©ÙÀ'

 

Can anyone help me?

 

Many thanks in advance.

 

Stuart

Link to comment
https://forums.phpfreaks.com/topic/147290-solved-encryption-insert/
Share on other sites

$encryptedFirstName = mysql_real_escape_string($encryptedFirstName);
$updateDataRow=mysql_query(" UPDATE tbluser SET `firstName` = '$encryptedFirstName' ") or trigger_error(mysql_error());

 

Escape characters such as ' by using mysql_real_escape_string, which makes it safe for insertion.

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.