I have a column in a db table that contains 'bolt 1/2 inch'
i got hanged when passing forward slash in the variable. If there is no slash then it code is working fine.
$par_stockDescription = 'bolt 1/2 inch'
$description = mysql_real_escape_string($par_stockDescription);
$sql_getStockId = "SELECT stock_id,units FROM table_name WHERE description ='".$description ."';
$result_stockId =db_query($sql_getStockId);
$arr_stockId = db_fetch($result_stockId);
echo $arr_stockId['stock_id'];
您的字符串配额不正确,请使用以下命令:
$sql_getStockId = "SELECT stock_id,units FROM table_name WHERE description ='".$description ."'";
将查询更改为以下内容
$sql_getStockId = "SELECT stock_id,units FROM table_name WHERE description ='".$description ."'";
This should be your query:
$sql_getStockId = "SELECT stock_id,units FROM table_name WHERE description ='".$description ."'";
Also mysql_real_escape_string has been deprecated consider mysqli or pdo
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.