# Parse error line 11!



## eliezer (Nov 8, 2005)

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:

```
<!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


----------



## eliezer (Nov 8, 2005)

now ive got parse error line 17 and theres nothing on the line! whats going on?


----------



## eliezer (Nov 8, 2005)

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


```
$password:
```

this is what the code looks like now:


```
<!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>
```


----------



## BjarneDM (Nov 8, 2005)

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.


----------



## eliezer (Nov 9, 2005)

cheers! i'll make the changes.

if it works, you are a king!


----------



## eliezer (Nov 9, 2005)

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:


```
<!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>
```


----------



## BjarneDM (Nov 9, 2005)

Your assumption is wrong


----------



## eliezer (Nov 9, 2005)

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?


----------



## BjarneDM (Nov 9, 2005)

How about keeping your problems to one thread ? you are posting more or less the same questions in two different threads. And do read my answer in the other thread: 
http://www.macosx.com/forums/showthread.php?t=258730


----------

