[英]mysqli_multi_query not returning any value
I fired the following query with the help of mysqli_multi_query
. 我借助mysqli_multi_query
触发了以下查询。 Which is executing properly but not returning any value. 正在正确执行,但未返回任何值。 It returning blank. 它返回空白。 Whats wrong with the mysqli_multi_query
or is there any alternative for this for firing multiple queries in codeigniter. mysqli_multi_query
什么问题,或者有没有其他替代方法可以在codeigniter中触发多个查询。
$sql="LOCK TABLE xp_subunit WRITE; ";
$sql .= "SELECT @myLeft := ".$_GET['lft'].", @myRight := ".$_GET['rgt'].", @myWidth := ".$_GET['lft']." - lft + 1
FROM xp_subunit
WHERE id =".$_GET['id']."; ";
$sql .= "DELETE FROM xp_subunit WHERE lft BETWEEN @myLeft AND @myRight; ";
$sql .= "UPDATE xp_subunit SET rgt = rgt - @myWidth WHERE rgt > @myRight; ";
$sql .= "UPDATE xp_subunit SET lft = lft - @myWidth WHERE lft > @myRight; ";
$sql.="UNLOCK TABLES;";
//echo $sql;
$query = $this->db->mysqli_multi_query($sql);
Just Try with the following Example., 只需尝试以下示例。
<?php
$mysqli = new mysqli("localhost", "my_user", "my_password", "world");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
$query = "SELECT CURRENT_USER();";
$query .= "SELECT Name FROM City ORDER BY ID LIMIT 20, 5";
/* execute multi query */
$mysqli->multi_query($query);
?>
I think this may help you to get the solution. 我认为这可以帮助您获得解决方案。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.