Jump to content

joerosenthal

New Members
  • Posts

    1
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

joerosenthal's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I am using ajax to automatically reload the content from my mysql database on a given interval without refreshing the page. The code to display the rows from mysql is totally functional but once put into the function below [code]   function refresh() {          mysql_connect(localhost,username,password) or die(mysql_error());         mysql_select_db(main) or die(mysql_error()); $query = "SELECT postby,date,time,ip,msg FROM chat ORDER BY date,time ASC LIMIT 0,4;"; $result = mysql_query($query) or die('Error, query failed'); while($row = mysql_fetch_array($result)) { list($postby, $date, $time, $ip, $msg) = $row; $postby    = htmlspecialchars($postby); $msg = htmlspecialchars($msg); $msg = nl2br($msg); echo $ip; } } [/code] the page no longer reloads nor shows the mysql query. after troubleshooting, i noticed that echo and print seem to disrupt the javascript from working. upon removing the echo command the database is reloaded. even a simple echo of "text" brings the script to a failure. [code]return join("\n", array_slice(mysql_fetch_array($row), -2)); [/code] outputs correctly in the file but its not the output that I am looking for, so the problem isn't the javascript any insight on this issue would be much appreciated.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.