警告:mysqli_query():中的空查询

时间:2014-08-13 13:04:09

标签: php mysql

我正在尝试将数据放入MySQL表中,但我收到以下错误消息之一:

    Warning: mysqli_query(): Empty query in /websites/123reg/LinuxPackage22/ng/it/_o/ngit.org.uk/public_html/applicationform.php on line 70

这就是我的代码的样子:

    $myconnection = mysqli_connect('cust-mysql-123-20','register','London2014');
    mysqli_select_db($myconnection,$register );
    $query_Recordset1 = "SELECT * FROM `application`";
    $Recordset1 = mysqli_query($myconnection, $register) or die(mysql_error());
    $row_Recordset1 = mysql_fetch_assoc($Recordset1);
    $totalRows_Recordset1 = mysql_num_rows($Recordset1);

这是第70行:

    $Recordset1 = mysqli_query($myconnection, $register) or die(mysql_error());

请帮助。

1 个答案:

答案 0 :(得分:2)

您的查询包含在名为$query_Recordset1而非$register的变量中。你还混合了mysqli和mysql函数:

$myconnection = mysqli_connect('xxxxxxxx','xxxxxx','xxxxxx');
mysqli_select_db($myconnection,$register );
$query_Recordset1 = "SELECT * FROM `application`";
$Recordset1 = mysqli_query($myconnection, $query_Recordset1 ) or die(mysqli_error($myconnection));
$row_Recordset1 = mysqli_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysqli_num_rows($Recordset1);

仅供参考,如果这是您的真实登录名和密码,则需要更改现在

相关问题