Re: parse-error MySQL - PhP @ win2000
| From: | DL Neil | Date: | Sat, 10 Nov 2001 21:34:00 +0000 |
| Subject: | Re: parse-error MySQL - PhP @ win2000 | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-14219@lists.php.net to get a copy of this message | ||
Hi Jelle,
----- Original Message -----
I have recently installed an apache server, PhP4 and MySql on my win2000 machine (I know, I should
be running
linux; That will have to come with time). But now I am trying to learn PhP - MySQL. When running the
script
below I get the error message:
Parse error: parse error in c:\phpdev\www\public\test2.php on line 25
Is there anybody who knows what the problem might be? I think is in the result display part,
considering how
things run properly when I leave it out. Hopefully you ca get me going, since I do not know what I
am doing
wrong!!
Thanks for the help,
Jelle
<?
$host="localhost";
$username="";
$password="";
$database="jelle_test";
$table="pet";
$db = mysql_connect($host)
or die ("verbinding maken met de server is mislukt");
Echo "gefeliciteerd, de verbinding is tot stand gebracht, de handle is $db";
@mysql_select_db($database, $db)
or die ("Helaas geen verbinding kunnen maken met de database");
$sql_select = "Select * from pet";
$result = mysql_query($sql_select, $db);
if($result) {
echo "Selectie succesvol";
while ( $resultaat = mysql_fetch_row($result)) {
printf($resultaat[0]);
}
mysql_close($db);
?>
=an error message that quotes a line number AFTER the end of the script indicates that some entity
has been
opened but not closed. In this case curly brackets.
=Various source code formatting conventions exist to try to avoid the situation (that we have here)
where the
appearance of the source code works to deceive brain and eye. There has been some debate in PHP
forums about the
'best' way (FWIW my opinion: whatever works=best), and this is an excellent illustration
of why coding the
opening bracket of a code block this way, may not be "best" way! The code-block
indentation is not consistent
which further disguises the omission.
=Regards,
=dn