gpt4 book ai didi

php - 数据未通过php插入mysql数据库

转载 作者:行者123 更新时间:2023-11-29 11:21:08 25 4
gpt4 key购买 nike

数据正在正确显示,因此从表单传递数据没有问题,因此存在我无法找到的错误。

<?php

$connect = mysql_connect("localhost", "root", "") or die(mysql_error());
mysql_select_db("property", $connect);

/* if(isset($_POST['name'],$_POST['email'],$_POST['comments'])){ */
$rs = $_POST['rs'];
$cr = $_POST['cr'];
$locality = $_POST['locality'];
$br = $_POST['br'];
$bth = $_POST['bth'];
$fr = $_POST['fr'];
$flr = $_POST['flr'];
$tflr = $_POST['tflr'];
$bu = $_POST['bu'];
$park = $_POST['park'];
$af = $_POST['af'];
$comment = $_POST['comment'];

$query = "INSERT INTO property(id,sale/rent,com/res,locality,bedroom,bathroom,furnished_status,
floor,total floors,builtup/superbuiltup,includes_park,available_from,details)
VALUES('','$rs','$cr','$locality','$br','$bth','$fr','$flr','$tflr','$bu','$park','$af','$comment')";

mysql_query($query, $connect);

echo $rs;
echo "<br>";
echo $cr;
echo "<br>";
echo $locality;
echo "<br>";
echo $br;
echo "<br>";
echo $bth;
echo "<br>";
echo $fr;
echo "<br>";
echo $flr;
echo "<br>";
echo $tflr;
echo "<br>";
echo $bu;
echo "<br>";
echo $af;
echo "<br>";
echo $comment;
echo "<br>";


/*
header('location:submitted.html');
} */
?>

最佳答案

您的 sql 语法有错误..

$query="INSERT INTO property(id,sale/rent,
com/res,
locality,
bedroom,
bathroom,
furnished_status,
floor,
total floors,
builtup/superbuiltup,
includes_park,
available_from,
details) VALUES('', '$rs',
'$cr',
'$locality',
'$br',
'$bth',
'$fr',
'$flr',
'$tflr',
'$bu',
'$park',
'$af',
'$comment')";

试试这个..

$query="INSERT INTO property(id,sale/rent,
com/res,
locality,
bedroom,
bathroom,
furnished_status,
floor,
total floors,
builtup/superbuiltup,
includes_park,
available_from,
details) VALUES('',
'".$rs."',
'".$cr."',
'".$locality."',
'".$br."',
'".$bth."',
'".$fr."',
'".$flr."',
'".$tflr."',
'".$bu."',
'".$park."',
'".$af."',
'".$comment."')";

关于php - 数据未通过php插入mysql数据库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38913105/

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