If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > missing slashes after insert

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-14-04, 20:14
ryoaska ryoaska is offline
Registered User
 
Join Date: Jun 2004
Posts: 1
missing slashes after insert

Hey, I have a newbie question here, but it's killing me- I can't figure out this simple problem...

I'm using php to insert some values into a table, and i use this statement:

$sql = "INSERT INTO stories (stitle) VALUES('".addslashes($stitle)."')";

this is EXACTLY the same as a line i used in a different project which worked perfectly.

But for some reason in this project i'm working on now- when inserting into a table (where stitle is of the same type- varchar(70) ) none of the slashes from 'addslashes' are inserted into the table.

as an alternative (and to debug)- i tried moving the addslashes call to a line before creating the sql querry, like--

$title= addslashes($stitle);
echo $title;
$sql = "INSERT INTO stories (stitle) VALUES('".$title."')";

After echoing the variable, i could see that the slashes ARE definitely being added- but even when I do it this way the slashes are lost once the value is inserted into the table. In my other project I can see the slashes in the table fine (using the comand line or phpMyAdmin, so i know it's not a problem with them just not being displayed). I'm very new to database programming, so I'm sure it could be a few things- but after echoing the variable directly before adding it and seeing the slashes there, I just have no idea what it could be. Is there some kind of setting that makes mysql automatically remove the slashes on entry? I don't remember doing anything differently when creating this DB than when I created the one that works fine. Could someone please help me out??

Thanks-

Tyree G.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On