Reply to Re: strange behaviour using arrays to update records

Your name:

Reply:


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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация