Originally Posted by
leocrawf
now i get a blank screen. So result is echoed on screen. Any idea what is happening here.
a blank screen with results echoed on screen... id love to see that (printscreen), cuz its hard to imagine. blank and at the same time with results echoed.
as regards 'what is happening here', check the line after // to display
Originally Posted by
recursion
I'm no mysql nor php guru,
...dito
PHP Code:
<?php
include_once("conn.php");
$f = ($_GET["f"]);
$query = "SELECT side, CONCAT_WS(twins,' ', tloses) AS stats FROM summary ORDER BY twins ASC";
$result = mysql_query($query) or die(mysql_error());
$numR = mysql_num_rows($result);
if ($numR > 0) ///////// CHANGED FROM : if ($numR = 1) ... which is an assignment and not a comparison
{
echo "success = 1";
$statsarray = array();
$sidearray = array();
//collect returned results in associtive manner
while($rowData = mysql_fetch_assoc($result))
{
$statsarray[] = $rowData['stats'];
$sidearray[] = $rowData['side'];
}
//to display
$loopcontrol = count($sidearray); ///////// CHANGED FROM : $loopcontrol = count($side); ... which should = $numR
for($a = 0; $a < $loopcontrol; $a++) echo $sidearray[$a] . " " . $statsarray[$a];
}
else
{
echo "success = 0";
}
// Clean up
mysql_close($dblink);
?>
it is far easier to dissect properly laid out code
PHP Code:
<?php
include_once( "conn.php" );
$f = ( $_GET[ "f" ] );
$query = "SELECT side, CONCAT_WS(twins,' ', tloses) AS stats FROM summary ORDER BY twins ASC";
$result = mysql_query( $query ) or die( mysql_error() );
if ( mysql_num_rows( $result ) == 0 ) die( "Fetch returned no results" );
// display returned results from data in associtive array
while( $rowData = mysql_fetch_assoc( $result ) ) echo $rowData["'side" ] . " " . $rowData[ "stats" ];
?>