/    Sign up×
Community /Pin to ProfileBookmark

Automatically opening another webpage problem

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[/url]

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

to post a comment
PHP

0Be the first to comment 😎

×

Success!

Help @Edwardp spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...