Jump to content

whats wrong?


yuws

Recommended Posts

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

<?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

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.