As the title suggests. I am using PHP to query out a list of users that I would like to populate my selection box with. This seems fairly simple, but I am not sure what is wrong.
If I run the page by itself, it works fine. However, when I cut & paste the code into the final page IE gives me a run time error "Expected ';'" line 71. (This would be my SQl statement.
function loadsel()
{
/* Enter connection info */
$server='iSeries'; /* name of the iSeries */
$user='user';
$pass='pass';
/* echo $server.','.$user.','.$pass.'<br>'; for testing */
/* Connect */
$con=odbc_connect($server,$user,$pass);
/* test connection */
if (!$con)
{
die('Could not connect!<br>');
}
/* SQl Statement */
$sql = 'SELECT stuff FROM tables';
echo $sql.'<br>';
/* Run Query */
$rsRes = odbc_exec($con,$sql);
/* Test of query was successfull */
if (!$rsRes)
{
exit("Error in SQL!<br>");
}
/* Start form */
echo '<b>Select a Resource:</b>';
echo '<form>';
echo '<select name="users" onchange="showUser(this.value)">';
echo '<option value="">Select a person:</option>';
/* Fill combo box with results */
while(odbc_fetch_row($rsRes))
{
echo '<option value='.odbc_result($rsRes,1).'>'.odbc_result($rsRes,1).'</option>';
}
/* End Form */
echo '</select>';
echo '</form>';
/* Close connection */
odbc_close($con);
}
</script>
</head>
<body onLoad="loadsel()">
Not sure where I am going wrong here
Thanks for any help.