|
Posted by J.O. Aho on 10/08/95 11:52
Jarrod wrote:
> hi J.o. aho
>
> This is how its currently set up
>
> function displayGallery($filer,$URL){
>
> $dsArt = new DB();
> $data = mysql_query("SELECT * FROM navigation ORDER BY position") or
> die(mysql_error());
>
> while($record = mysql_fetch_array($data))
> {
>
> $value1 = end($record);
Why use a whole array when you only need one cell?
$value1 = $record['last_column_name'];
> if($record[position] < intval($value1))
I wouldn't use $record[position], but $record['position']
and intval() should be not needed, if you store the values in the database as
INT and not VARCHAR/CHAR/TEXT/BLOB.
> {
> echo'down';
> }
> else if($record[position] == '110')
Looking how things are in the first if-statement, $record['position'] seems to
be an integer and '110' is a string, comparing integers and strings can lead
to problems, so don't, keep the types matched as often as possible.
> {
> echo'up';
> }
> else if($record[position] != '110' && $record[position] != '10')
> {
> echo 'up/down';
>
> }
>
> }
>
> echo '<td></tr>';
>
> }
function displayGallery($filer,$URL){
$dsArt = new DB();
$data = mysql_query("SELECT * FROM navigation ORDER BY position") or
die(mysql_error());
while($record = mysql_fetch_array($data)) {
$value1 = $record['last_column_name'];
if($record['position'] < $value1) {
echo'down';
} else if($record['position'] == 110) {
echo'up';
} else if($record['position'] != 110 && $record['position'] != 10) {
echo 'up/down';
}
}
echo '<td></tr>';
}
//Aho
Navigation:
[Reply to this message]
|