Forum Moderators: coopster
$sql = 'SELECT * FROM table';
$result = mysql_query($sql);
if($res = mysql_fetch_assoc($result)) {
// Hundreds
// of
// lines
// of
// code
} else {
echo 'Error';
}
$sql = 'SELECT * FROM table';
$result = mysql_query($sql);
if(!($res = mysql_fetch_assoc($result))) {
echo 'Error';
} else {
// Hundreds
// of
// lines
// of
// code
}
Matt:$sql = 'SELECT * FROM table';
$result = mysql_query($sql);
if($rows = mysql_num_rows($result)) {
for($i = 0; $i < $rows; $i++) {
// Stuff
}
}
we do bespoke work ontop of a pre-existing framework when developing sites, and to make following the logic easier for each other we try and keep the coding style similar-ish to what's already there
Point your colleague at my rant then :P