Advertisement
Guest User

Untitled

a guest
Aug 8th, 2016
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1. <?php
  2. include_once 'config.php';
  3. $username = @$_GET['user'];
  4. $password = @$_GET['password'];
  5. $message_from = @$_GET['from'];
  6. $message_to = @$_GET['to'];
  7.  
  8. if(($login = login($username, $password)) != 1) {
  9. echo $login; // return the value of the error
  10. exit;
  11. } else {
  12. $mysql = mysql_query("SELECT * FROM messages WHERE from LIKE $message_from AND to LIKE $message_to ORDER BY time ASC LIMIT 50");
  13. $rows = @mysql_numrows($mysql);
  14. echo 'MySQL Error: ' . mysql_error().'<br/>';
  15. if($rows > 0) {
  16. $i = 0;
  17. while($i < $rows) {
  18. $result_content = mysql_result($mysql, $i, 'content');
  19. $result_from = mysql_result($mysql, $i, 'from');
  20. echo $result_from.'<br/>'.$result_content.'<br/><br/>';
  21. $i++;
  22. }
  23. } else {
  24. echo 'No messages.';
  25. }
  26. }
  27.  
  28. ?>
  29.  
  30. MySQL Error: 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 'from LIKE 8 AND to LIKE 1 ORDER BY time ASC LIMIT 50' at line 1
  31.  
  32. $rows = mysql_numrows($mysql);
  33.  
  34. SELECT * FROM messages WHERE from=`8` AND to=`1` ORDER BY time ASC LIMIT 50
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement