Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => General

decrement problem

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

decrement problem

Postby xlordt » Fri Feb 21, 2003 11:37 pm

ok.. i have created a memo script... and im tring to add the last peace of code to my sites index.php...

any ways here is the code

Code: Select all

<?php

require_once('lib-common.php');

 $result = mysql_query("SELECT * FROM gl_memo WHERE username= '$_USER[username]'");
 $num_rows = mysql_num_rows($result);

 while($row = mysql_fetch_array($result)){
  if($num_rows != '0'){
   
   if($row['rd'] != $num_rows ){
   
    $row['num_rows']++;
    echo "<FONT COLOR=\"#FFFFFF\">You have ";
    echo $num_rows-1 . " new memo</FONT>";
  }
 
 }   
}

?>


ok let me explain the code... i have a colum in my db called
rd it means that once the user reads his/her memo then it will add a value 'r' (read) in the rd field.. anyways.. if i was to send someone a memo.. it says.. you have 0 memos.. instead of 1 ..
i want it to show the memos that dont have the read value to it.. can anyone please help me figure this one out..
User avatar
xlordt
New php-forum User
New php-forum User
 
Posts: 34
Joined: Thu Dec 12, 2002 9:00 pm
Location: NJ

Postby xlordt » Sat Feb 22, 2003 2:13 am

Please delete this post.. =) i got it done
User avatar
xlordt
New php-forum User
New php-forum User
 
Posts: 34
Joined: Thu Dec 12, 2002 9:00 pm
Location: NJ


Return to PHP coding => General

Who is online

Users browsing this forum: Google [Bot] and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.