Forum Moderators: coopster
Relevent bit of code:
$query = "SELECT * FROM SS_League WHERE ID='$session_uid' ORDER BY Name";
$results = mysql_query( $query, $link );
while( $myrow = mysql_fetch_array( $results ) ) {
$lid = $myrow[ "ID" ];
$lname = $myrow[ "Name" ];
$query_league = "SELECT * FROM SS_League" . $lid . " WHERE AgentID = '$session_uid'";
$results_league = mysql_query( $query_league, $link );
while( $myrow_league = mysql_fetch_array( $results_league ) ) { // This is line 33, see error below
$lworth = $myrow_league[ "Worth" ];
}
// Lines which output the variables in some html.
}
This is the error when I load the page:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in [file name] on line 33.
I've checked, and the problem is not the use of $lid in the second query. The error occurs even when I hard-code a table name into the query.
I feel as though I must be missing something obvious, but I'm totally stumped.
Thanks in advance. :)
To receive that error the query must be failing. So we need to look at this line:
$results_league = mysql_query( $query_league, $link );
Change this to the following:
$results_league = mysql_query( $query_league, $link ) or die(mysql_error());
This should output the problem to the browser.
dc