Regarding the problem of adding data to mysql using php
董先生
董先生 2018-06-20 13:42:26
0
6
1018

include("config.php");

$From=$_POST['Kname'];

$User=$_POST ['Qtime'];

$Skind=$_POST['Ytime'];

$Belong=$_POST['Xname'];


if($From!=""){

$sql="INSERT INTO server(id,From,User,Skind,Belong ) VALUES ('','$From','$User','$Skind','$Belong')";

if(mysql_query($sql)){

echo"";

}

else{

echo "Upload failed!";

}

}else

{

echo "The data is empty";

}

?>

The above cannot be solved by adding data to the database

董先生
董先生

reply all (1)
无忌哥哥

First check to see if the form value has been passed. If so, print the SQL statement to see if there are any syntax errors.

  • reply Worthy
    董先生 author 2018-06-20 14:12:47
  • reply INSERT INTO server(From,User,Skind,Belong) VALUES (i','6','7','4') upload failed!
    董先生 author 2018-06-20 14:15:08
  • reply The data comes over but cannot be uploaded.
    董先生 author 2018-06-20 14:15:29
  • reply Are the database fields correct?
    无忌哥哥 author 2018-06-20 15:36:35
  • reply Wrap your variable fields in braces, for example: $sql = "insert into mes_info values ('','{$title}','{$content}','{$addtime}')"; Try this There may be a problem that complex variables are not recognized. Is your database connection statement actually in config.php?
    寻常人家道不常 author 2018-06-20 18:10:17
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!