Jump to content

Loosing characters when posting to MySql


petenetman

Recommended Posts

Say I have:

$vSQL .= "Message=" . chr(34) . $Message . chr(34) .   and the $Message contains \\myserver\inetpub\www\

When I post to MySql I get \myserverinetpubwww I have no idea why. I know the chr(34) takes out the single quotes around text in the $Message. All I want to do is to post to MySql whatever is in the text field.

Link to comment
Share on other sites

I must be having a little 'Thicko' day - Sorry

Let me explain a little better....

This code is as follows:

if ( $JobNo > 0) {

 

$vSQL = "UPDATE worklog SET RepBy='" . $RepBy . "', Contact='" . $Contact . "', ";

$vSQL .= "Message=" . chr(34) . $Message . chr(34) . ", Handled='" . $Handled . "', Detail=" . chr(34) . $Detail . chr(34) . ", ";

$vSQL .= "CompletedIT='" . $CompletedIT . "', Priority='" . $Priority . "', JobGroup='" . $JobGrp . "'

, ";

$vSQL .= "CatType='" . $CatType . "', CatDate='" . $CatDate . "' ";

$vSQL .= "WHERE JobNo=" . $JobNo;

 

The $Message field and the $Detail field can contain any text character. After moving from a UNIX box to windows I had to change the $message to chr(34) as MySql fell over the something like 'ReadMe' as used in the test field. I am trying to find a string that goes around both $fields so MySql can handle the update.

 

Thanks Pete

Link to comment
Share on other sites

if ( $JobNo > 0) {

  $Message = mysql_real_escape_string($Message);
  $Detail = mysql_real_escape_string($Detail);

  $vSQL = "UPDATE worklog SET RepBy='" . $RepBy . "', Contact='" . $Contact . "', ";
  $vSQL .= "Message=" . chr(34) . $Message . chr(34) . ", Handled='" . $Handled . "', Detail=" . chr(34) . $Detail . chr(34) . ", ";
  $vSQL .= "CompletedIT='" . $CompletedIT . "', Priority='" . $Priority . "', JobGroup='" . $JobGrp . "'
, ";
  $vSQL .= "CatType='" . $CatType . "', CatDate='" . $CatDate . "' ";
  $vSQL .= "WHERE JobNo=" . $JobNo;

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.