$firstName = $_POST['firstName'];
$sql = "SELECT firstName FROM `colleague` WHERE `lastName`
LIKE '%{$firstName}%' LIMIT 0, 5 ";
$result = mysql_query($sql);
爲什麼不這項工作不選擇一行,當我使用出了什麼問題我使用LIKE語句與PHP中的變量
while($row = mysql_fetch_array($result)){
$output[] = $row;
echo $output;
}
這將打印零和「數組」次
重複號這是我的Android程序
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
nameValuePairs.add(new BasicNameValuePair("firstName",value));
httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
HttpResponse response = httpclient.execute(httppost);
我沒有在$ _ POST [ '的firstName']得到了什麼;
事實上,$行是憑藉mysql_fetch_array –
數組'$ hotelName = $ _POST [名字]',請看看http://docs.php.net/language.types .array#language.types.array.donts – VolkerK
「$ hotelName = $ _POST [firstName]; ... SELECT firstName ... WHERE'lastName' LIKE'%{$ hotelName}%'」你的命名有些奇怪約定「......或者你正在盲目地複製代碼片段,希望得到某種方式的工作;-) – VolkerK