Jump to content

[SOLVED] Parse error


pinochio

Recommended Posts

I introduced all variables but when I run it it says this:

 

Parse error: syntax error, unexpected T_VARIABLE in c:\program files\apache group\Apache\htdocs\CT\showguestbook.php on line 8

Any ideas what might be wrong?

<?php
$DBConnect = @mysqli_connect("root", "", "")
	   or die("<p>Unable to connect to the databse server.</p>"
	   . "<p>Error code " . mysqli_connect_errno()
	   . ":" . mysqli_connect_error()) . "</p>"

$DBName = "guestbook";
if (!@mysqli_select_db($DBConnect, $DBName))
	die("<p>Ooooops there are no entries...</p>");

$TableName = "visitors";
$SQLstring = "SELECT * FROM $TableName";
$QueryResult = @mysqli_query($DBConnect, $SQLString);
if(mysqli_num_rows($QueryResult) == 0)
   die("<p>Oooops there are no entries...</p>";
   
   
echo "<p>The following visitors have signed our guestbook:</p>";
echo "<table width='100%' border='1'>";
echo "<tr><th>Guest Name</th><th>Guest Email</th></tr>";
$Row = mysqli_fetch_assoc($QueryResult);
 do {
 echo "<tr><td>($Row['Name'])</td></tr>";
 echo "<tr><td>($Row['Email'])</td></tr>";
 $Row = mysqli_fetch_assoc($QueryResult);
 } while ($Row);

mysqli_free_result($QueryResult);
mysqli_close($DBConnect);
?>

Link to comment
https://forums.phpfreaks.com/topic/175897-solved-parse-error/
Share on other sites

Look at the top

 

<?php
$DBConnect = @mysqli_connect("root", "", "")
         or die("<p>Unable to connect to the databse server.</p>"
         . "<p>Error code " . mysqli_connect_errno()
         . ":" . mysqli_connect_error()) . "</p>"

 

         . ":" . mysqli_connect_error()) . "</p>"

Should be

         . ":" . mysqli_connect_error()) . "</p>");

Link to comment
https://forums.phpfreaks.com/topic/175897-solved-parse-error/#findComment-926865
Share on other sites

try this please....

<?php
$DBConnect = @mysqli_connect("root", "", "")
         or die("<p>Unable to connect to the databse server.</p>"
         . "<p>Error code " . mysqli_connect_errno()
         . ":" . mysqli_connect_error()) . "</p>";

$DBName = "guestbook";
if (!@mysqli_select_db($DBConnect, $DBName))
    die("<p>Ooooops there are no entries...</p>");
   
$TableName = "visitors";
$SQLstring = "SELECT * FROM $TableName";
$QueryResult = @mysqli_query($DBConnect, $SQLString);
if(mysqli_num_rows($QueryResult) == 0)
   die("<p>Oooops there are no entries...</p>");
   
   
echo "<p>The following visitors have signed our guestbook:</p>";
echo "<table width='100%' border='1'>";
echo "<tr><th>Guest Name</th><th>Guest Email</th></tr>";
$Row = mysqli_fetch_assoc($QueryResult);
    do {
    echo "<tr><td>{$Row['Name']}</td></tr>";
    echo "<tr><td>{$Row['Email']}</td></tr>";
    $Row = mysqli_fetch_assoc($QueryResult);
    } while ($Row);
    
mysqli_free_result($QueryResult);
mysqli_close($DBConnect);
?>

Link to comment
https://forums.phpfreaks.com/topic/175897-solved-parse-error/#findComment-926872
Share on other sites

you must be careful when typing variables pal...

 

 

most common problem that is...

 

 

remember most programmers use this

 

RedArrow

 

use of uppercase first letter then uppercase the next word first letter....

 

get into this kind off habit best practice...

 

 

Link to comment
https://forums.phpfreaks.com/topic/175897-solved-parse-error/#findComment-926882
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.