gpt4 book ai didi

PHP 查询插入 '0' 值到 mysql 表

转载 作者:太空宇宙 更新时间:2023-11-03 10:55:44 24 4
gpt4 key购买 nike

enter image description here我的 php 文件插入表行 0 值,我找不到解决方案。

<?php
$selected_button = $_POST['a'];

$conn = mysql_connect('localhost','root','');
if(!$conn )
{
die('Could not connect: ' . mysql_error());
}
$sql = "INSERT INTO answers (member_id, question_id, answer) VALUES (1, 2,'$selected_button')";

mysql_select_db('ipad',$conn);
$result = mysql_query($sql, $conn);
if(!$result)
{
return false;
}
return true;


mysql_close($conn);
?>

插入后我收到,member_id = 0; question_id = 0 ;答案 = NULL

最佳答案

如果你用的是mysql,应该是:

$result = mysql_query($sql, $conn);

但尝试使用 mysqli,因为 mysql 已被弃用。

关于PHP 查询插入 '0' 值到 mysql 表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20969278/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com