473,218 Members | 1,430 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,218 software developers and data experts.

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

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 1804
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
8,658 Expert Mod 8TB
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
16,027 Expert Mod 8TB
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
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));
  7. //
May 1 '09 #5
16,027 Expert Mod 8TB
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
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
16,027 Expert Mod 8TB
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

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...
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,...
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
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...
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...
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. ...
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...
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...
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
by: mar23 | last post by:
Here's the situation. I have a form called frmDiceInventory with subform called subfrmDice. The subform's control source is linked to a query called qryDiceInventory. I've been trying to pick up the...
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...

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.