PHP/MySQL Parse error: syntax error, unexpected T_VARIABLE
I am new to web programming and I am testing my first PHP/MySQL data request from HTML.
I am already getting the following parsing error:
Parse error: syntax error, unexpected T_VARIABLE......on line 7.
The simple code is as follows:
<? php
$pwd = $_POST['password'];
$dbn = $_POST['dbname'];
$hnm = $_POST['hostname'];
$link_id = mysql_connect($hnm,$dbn,$pwd); // this is line 7 where I am getting the error
if (isset($link_id))
{
$result = mysql_list_dbs($link_id);
echo $result;
mysql_select_db("hppumps",$link_id);
$result = mysql_list_tables("hppumps",$link_id);
echo $result;
$result = mysql_list_fields("hppumps","models");
echo $result;
$rows = mysql_affected_rows($result);
if ($rows<1) {echo "Error. The record was not added to the database.";}
else {echo "$rows record(s) has been added to the database.";}
}
else
{
echo "Error. You were unable to connect to the MySql database";
}
?>
ANY HELP WITH THIS WOULD BE GREATLY APPRECIATED !
