faqts : Computers : Programming : Languages : PHP : Database Backed Sites

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

0 of 1 people (0%) answered Yes
Recently 0 of 1 people (0%) answered Yes

Entry

In a table with 10 columns how can i found the name of an Empty field in wich i can insert data?

Aug 1st, 2004 05:09
Cinley Rodick, Gath, http://www.generalforums.com , http://www.generalforums.com/yellow/


I got a way, so i share it here...
$checkgroup = mysql($database,"SELECT group_id FROM groups WHERE 
user1=0 OR user2=0 OR user3=0 OR user4=0 OR user5=0 OR user6=0 OR 
user7=0 OR user8=0 OR user9=0 OR user10=0");
list($checkgroup) = mysql_fetch_row($checkgroup);
for($num=1;$num<=10;$num++)
   {
    $col = mysql($database,"SELECT user$num FROM groups WHERE 
group_id=$checkgroup");
    list($col) = mysql_fetch_row($col);
    if($col == 0)
      {
       $user = "user$num";
       $num = 11;
       };
    };
echo "$user";