我正在尝试在内容表中插入值.如果我在VALUES中没有PHP变量,它可以正常工作.当我将变量$type放在VALUES中时,这不起作用.我究竟做错了什么?
$type = 'testing';
mysql_query("INSERT INTO contents (type, reporter, description)
VALUES($type, 'john', 'whatever')");
Run Code Online (Sandbox Code Playgroud) 如果我使用这样的代码:
$update_result = mysqli_query( $link , $sql_update_login ) or die ('Unable to execute query. '. mysqli_error($link));
Run Code Online (Sandbox Code Playgroud)
它是否必须死亡或者您之后可以提出不同的查询?就像将错误日志写入另一个表的预定函数一样?如:
$update_result = mysqli_query( $link , $sql_update_login ) or function('$query, $error);
Run Code Online (Sandbox Code Playgroud)
'或'之后的其他选项有哪些?我没有在文档中找到它,任何线索都表示赞赏.