Hi there!
In a MySQL table containing all the former students of my school, there is a Column which name is ‘promo’. This column contains the year a Student entered the School.
Other columns are ‘lastName’ and ‘firstName’.
I want to extract from promo ALL the lastName and the firstName of the Students belonging to a specific year. Data is sent back to the appropriate dynamic field of a Flash file (variable named ‘listetotale’) .
I already have set up a script which is functional EXCEPT it only returns one pair lastName-firstName. Would you tell me what’s wrong in it?
The script is shown below.
Many cheerful thanks for any efficient help!!!
SCRIPT :
<?php
include ‘key.php’;
$table = “listaix”;
$promotion = $_POST[ “promoyear” ];
mysql_connect( $host, $user, $pass) or die( "cannot connect " .mysql_error() );
mysql_select_db( $db ) or die( "cannot select db ".mysql_error() );
$result = mysql_query( “SELECT * FROM $table WHERE promo like ‘%$promotion%’” ) or die ( “select error " . mysql_error() );
if ( mysql_num_rows( $result ) > 0 )
print “status=ok</br>”;
else
print “status=not found”;
while ( $row = mysql_fetch_array( $result ) ) {
print “&listetotale=”.$row[“lastName”].”, ".$row[“firstName”];
}
?>