Hello
Im having problems working out why the following code does not work. I dont
think its the sql as the error occurs on the first update which ever one is
put there ($q1 or $q2). Ive swapped then around to test this.
Help greatly appreciated
The error is Unknown column 'A' in 'field list'
but there is no field 'A'. im thinking that the 'A' may be first letter of
the word Array, as if it is using this as a variable, but i dont know how.
$commindexarray =$_POST['commindex'];
$catarray=addsl ashes($_POST['category']);
$commarray=adds lashes($_POST['comm']);
$availarray=$_P OST['avail'];
$delarray=$_POS T['del'];
if($delarray==' '){
for ($i = 0; $i < count($comminde xarray); $i++){
$currtime=date( 'YmdHis');
$q2 ="UPDATE usercomms SET typeid={$catarr ay[$i]} WHERE userid=
".$_SESSION['userid']." AND commindex ={$commindexarr ay[$i]}";//
$updateusercomm = mysql_query($q2 ) or die('<br><span
class=RedWarnin g>Sorry, there was a problem updating. Try
again.<br><br>E rror - 1 '.count($delarr ay). mysql_error().' </span>');
$q="UPDATE comments SET typeid={$catarr ay[$i]}, comment='{$comm array[$i]}',
available={$ava ilarray[$i]}, timestp='$currt ime', globalavail=0 WHERE
commindex={$com mindexarray[$i]}";//
$updatecomm = mysql_query($q) or die('<br><span class=RedWarnin g>Sorry,
there was a problem updating some records. Try again.<br><br>E rror - 2
'.count($delarr ay).mysql_error ().'</span>');
}
}
Im having problems working out why the following code does not work. I dont
think its the sql as the error occurs on the first update which ever one is
put there ($q1 or $q2). Ive swapped then around to test this.
Help greatly appreciated
The error is Unknown column 'A' in 'field list'
but there is no field 'A'. im thinking that the 'A' may be first letter of
the word Array, as if it is using this as a variable, but i dont know how.
$commindexarray =$_POST['commindex'];
$catarray=addsl ashes($_POST['category']);
$commarray=adds lashes($_POST['comm']);
$availarray=$_P OST['avail'];
$delarray=$_POS T['del'];
if($delarray==' '){
for ($i = 0; $i < count($comminde xarray); $i++){
$currtime=date( 'YmdHis');
$q2 ="UPDATE usercomms SET typeid={$catarr ay[$i]} WHERE userid=
".$_SESSION['userid']." AND commindex ={$commindexarr ay[$i]}";//
$updateusercomm = mysql_query($q2 ) or die('<br><span
class=RedWarnin g>Sorry, there was a problem updating. Try
again.<br><br>E rror - 1 '.count($delarr ay). mysql_error().' </span>');
$q="UPDATE comments SET typeid={$catarr ay[$i]}, comment='{$comm array[$i]}',
available={$ava ilarray[$i]}, timestp='$currt ime', globalavail=0 WHERE
commindex={$com mindexarray[$i]}";//
$updatecomm = mysql_query($q) or die('<br><span class=RedWarnin g>Sorry,
there was a problem updating some records. Try again.<br><br>E rror - 2
'.count($delarr ay).mysql_error ().'</span>');
}
}
Comment