[SOLVED] positive or negative

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
User avatar
ol4pr0
Forum Regular
Posts: 926
Joined: Thu Jan 08, 2004 11:22 am
Location: ecuador

[SOLVED] positive or negative

Post by ol4pr0 »

How can i determen if a number in the database is negative or positive.

Code: Select all

if ($row['number'] == 'negative'))
echo this.
else
echo this
Last edited by ol4pr0 on Sun Jul 11, 2004 6:24 pm, edited 1 time in total.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Code: Select all

<?php

echo ( (int)$row['number'] < 0 ? 'negative' : 'positive' );

?>
??
User avatar
ol4pr0
Forum Regular
Posts: 926
Joined: Thu Jan 08, 2004 11:22 am
Location: ecuador

Post by ol4pr0 »

Thanks ill try that.
Post Reply