Chomauk
Programmer
- Jun 8, 2001
- 130
I have the following code:
here is the actual code from the echo:
CREATE TABLE WeeklyGames (VTeam varchar(13), VTeamNum tinyint(2), HTeamNum Tinyint(2)); INSERT INTO WeeklyGames SELECT T.Team, G.VTeamNum, G.HTeamNum FROM Teams T INNER JOIN Games G ON T.TeamNum = G.VTeamNum WHERE G.WeekNum = 1; SELECT G.GameDay, WG.VTeam, G.VScore, T.Team, G.HScore FROM Games G, WeeklyGames WG INNER JOIN Teams T ON WG.HTeamNum = T.TeamNum WHERE G.WeekNum = 1 And WG.VTeamNum = G.VTeamNum ORDER BY G.GameDay, G.GameTime, WG.VTeam;
I get the following error:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/virtual/site104/fst/var/ on line 23
Fatal error: Call to undefined function: mysql_stmt_execute() in /home/virtual/site104/fst/var/ on line 35
I tested the code in MySQL and it works so I'm assuming the error is with php or how I'm creating the temp table first or something. I've also tried mysql_stmt_execute &
mysql_fetch_row with similar errors in a mixture of creating the temp table first and executing that but nothing works. Any suggestions to save me would be greatly appreciated.
"Failure is the tuition you pay for success."
~ Walter Brunell ~
Code:
<?php
$sqlString = "CREATE TABLE WeeklyGames ";
$sqlString = $sqlString . "(VTeam varchar(13), VTeamNum tinyint(2),
HTeamNum Tinyint(2)); ";
$sqlString = $sqlString . " INSERT INTO WeeklyGames SELECT T.Team, G.VTeamNum, G.HTeamNum ";
$sqlString = $sqlString . " FROM Teams T INNER JOIN Games G ON T.TeamNum = G.VTeamNum ";
$sqlString = $sqlString . " WHERE G.WeekNum = 1; ";
$sqlString = $sqlString . " SELECT G.GameDay, WG.VTeam, G.VScore, T.Team, G.HScore ";
$sqlString = $sqlString . " FROM Games G, WeeklyGames WG ";
$sqlString = $sqlString . " INNER JOIN Teams T ON WG.HTeamNum = T.TeamNum ";
$sqlString = $sqlString . " WHERE G.WeekNum = 1 And WG.VTeamNum = G.VTeamNum ";
$sqlString = $sqlString . " ORDER BY G.GameDay, G.GameTime, WG.VTeam; ";
echo $sqlString;
include ("connect.php");
$result = mysql_query($sqlString, $server);
while ($ReturnRow= mysql_fetch_array($result)) {
echo $ReturnRow["Team"];
printf("<br />");
echo $ReturnRow["VTeam"];
printf("<br />");
echo $ReturnRow["HTeam"];
printf("<br />");
}
$result = mysql_stmt_execute("Drop table WeeklyGames;", $server);
mysql_close($server);
?>
CREATE TABLE WeeklyGames (VTeam varchar(13), VTeamNum tinyint(2), HTeamNum Tinyint(2)); INSERT INTO WeeklyGames SELECT T.Team, G.VTeamNum, G.HTeamNum FROM Teams T INNER JOIN Games G ON T.TeamNum = G.VTeamNum WHERE G.WeekNum = 1; SELECT G.GameDay, WG.VTeam, G.VScore, T.Team, G.HScore FROM Games G, WeeklyGames WG INNER JOIN Teams T ON WG.HTeamNum = T.TeamNum WHERE G.WeekNum = 1 And WG.VTeamNum = G.VTeamNum ORDER BY G.GameDay, G.GameTime, WG.VTeam;
I get the following error:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/virtual/site104/fst/var/ on line 23
Fatal error: Call to undefined function: mysql_stmt_execute() in /home/virtual/site104/fst/var/ on line 35
I tested the code in MySQL and it works so I'm assuming the error is with php or how I'm creating the temp table first or something. I've also tried mysql_stmt_execute &
mysql_fetch_row with similar errors in a mixture of creating the temp table first and executing that but nothing works. Any suggestions to save me would be greatly appreciated.
"Failure is the tuition you pay for success."
~ Walter Brunell ~