zero-perfoliate
zero-perfoliate

Author Topic: T_STRING error  (Read 598 times)

Offline fisherd

  • New PHP Members
  • Posts: 1
  • Karma: +0/-0
T_STRING error
« on: October 08, 2008, 06:45:16 AM »
i make a webpage, but an error keeps on appearing:

Parse error: syntax error, unexpected T_STRING in C:\wamp\www\own\test1.php on line 9

Here is my code:

Code: [Select]
<html>
<body>
<?php

$db1 
= @mysql_connect('localhost''root''');
if (!
$db1) {
exit(
'<p>Unable to connect to the database server at this time.</p>
}
if(!@mysql_select_db('
test',$db1) {
exit('
<p>Unable to connect to the test database server at this time.</p>
}

?>

<p>here are all the data from the test databse</p>
<?php

$result
=@mysql_query('SELECT nickname FROM player');
if (!
$result) {
exit(
'<p>Error performing query: ' mysql_error() . '</p>');
}

while(
$row=mysql_fetch_array($result)) {
echo 
'<p>' .$row['nickname'} . </p>;
}

?>

</blockquote>
</body>
</html>

I can't see no error in the code can anyone help me, pls

icestormz

  • Guest
Re: T_STRING error
« Reply #1 on: October 08, 2008, 07:32:11 PM »
Fixed it had allot of errors but i fixed them all. Please let me know if you have any other problems

Quote
<html>
<body>
<?php

$db1 = @mysql_connect('localhost', 'root', '');
if (!$db1)
die("<p>Unable to connect to the database server at this time.</p>");

if(!@mysql_select_db('test',$db1))
die("<p>Unable to connect to the test database server at this time.</p>");

?>
<p>here are all the data from the test databse</p>
<?php

$result=@mysql_query('SELECT nickname FROM player');
if (!$result)
die("<p>Error performing query: ' . mysql_error() . '</p>");

while($row=mysql_fetch_array($result))
  {
  echo "<p>" .$row['nickname']. "</p>";
  }
?>

</body>
</html>