Hi all. In the project I'm working on, I've got a table with ids that are
written based on how many records are in the table. i.e., the first record
has an ID of 1, the 50th is 50, etc. When a row gets deleted (I created a
web interface, I don't want all these members using phpMyAdmin), the ID's of
all the records after it are supposed to be decremented by one. I thought
it was working, but yesterday it didn't. Can anyone see what I'm doing
wrong?
***********
if ($delete == 1){
#delete the row
$worked = mysql_query("delete from $tablename where
$fields[0]=\"$editval\" ", $database);
if (!$worked){
echo "couldn't delete anything<p>";
}//end if
$connection = @mysql_connect("localhost",$PHP_AUTH_USER,$PHP_AUTH_PW);
$database = @mysql_select_db($databasename, $connection);
$del = mysql_query("select * from $tablename where RestID =
$restidval", $database);
while ($Info_Array = mysql_fetch_array($del)){
#update the ids of each record
if($Info_Array[$v] > $editval){ #v is a fieldname (specifically
the id) defined above
mysql_query("update $tablename set $fields[0] =
($fields[0]-1) where $fields[0] = \"$Info_Array[$v]\" ", $database);
}//end if
}//end while
$delete=0; #reset the delete flag
}//end if
***********
Assume that all the variables have the values they're supposed to (cuz last
I checked, they do. :))
Thanks for your help. Again.
Jason
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]