473,499 Members | 1,990 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Trouble with Ajax: can't insert words into mysql with characters like ', e.g. "don't"

angelhiso
4 New Member
hei coild somebody help me with ajax mysql ?
I use ajax to put data to my database but why i can not put the charector like ' \ ? for example i want to put the word DON'T which has the 'it could not do it why ? what should i do ?
Apr 30 '09 #1
7 1811
angelhiso
4 New Member
I can not put the charector like \ ' to the data base.
I use ajax to put the data to my database and i found today that i can not put these kinds of charector to my database at all. every word which contents ' can not be sent for example don't can't \
But when i tried to put the data to database with the normal method (none ajax) so i could do that.
Ajax is cool and quick but how could i fix this problem ? have somebody here the same prblem as me ?
Apr 30 '09 #2
Dormilich
8,658 Recognized Expert Moderator Expert
did you escape the values (PHP side)? (e.g. mysql_real_escape_string() or (my personal favourite) by a Prepared Statement)
May 1 '09 #3
acoder
16,027 Recognized Expert Moderator MVP
Welcome to Bytes!

If that suggestion doesn't work, post your code.

PS. posts split off from other threads. Please post a new thread for posts rather than hijacking other members' threads. Thanks.
May 1 '09 #4
angelhiso
4 New Member
Hi,
How to do that ?
I tried this one but atill not work

Expand|Select|Wrap|Line Numbers
  1.     // $sql= sprintf("INSERT INTO tb_music VALUES ('$playlist_id','$playlist_name','$user_id','$song','$artist','$plass')",,
  2.                     mysql_real_escape_string($artist, $sql),
  3.                     mysql_real_escape_string($plass, $sql),
  4.                     mysql_real_escape_string($playlist_name, $sql),
  5.                     mysql_real_escape_string($playlist_id, $sql));
  6.  
  7. //
May 1 '09 #5
acoder
16,027 Recognized Expert Moderator MVP
That's not correct PHP. Have you had a look at the PHP manual? You mentioned that your code worked when not using Ajax. Are you sure about that?
May 1 '09 #6
angelhiso
4 New Member
oh yeah, i got it.
it's just one line to fix it and it is:
$artist = mysql_real_escape_string($_POST['artist']);

your answer is my angel you know ? if i don't have you maybe i have tp geot headach for more time. thanks so much.
May 3 '09 #7
acoder
16,027 Recognized Expert Moderator MVP
That looks more like it. Glad to see that you fixed it.
May 3 '09 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

8
5885
by: David Cameron | last post by:
I noticed that using an HTMLInputRadioButton and specifying a value to be an empty string (""), this is overridden by ASP.Net which set the value of the control to be the same as the ID of the...
3
1827
by: Giggle Girl | last post by:
I have inherited some CSS from a former employee that has code like this: onmouseover="this.className='highlight_on standard_border'" where it appears to activate two different classes,...
7
1244
by: VK | last post by:
Let's say I have a rather big HTML template like <?xml version="1.0" encoding="ISO-8859-1"?> .... <snip> .... <xsl:template match="/"> <html> <!-- ... A lot of HTML but no XSL so far
0
1658
by: thepisu | last post by:
I have a Windows 2003 Server with IIS 6, PHP with CGI. Yesterday I decided to update from PHP 5.1.4 to 5.2.1, but "slash arguments" (in a Moodle installation) stop working, I mean addresses like...
9
5289
by: Tonio Tanzi | last post by:
I have an asp page with this tag <body onLoad="show_msg('<%=error_msg%>');"> where "show_msg" is a javascript function that shows the message contained in the asp variable "error_msg" only if...
5
1869
by: Tony Toews [MVP] | last post by:
I'm very upset with Google's policy of indexing and allowing Google advertising on forum web sites which are "slurping" content from Usenet and Microsoft newsgroup servers. ...
13
4960
by: Robertf987 | last post by:
Hi, Yet another thing I need help with I'm affraid. I'll first explain what I want, then I'll try to explain what I have. I'm using Microsoft Access 2000. What I want is to be able to do a...
2
8153
by: holmes86 | last post by:
hi,everyone I have a GTK window,when click "close window" ,I want to show a verify dialog that whether verify really quit or not.so I used a MesssageDialog for verify quit.But when I clicked the...
0
7131
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7007
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7220
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
5470
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4919
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4600
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3099
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3091
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
297
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.