MYSQL PHP警告:mysql_query()期望参数1为字符串 [英] MYSQL PHP Warning: mysql_query() expects parameter 1 to be string

查看:41
本文介绍了MYSQL PHP警告:mysql_query()期望参数1为字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在尝试将查询发送到MYSQL时,PHP出现了一个非常奇怪的问题. 这是我的代码

I am having a very weird problem with PHP while trying to send a query to MYSQL. Here is my code

$newlogforuser="CREATE TABLE ".$username."-log (date CHAR(30),time CHAR(30),ipaddress CHAR(30))";

// Execute query
if (mysql_query($conl,$newlogforuser))
{
  echo "Response from server: Log created successfully";
}
else
{
  echo "Response from server: Error creating log: " . mysql_error();
}

错误:警告:mysql_query()期望参数1为字符串

The Error: Warning: mysql_query() expects parameter 1 to be string

我知道我已成功连接到我的MYSQL数据库,所以这不是问题.我知道在StackOverflow上有很多关于同一问题的帖子,但是其中一篇解决了我的问题.请帮忙!

I know that I am successfully connected to my MYSQL database, so that is not an issue. I know that there are many posts about the same issue on StackOverflow, but one of them fix my problem. Please help!

推荐答案

mysql_query期望第一个参数为字符串.资源必须是第二个参数

mysql_query expects the first parameter to be string. The resource has to be the second parameter

这篇关于MYSQL PHP警告:mysql_query()期望参数1为字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆