数据库连接

<?php
   
$host="localhost"; // Host name
    $db_user ="root"; // Mysql username
    $db_password="root"; // Mysql password
    $db_name= "table"; // Database name

    // Connect to server and select databse.

    mysql_connect("$host", "$db_user", "$db_password")or die("cannot connect");
   
mysql_select_db("$db_name")or die("Disconnect Database");
   
mysql_query("SET NAMES 'utf8'");
   
mysql_query("INSERT INTO table (name,sex)VALUES ('".$_GET['name']."','".$_GET['sex']."'')");
?>

相关文章
相关标签/搜索