|
Posted by Miguel Cruz on 08/07/06 14:03
"mantrid" <ian.dandav@virgin.net> wrote:
> Ive made the changes you suggested. I dont get any errors now but the
> records are not updating. It is most puzzling. My updated code is below
>
>
> ****************************************************************************
> *****
> $delarray=$_POST['del'];//not needed in the sql of first two queries so isnt
> in for loop
>
> if(count($delarray)==0){
> for ($i = 0; $i < count($commindexarray); $i++){
> $currtime=date('YmdHis');
> $cat = intval($_POST['category'][$i]);
> $comm = mysql_real_escape_string($_POST['comm'][$i]);
> $avail =$_POST['avail'][$i];
> $commindex = intval($_POST['commindex'][$i]);
>
> $q2 ="UPDATE usercomms SET typeid=$cat WHERE userid=".$_SESSION['userid']."
> AND commindex =$commindex";//
> $updateusercomm = mysql_query($q2) or die('<br><span
> class=RedWarning>Sorry, there was a problem updating. Try
> again.<br><br>Error - 1 '.count($delarray). mysql_error().'</span>');
> $q="UPDATE comments SET typeid=$cat, comment='$comm', available=$avail,
> timestp='$currtime', globalavail=0 WHERE commindex=$commindex";//
> $updatecomm = mysql_query($q) or die('<br><span class=RedWarning>Sorry,
> there was a problem updating some records. Try again.<br><br>Error - 2
> '.count($delarray).mysql_error().'</span>');
> }
> }
I would print out $q and $q2 to ensure that $_SESSION['userid'] contains
what you thought it does.
miguel
--
Photos from 40 countries on 5 continents: http://travel.u.nu
Latest photos: Malaysia; Thailand; Singapore; Spain; Morocco
Airports of the world: http://airport.u.nu
[Back to original message]
|