警告:mysqli_query()至少需要两个参数,其中一个参数在1579行的D:\wamp64\www\magento\includes\functions.php中给出
我再次需要一点帮助。。。我得到错误的mysql参数,我知道这个问题,但我找不到丢失的参数。。。这就是问题所在警告:mysqli_query()至少需要两个参数,其中一个参数在1579行的D:\wamp64\www\magento\includes\functions.php中给出,php,function,templates,Php,Function,Templates,我再次需要一点帮助。。。我得到错误的mysql参数,我知道这个问题,但我找不到丢失的参数。。。这就是问题所在 **`$result_template = mysqli_query($select_template) or die(mysql_error());`** 我知道缺少1个参数,但我不知道是哪个参数??你能帮我吗?谢谢 这是代码的一部分可能有用 /*function to display the active template*/ function displayTempl
**`$result_template = mysqli_query($select_template) or die(mysql_error());`**
我知道缺少1个参数,但我不知道是哪个参数??你能帮我吗?谢谢
这是代码的一部分可能有用
/*function to display the active template*/
function displayTemplate(){
$tableprefix = "";
global $tableprefix,$_SESSION;
$template_array = array();
$select_template = "SELECT vtop_filename,vleft_filename,vbottom_filename,vimages_folder,vcss_name,vtemplate_name
FROM ".$tableprefix."template_master WHERE vactive_status = 'Y'";
1579---->>>> $result_template = mysqli_query($select_template) or die(mysql_error());
$template_row = mysql_fetch_assoc($result_template);
array_push($template_array,$template_row['vtop_filename'],$template_row['vleft_filename'],$template_row['vbottom_filename'],$template_row['vimages_folder'],$template_row['vcss_name'],$template_row['vtemplate_name']);
return $template_array;
}
您需要告诉它连接到哪里。下面是一个从PHP连接到数据库的简单工作代码示例
<php
//Connect to DB
$conn = new mysqli("Hostname","Username","Password","Database");
//If the connection has errors
if ($conn->connect_error){
//Display the error
die("Connection failed because: " . $conn->connect_error);
}
//Otherwise the connection is good so lets create a sql query
$sql = "SELECT * FROM Database";
//Get the results of the query
$result = $conn->query($sql);
connect_错误){
//显示错误
die(“连接失败,因为:“.$conn->connect\U错误”);
}
//否则连接很好,所以让我们创建一个sql查询
$sql=“从数据库中选择*”;
//获取查询结果
$result=$conn->query($sql);
您需要告诉它连接到哪里。下面是一个从PHP连接到数据库的简单工作代码示例
<php
//Connect to DB
$conn = new mysqli("Hostname","Username","Password","Database");
//If the connection has errors
if ($conn->connect_error){
//Display the error
die("Connection failed because: " . $conn->connect_error);
}
//Otherwise the connection is good so lets create a sql query
$sql = "SELECT * FROM Database";
//Get the results of the query
$result = $conn->query($sql);
connect_错误){
//显示错误
die(“连接失败,因为:“.$conn->connect\U错误”);
}
//否则连接很好,所以让我们创建一个sql查询
$sql=“从数据库中选择*”;
//获取查询结果
$result=$conn->query($sql);
您应该参考php文档了解这一点
由于您使用的是过程样式,因此必须将mysqli\u connect资源传递给mysqli\u查询
<?php
$link = mysqli_connect("localhost", "my_user", "my_password", "world");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
/* Create table doesn't return a resultset */
if (mysqli_query($link, "CREATE TEMPORARY TABLE myCity LIKE City") === TRUE) {
printf("Table myCity successfully created.\n");
}
/* Select queries return a resultset */
if ($result = mysqli_query($link, "SELECT Name FROM City LIMIT 10")) {
printf("Select returned %d rows.\n", mysqli_num_rows($result));
/* free result set */
mysqli_free_result($result);
}
/* If we have to retrieve large amount of data we use MYSQLI_USE_RESULT */
if ($result = mysqli_query($link, "SELECT * FROM City", MYSQLI_USE_RESULT)) {
/* Note, that we can't execute any functions which interact with the
server until result set was closed. All calls will return an
'out of sync' error */
if (!mysqli_query($link, "SET @a:='this will not work'")) {
printf("Error: %s\n", mysqli_error($link));
}
mysqli_free_result($result);
}
mysqli_close($link);
?>
您应该参考php文档了解这一点
由于您使用的是过程样式,因此必须将mysqli\u connect资源传递给mysqli\u查询
<?php
$link = mysqli_connect("localhost", "my_user", "my_password", "world");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
/* Create table doesn't return a resultset */
if (mysqli_query($link, "CREATE TEMPORARY TABLE myCity LIKE City") === TRUE) {
printf("Table myCity successfully created.\n");
}
/* Select queries return a resultset */
if ($result = mysqli_query($link, "SELECT Name FROM City LIMIT 10")) {
printf("Select returned %d rows.\n", mysqli_num_rows($result));
/* free result set */
mysqli_free_result($result);
}
/* If we have to retrieve large amount of data we use MYSQLI_USE_RESULT */
if ($result = mysqli_query($link, "SELECT * FROM City", MYSQLI_USE_RESULT)) {
/* Note, that we can't execute any functions which interact with the
server until result set was closed. All calls will return an
'out of sync' error */
if (!mysqli_query($link, "SET @a:='this will not work'")) {
printf("Error: %s\n", mysqli_error($link));
}
mysqli_free_result($result);
}
mysqli_close($link);
?>
您将连接变量传递给mysqli函数对不起@Kinshuk我无法理解您错过了连接对象…下面是快速语法ref$res=mysqli\u query($con\u object,$query)
mysqli\u查询($conn,$select\u模板)
添加连接变量您已在某个变量中设置了mysqli\u连接。将该变量传递给第一个位置的函数。您将连接变量传递给mysqli函数对不起@Kinshuk我无法理解您错过了连接对象…下面是快速语法ref$res=mysqli\u query($con\u object,$query)
mysqli\u查询($conn,$select\u模板)
添加连接变量您已在某个变量中设置了mysqli\u连接。将该变量传递给第一个位置的函数。