For Every Row In mySQL Database
Moderator: General Moderators
For Every Row In mySQL Database
How do I make php run a script for every row in a sql database and stop when there is no more rows.
Re: For Every Row In mySQL Database
$qry = mysql_query("SELECT something FROM table");
While($row = mysql_fetch_array($qry) {
echo $row['something'];
}
While($row = mysql_fetch_array($qry) {
echo $row['something'];
}
Re: For Every Row In mySQL Database
too elaborate alittle more:
Code: Select all
function MyFunction($parm1 = '', $parm2 = '', $etc = ''){
// Do Something
}
$qry = mysql_query("SELECT something FROM table");
While($row = mysql_fetch_array($qry) {
echo $row['fieldname']; // would echo data from the data field
MyFunction($parm1, $parm2, $etc); // Would Call a Script/Function | Parms are OPTIONLA
}