|
|
|
ช่วยหน่อยครับ รับค่าจาก POST Array แล้วแปลงค่ามา ค้นหาเงือนไข SQL ยังไงครับ |
|
|
|
|
|
|
|
Code (PHP)
$test = "'".implode("','",$_POST['PostArray'])."'";
|
|
|
|
|
Date :
2015-01-28 16:08:29 |
By :
Manussawin |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Code (PHP)
$arrCriteria = Array (
0 => "Bannanuson",
1 => "Wichai"
) ;
$sqlStmt = "SELECT * FROM employee where 1=1 ";
$criteria = "";
foreach($arrCriteria as $key => $val){
if($criteria != ""){
$criteria .= ", ";
}
$criteria .= "'" . $val . "'";
}
$sqlStmt .= " and Fname IN (" . $criteria . ")";
|
|
|
|
|
Date :
2015-01-28 16:15:14 |
By :
windersun |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ได้แล้วครับ แต่มันขึ้นข้อความแบบนี้คือไรครับ บนหัว
Warning: implode() [function.implode]: Invalid arguments passed in
|
|
|
|
|
Date :
2015-01-28 16:33:11 |
By :
natt500 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
You are getting the error because $_POST['PostArray'] is not an array. You can try
Code (PHP)
$test = "'".implode("','",(array)$_POST['PostArray'])."'";
|
|
|
|
|
Date :
2015-01-28 16:52:05 |
By :
Manussawin |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 04
|