PHP links MySQL related issues. Novice

Source: Internet
Author: User
PHP link mysql problem. Novice Help


<title></title>



if (@$_post["submit"]) {
$id = $_post["id"];
$name = $_post["name"];
$age = $_post["Age"];
$tel = $_post["Tel"];
$address = $_post["Address"];



$conn = @mysql_connect ("localhost", "root", "root") or Die ("The database connection timed out, please try again later!");
mysql_select_db ("Test", $conn);
mysql_query ("Set names ' UTF8 '");

$sql = "SELECT * from ' Student '";
$sql = "INSERT into ' student ' (' id ', ' name ', ' Age ', ' tel ', ' address ') VALUES (' $id ', ' $name ', ' $age ', ' $tel ', ' $address ')";
mysql_query ($sql);
}
?>
















This is the data table that I built, enter the page to add data to generate and refresh the data table content is empty. What's the problem?


------Solution--------------------
Encoding problem inserted text encoding inconsistent with database encoding
------Solution--------------------
mysql_query ($sql) or Die (Mysql_error ()) See what the error is?
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.