yuws Posted April 17, 2009 Share Posted April 17, 2009 what's wrong with this code i keep getting this error! Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /home/funified/public_html/inc/playersonline.php on line 2 Parse error: syntax error, unexpected T_STRING in /home/funified/public_html/inc/playersonline.php on line 2 Here's the code: <?php $query = mysql_query('SELECT * FROM general WHERE lin = 1'); $loggedin = 0; while ($row = mysql_fetch_array($query)) { $loggedin++; } echo "$loggedin"; ?> Link to comment https://forums.phpfreaks.com/topic/154456-whats-wrong/ Share on other sites More sharing options...
Andy-H Posted April 17, 2009 Share Posted April 17, 2009 <?php $query = mysql_query("SELECT * FROM general WHERE lin = 1"); $loggedin = 0; while ($row = mysql_fetch_array($query)) { $loggedin++; } echo number_format($loggedin, 0); ?> Try it that way mate, dont know if you can use single quotes for a query string, never tried. Link to comment https://forums.phpfreaks.com/topic/154456-whats-wrong/#findComment-812121 Share on other sites More sharing options...
yuws Posted April 17, 2009 Author Share Posted April 17, 2009 nope errors <?php include("db.php"); $query = mysql_query("SELECT * FROM general WHERE lin = 1"); $loggedin = 0; while ($row = mysql_fetch_array($query)) { $loggedin++; } echo number_format($loggedin, 0); ?> Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /home/funified/public_html/inc/playersonline.php on line 4 Parse error: syntax error, unexpected T_STRING in /home/funified/public_html/inc/playersonline.php on line 4 Link to comment https://forums.phpfreaks.com/topic/154456-whats-wrong/#findComment-812123 Share on other sites More sharing options...
Andy-H Posted April 17, 2009 Share Posted April 17, 2009 Change it to: <?php error_reporting(E_ALL); include("db.php"); $query = mysql_query("SELECT * FROM general WHERE lin = 1") or trigger_error('ERROR: ' . mysql_error() . '<br>'); $loggedin = 0; while ($row = mysql_fetch_array($query)){ $loggedin++; } echo number_format($loggedin, 0); ?> Please tell me if the error changes as I dont see a backslash anywhere. Is that the entire contents of playersonline.php? Link to comment https://forums.phpfreaks.com/topic/154456-whats-wrong/#findComment-812127 Share on other sites More sharing options...
yuws Posted April 17, 2009 Author Share Posted April 17, 2009 ok i fixed it, thanks alot man! your the best, mind looking at my other topic? can you go on msn? i added you. Link to comment https://forums.phpfreaks.com/topic/154456-whats-wrong/#findComment-812129 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.