Parse error line 11!

eliezer

Registered
When I try to open http://eliste.freesuperhost.com/phptest.php I get:

Parse error: parse error in /home/www/eliste.freesuperhost.com/phptest.php on line 11

line 11 is:
<?php
that's it! what's going on? i tried to change it to <? and that didn't work either.

this is the rest of the code:
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>PHP Test Page</title>
</head>

<body>


<?php

$user="•••••••";
$password="••••••••••";
$database="•••••••••••";
mysql_connect(••••••••••••,$user,$password);
@mysql_select_db($database) or die( "Unable to select database");

$car_id="1"
?>

<table border="1">
    <tr>
        <td>Make</td>
        <td><?php
print "SELECT Make: FROM cars WHERE car_id="$car_id";"
?></td>
    </tr>
    <tr>
        <td>Model</td>
        <td><?php
print "SELECT Model: FROM cars WHERE car_id="$car_id";"
?></td>
    </tr>
</table>

<?php
mysql_close();
?>
</body>
</html>

if you see any other mistakes in the code, please point them out.

thanks in advance
 
i changed it again and i'm getting parse error line 12, which is:

Code:
$password:••••••••

this is what the code looks like now:

Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>PHP Test Page</title>
</head>

<body>

<?php
$user="eliste_car";
$password="••••••••";
$database="eliste_car";
mysql_connect(freesuperhost.com,$user,$password);
@mysql_select_db($database) or die( "Unable to select database");

$car_id="1"

$query1="SELECT Make FROM cars WHERE car_id="$car_id";
$result1=mysql_query($query1);

$query2="SELECT Make FROM cars WHERE car_id="$car_id";
$result2=mysql_query($query2);

?>

<table border="1">
    <tr>
        <td>Make</td>
        <td>
<? echo $result1; ?>
</td>
    </tr>
    <tr>
        <td>Model</td>
        <td>
<? echo $result2; ?>
</td>
    </tr>
</table>

<?php
mysql_close();
?>
</body>
</html>
 
you are missing the ';' after '$car_id="1"' You've got that error in both versions.

that's the most common mistake when doing php programming.
when you get parsing errors !always! assume that you are missing a ';'
and the parsing error is never reported to be on the line where the problem is.
 
ok. i've changed that, i changed one or two more mistakes that i found and now i'm getting the message:
Warning: mysql_connect(): Unknown MySQL Server Host 'freesuperhostcom' (1) in /home/www/eliste.freesuperhost.com/phptest.php on line 10
Unable to select database


i'm sure that the mysql serverhost is freesuperhost.com. the reason that it hasn't selected the database is because it hasn't connected to the server (i think), so that isn't a problem at the moment.

this is what the code looks like now:

Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>PHP Test Page</title>
</head>

<body>

<?php
$user="eliste_car";
$password="•••••••••";
$database="eliste_car";
mysql_connect(freesuperhost.com,$user,$password);
@mysql_select_db($database) or die( "Unable to select database");

$car_id="1";

$query1="SELECT Make FROM cars WHERE car_id='$car_id'";
$result1=mysql_query($query1);

$query2="SELECT Make FROM cars WHERE car_id='$car_id'";
$result2=mysql_query($query2);
?>

<table border="1">
    <tr>
        <td>Make</td>
        <td>
<? echo $result1; ?>
</td>
    </tr>
    <tr>
        <td>Model</td>
        <td>
<? echo $result2; ?>
</td>
    </tr>
</table>

<?php
mysql_close();
?>
</body>
</html>
 
sorry that was rubbish i edited it from "has connected" to "hasn't connected". typo.

anyway why isn't it displaying the make or model?
 
Back
Top