Question

Hi my script ading system is working perfectly but when i use tinymce plugin so i get this error please help fast if anyone can solve that

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 'color: #008000;">dsfdsfsdfsfdfsdfsdfsd", zone1 = "http://www.k' at line 8

this is my adding note code in userpanel

function add_note($note_title, $note_detail, $orient, $c_s, $zone1, $zone2, $zone3, $zone4, $z4_1, $z4_2, $z4_3, $zone5, $z5_1, $z5_2, $z5_3, $zone6, $z6_1, $z6_2, $z6_3, $s_m, $sm_back, $sm_text, $sm_direction, $sm_speed) { 
    global $db;
    $query = 'INSERT into notes VALUES(NULL, "'.date("Y-m-d").'", "'.$note_title.'", "'.$note_detail.'", "'.$orient.'", "'.$c_s.'", "'.$zone1.'", "'.$zone2.'", "'.$zone3.'", "'.$zone4.'", "'.$z4_1.'", "'.$z4_2.'", "'.$z4_3.'", "'.$zone5.'", "'.$z5_1.'", "'.$z5_2.'", "'.$z5_3.'", "'.$zone6.'", "'.$z6_1.'", "'.$z6_2.'", "'.$z6_3.'", "'.$s_m.'", "'.$sm_back.'", "'.$sm_text.'", "'.$sm_direction.'", "'.$sm_speed.'", "'.$_SESSION['user_id'].'")';
    $result = $db->query($query) or die($db->error);
    return 'Note added successfuly!';
}//add notes ends here.

Here is this link of Full Code of my notes.php http://pastebin.com/a6sNeXD0

Était-ce utile?

La solution

all users Attention here for soloution if they want to use tinymce and they get error like this so they must have to enter there table like this mysql_real_escape_string($sql_table). so my code is like this

$query = 'INSERT into notes VALUES(NULL, "'.date("Y-m-d").'", "'.$note_title.'")

so i just add mysql_realescape_string

$query = 'INSERT into notes VALUES(NULL, "'.date("Y-m-d").'", mysql_real_escape_string($notetitle))

and it works but it show me

Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: A link to the server could not be established i

so for that you have to add this in before that $query thing :)

 $con = mysql_pconnect("localhost","users","password");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  } 

and you'r done ..... thanks for all help

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top