vertices
10-04-2004, 12:48 AM
I need to use 4 SQL SELECT statements on one PHP Page. I've been trying this:
<?php
if (isset($HTTP_GET_VARS["benchmark"])){
$benchmark = $HTTP_GET_VARS["benchmark"];
} // end if
if ($benchmark == "3dmark01") {
$benchname= "2001";
}
if ($benchmark == "3dmark03") {
$benchname= "2003";
}
if ($benchmark == "3dmark05") {
$benchname= "2005";
}
$dbServer = "localhost";
$dbDatabase = "xxxx";
$dbUser = "xxxx";
$dbPass = "xxxx";
$sConn = @mysql_connect($dbServer, $dbUser, $dbPass)
or die("Couldn't connect to database server");
$dConn = @mysql_select_db($dbDatabase, $sConn)
or die("Couldn't connect to database $dbDatabase");
$query = "SELECT MIN(score), MAX(score), AVG(score) FROM $benchmark";
$result = mysql_query($query) or die("Error: " . mysql_error());
$query2 = "SELECT cpu, MIN(score), MAX(score), AVG(score) FROM $benchmark WHERE cpu="intel" GROUP BY cpu";
$result2 = mysql_query($query2) or die("Error: " . mysql_error());
$query3 = "SELECT cpu, MIN(score), MAX(score), AVG(score) FROM $benchmark WHERE cpu="amd" GROUP BY cpu";
$result3 = mysql_query($query3) or die("Error: " . mysql_error());
$query4 = "SELECT video, MIN(score), MAX(score), AVG(score) FROM $benchmark GROUP BY video";
$result4 = mysql_query($query4) or die("Error: " . mysql_error());
I am using these on different parts of the page. The page is basically a large averages page.
I currently get the following error when I add more than 1 of these SELECT statements:
Parse error: parse error, unexpected T_STRING
This error always is on the line where $query2 starts.
It works fine with only the first statement but when I add the second I get the error.
Anyone have a solution for me?
Thanx in advance.:)
<?php
if (isset($HTTP_GET_VARS["benchmark"])){
$benchmark = $HTTP_GET_VARS["benchmark"];
} // end if
if ($benchmark == "3dmark01") {
$benchname= "2001";
}
if ($benchmark == "3dmark03") {
$benchname= "2003";
}
if ($benchmark == "3dmark05") {
$benchname= "2005";
}
$dbServer = "localhost";
$dbDatabase = "xxxx";
$dbUser = "xxxx";
$dbPass = "xxxx";
$sConn = @mysql_connect($dbServer, $dbUser, $dbPass)
or die("Couldn't connect to database server");
$dConn = @mysql_select_db($dbDatabase, $sConn)
or die("Couldn't connect to database $dbDatabase");
$query = "SELECT MIN(score), MAX(score), AVG(score) FROM $benchmark";
$result = mysql_query($query) or die("Error: " . mysql_error());
$query2 = "SELECT cpu, MIN(score), MAX(score), AVG(score) FROM $benchmark WHERE cpu="intel" GROUP BY cpu";
$result2 = mysql_query($query2) or die("Error: " . mysql_error());
$query3 = "SELECT cpu, MIN(score), MAX(score), AVG(score) FROM $benchmark WHERE cpu="amd" GROUP BY cpu";
$result3 = mysql_query($query3) or die("Error: " . mysql_error());
$query4 = "SELECT video, MIN(score), MAX(score), AVG(score) FROM $benchmark GROUP BY video";
$result4 = mysql_query($query4) or die("Error: " . mysql_error());
I am using these on different parts of the page. The page is basically a large averages page.
I currently get the following error when I add more than 1 of these SELECT statements:
Parse error: parse error, unexpected T_STRING
This error always is on the line where $query2 starts.
It works fine with only the first statement but when I add the second I get the error.
Anyone have a solution for me?
Thanx in advance.:)