Hi



> -----Original Message-----
> From: Jennifer Downey [mailto:[EMAIL PROTECTED]]
> Sent: 24 February 2002 22:28
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] If else trouble
>
>
> Hi all,
>
> I have worked and re-worked this if else statement. I can't get
> it to work.
>
> It's suppose to work like this.
>
> If there are no points in the bank then echo but it always echo's
> you don't
> have enough points. It also wont keep me from withdrawing more than I have
> in the bank.
>
> What am I doing wrong and how do I keep the script from letting
> me withdraw
> more than I have, and keep it from echoing "you don't have enough points!"
> all the time?
>
> $sql_result = mysql_query("SELECT * FROM bank_points WHERE
> uid={$session["uid"]}");
> if ($sql_result <= "0") {
>          echo "you don't have enough points!";
>
> }else{
>    echo "Your withdraw has been made!";
> }
>


$sql_result is the result ID,

you need

$row = mysql_fetch_array($sql_result)

which loads the returned row into an array  $row

Guessing your field is called bank_points_total

if ($row["bank_points_total"] <= "0")
  {
          echo "you don't have enough points!";
  }
else
  {
     echo "Your withdraw has been made!";}
  }


HTH


Peter


-----------------------------------------------
Excellence in internet and open source software
-----------------------------------------------
Sunmaia
www.sunmaia.net
[EMAIL PROTECTED]
tel. 0121-242-1473
-----------------------------------------------

> Thanks in advance
> Jennifer Downey
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to