RE: [PHP4BETA] Problems with php4

From: Date: Fri, 04 Feb 2000 19:11:25 +0000
Subject: RE: [PHP4BETA] Problems with php4
Groups: php.version4 
Request: Send a blank email to php-version4+get-9827@lists.php.net to get a copy of this message
> Another issue that I've come across is when I use the code: > while( $resultArray = mysql_fetch_array( $result )) { > ... > } > I get the same error: "Page cannot be displayed" after sitting > there chugging away for about 30 seconds or so. When I take > the mysql_fetch_array() out of the loop (same code, just not > within the while loop), everything works just fine. > What is going on? I found out what was going on here. The problem turns out to be the query that I'm running on this page. This page works fine in php3, the query runs fine from mysql, but when this page tries to run the query under php4, I get a "Page cannot be displayed error". Here is the code: <script language="php"> $pageTitle = "News and Information"; require( "html_func.php3" ); $bodyDefinition = "Marginwidth=165 marginheight=0 leftmargin=165 topmargin=0 id=\"bbody\""; HTMLHeader( $pageTitle, $bodyDefinition ); echo "<img src=\"images/new-news-header.gif\" border=\"0\"><br>\n"; mysql_pconnect( "localhost", "nobody" ); // $query = "SELECT * FROM news ORDER BY heading, counter"; $query = "SELECT * FROM logins"; $result = mysql( "$dbname", $query ); echo "Query: $query<br>\n"; echo "Found " . mysql_num_rows( $result ) . " records.<br>\n"; if( !$result ) { showErrorMessage( mysql_error()); } else { echo "No Error<br>\n"; if( mysql_num_rows( $result ) <= 0 ) { echo "<br><center>\n"; echo "No News Items were found.<br><br>\n"; echo "</center>\n"; } else { echo "<br><br>\n"; echo "<center>\n"; echo "<table border=\"0\" width=\"75%\">\n"; $curHeading = ""; while( $newsInfo = mysql_fetch_array( $result )) { echo "In Loop<br>\n"; if( strtolower( $newsInfo["heading"] ) != strtolower( $curHeading )) { $curHeading = $newsInfo["heading"]; echo "<th><u>" . strtoupper( $curHeading ) . "<u></th></tr>\n"; echo "<td align=\"center\"><hr width=\"50%\"><br></td></tr>\n"; } echo "<td>" . ereg_replace( "\n", "<br>\n", $newsInfo["body"] ) . "</td></tr>"; echo "<td><br></td></tr>\n"; } echo "</table>\n"; echo "</center>\n"; } } require( "scrollmenu.php3" ); HTMLFooter(); </script> When I comment out the first query ("SELECT * FROM news..."), I do not get the error. When I uncomment it and comment out the second, I do get the error. It is just this one query - a query that runs fine and returns results from mysql and a query that runs fine from this page on php3. Any ideas? Chris

« previous php.version4 (#9827) next »