I am using the following code. It is the entire code for this page. I should take some data, using $_GET, from the previous page. On loading it should access a database, and then load another page passing the data drawn from my dbase.
The code
<head>
<script language=”JavaScript”>
function openURL(dat1, dat2, dat3, dat4, dat5){
var dataString = “selectYear=”+dat1+”&selectModel=”+dat2+”&selectRange=”+dat3+”&selectChassis=”+dat4+”&selectType=”+dat5
alert(dataString)
parent.document.getElementById(“view”).src=”view.php?”+dataString
}
</script>
</head>
<?php
$buildNumber=$_GET[‘build’];
$conn=odbc_connect(‘ProjectTestDbase’,”,”);
(!$conn) ? exit(“Connection Failed: ” . $conn) : (print ”);
$sql=”SELECT Year.Year, Model.Model, Range.Range, Chassis.Chassis, Type.Type FROM [Year] INNER JOIN (Model INNER JOIN (Type INNER JOIN (Range INNER JOIN (Chassis INNER JOIN (StandardBuild INNER JOIN Builds ON StandardBuild.StandardBuildNum = Builds.StandardBuildNum) ON Chassis.chassisID = StandardBuild.ChassisID) ON Range.rangeID = StandardBuild.RangeID) ON Type.typeID = StandardBuild.TypeID) ON (Model.modelID = Range.modelID) AND (Model.modelID = StandardBuild.ModelID)) ON (Year.yearID = Model.yearID) AND (Year.yearID = StandardBuild.YearID) WHERE (((Builds.BuildNum)=’8888′))”;
$rs=odbc_exec($conn,$sql);
!($rs) ? exit(“Error in SQL”) : (print”);
while (odbc_fetch_row($rs)){
$data0=odbc_result($rs,1);
$data1=odbc_result($rs,2);
$data2=odbc_result($rs,3);
$data3=odbc_result($rs,4);
$data4=odbc_result($rs,5);
}
odbc_close($conn);
?>
<body onload=”openURL(‘<?php echo $data0; ?>’,'<?php echo $data1; ?>’,<?php echo $data2; ?>’,'<?php echo $data3; ?>’,'<?php echo $data4; ?>’)”></body>
When i get to this page, i get the following error:
Line: 15
Char: 29
Error: Expected ‘)’
Code: 0
URL: [url]http://localhost/project4/viewBuffer.php?build=8888
The main problem is that i dont understand the error. Line 15 is the $_GET constant.
Also, can this be done in another fashion, I’m quite a newb at this (4 or 5 weeks) never done html before thius job, my background is soft eng.
Much appreciation