?

Search Help Board

PHP FAQ
PHP Articles
PHP Help
Bulletin Board

PHP Manual (NEW!)
First Time PHP'ers
Help with programming
Sql assignment help
PHP Homework Help


C# Help

?
?Re: keywords, checkbox array search
Author:??(---.cpe.net.cable.roger)
Date:???07-17-03 06:44

i notices a little error in the code here
//if img_type optional - then check for it and use if needed
if ($img_type!="na"){
$query1.=" image_type in (".'$img_type'.")";
}

s/b

//if img_type optional - then check for it and use if needed
if ($img_type!="na"){
$query1.=" image_type in ('".$img_type."')";
}
and here as well

$query1.=" and extension in ('".$ext_type."')";

and same for subject...the quotes should be inside the normal query text and not surrounding the variable...better fix 'em up

also since the values are text and not numeric, the array needs to be handled differently since we need single_quote item end_single_quote like 'bmp' to check a value (I had assumed numeric not seeing the form itself...)

so we need to handle the array something similar to the search string array

$num=count($_POST['extension'];
if ($num==1){
$ext_type="'".$_POST['extension']."'";
}elseif ($num>1){
for ($x=0;$x<$num;$x++){
if ($x==0){
//first element so no comma separator needed
$ext_type.="'".$_POST['extension']."'";
}else{
//add the comma separator
$ext_type.=",'".$_POST['extension']."'";
} //close if then
}//close for loop
}else{
//no elements so set to "na"
$ext_type="na";
}


hope this helps get it

?Topics Author? Date
?keywords, checkbox array search??new
Truly 07-05-03 12:47?
?Re: keywords, checkbox array search??new
bastien 07-06-03 07:10?
?Re: keywords, checkbox array search??new
Truly 07-08-03 10:20?
?Re: keywords, checkbox array search??new
bastien 07-09-03 19:00?
?Re: keywords, checkbox array search??new
Truly 07-09-03 20:54?
?Re: keywords, checkbox array search??new
bastien 07-13-03 17:29?
?Re: keywords, checkbox array search??new
bastien 07-15-03 10:37?
?Re: keywords, checkbox array search??new
Truly 07-16-03 20:20?
?Re: keywords, checkbox array search??new
bastien 07-17-03 06:44?
?Re: keywords, checkbox array search??new
Truly 07-20-03 13:57?
?Re: keywords, checkbox array search??new
bastien 07-21-03 17:41?
?Re: keywords, checkbox array search??new
Truly 08-21-03 08:21?
Go to Top??|??Go to Topic??|??Flat View??|??Search?
??|??
New Topic
?Reply To This Message
?Your Name:
?Your Email:
?Subject:
Email replies to this thread, to the address above.
??wrote: > > i notices a little error in the code here > //if img_type optional - then check for it and use if needed > if ($img_type!="na"){ > $query1.=" image_type in (".'$img_type'.")"; > } > > s/b > > //if img_type optional - then check for it and use if needed > if ($img_type!="na"){ > $query1.=" image_type in ('".$img_type."')"; > } > and here as well > > $query1.=" and extension in ('".$ext_type."')"; > > and same for subject...the quotes should be inside the normal > query text and not surrounding the variable...better fix 'em up > > also since the values are text and not numeric, the array > needs to be handled differently since we need single_quote > item end_single_quote like 'bmp' to check a value (I had > assumed numeric not seeing the form itself...) > > so we need to handle the array something similar to the > search string array > > $num=count($_POST['extension']; > if ($num==1){ > $ext_type="'".$_POST['extension']."'"; > }elseif ($num>1){ > for ($x=0;$x<$num;$x++){ > if ($x==0){ > //first element so no comma separator needed > $ext_type.="'".$_POST['extension']."'"; > }else{ > //add the comma separator > $ext_type.=",'".$_POST['extension']."'"; > } //close if then > }//close for loop > }else{ > //no elements so set to "na" > $ext_type="na"; > } > > > hope this helps get it ">??

Provided By
Phorum