The issue is resolved by 50%. With the transfer of $ _SESSION [id] sorted out, help transfer the user data $myrow[id]; to the handler (PS: data is extracted at the entrance to the page for each user separately !!)

Here is the script itself. Tell me how to make so that the values ​​of $_SESSION[id] transferred to it ?!

 <form id="tweetForm" action="submit.php" method="post"> <textarea name="inputField" id="inputField" tabindex="1" rows="2" cols="40" ></textarea> <input class="submitButton inact" style="margin-right:20px;" name="submit" type="submit" value="update" disabled="disabled" /> </form> $.ajax({ type: "POST", url: "submit.php", data: submitData, dataType: "html", success: function(msg){ if(parseInt(msg)!=0) { $('ul.statuses li:first-child').before(msg); $("ul.statuses:empty").append(msg); $('#lastTweet').html($('#inputField').val()); $('#inputField').val(''); recount(); } } }); 

And here's the submit file:

 require "db.php"; if(ini_get('magic_quotes_gpc')) $_POST['inputField']=stripslashes($_POST['inputField']); if(mb_strlen($_POST['inputField']) < 1 || mb_strlen($_POST['inputField'])>91140) die("0"); mysql_query("INSERT INTO demo SET tw='".$_POST['inputField']."',dt=NOW(),sender='".$_SESSION['id']."',wallid='".$myrow['id']."'"); echo formatTw($_POST['inputField'],time()); 

Tell me why the session data and data pages are not recorded in mysql? What needs to be fixed for the code to work? Thank you in advance!

  • four
    session_start (); first line - Alex Kapustin
  • and how to transfer the value of myrow [id] it was on the page from which it was sent? - OverLoader
  • If I understood correctly. If not, explain it more clearly. $ _SESSION ['id'] = $ myrow ['id']; - Shevsky
  • When we go to the user’s page, the user’s data is extracted to the $ myrow variable, we’ll know what wall id on the user’s page, and extract the data or enter, the first thing that we pass to the handler is session [id] and then we should pass the user id whose this page is, and this data is retrieved to the page from which the message is sent to the handler. Tell me now how can I pass myrow [id] to the handler? - OverLoader
  • @OverLoader, again you ..... - Salivan

2 answers 2

Tell me why the session data and data pages are not recorded in mysql?

If you write to the database like this


then the data will never get there!

Need to

 INSERT INTO `table` VALUES(...) 
  • Well! And how can a handler pass the value of myrow [id] from the page from which the post went? - OverLoader
  • carefully read all the comments and do it right! - Palmervan

Your query is subject to SQL injection. Use the mysql_escape_string () function
The syntax of the SQL INSERT command is not correct, here is an example

 INSERT INTO `user21649_video`.`articles` (`ID`, `Title`, `Description`, `Dates`, `ID_cata`) VALUES (NULL, '1', '1', '2012-08-15', '1')