A program that operates on a database _php tutorial

Source: Internet
Author: User
Db.func:

function GetRows ($Database, $Query) {
Mysql_connect ("ftp", "Root", "");
$db = mysql_select_db ($Database);
if (! $db) {
echo "Cannot connect to the database! ";
Exit
}

$rows = mysql_query ($Query);
if (! $rows) {
echo "SQL instruction error!";
Exit
}
return $rows;
}

function Connectdatabase ($Database) {
Mysql_connect ("ftp", "Root", "");
$db = mysql_select_db ($Database);
if (! $db) {
echo "Cannot connect to the database! ";
Exit
}
}
?>

cratetable.php:

function CreateTable () {
$link = mysql_connect ("ftp", "Root", "");
$db = mysql_select_db ("Pcadmin");
if (! $db) {
echo "Failed to connect to the database! ";
Exit
}
$rows = mysql_query ("SELECT * from Profile");
if (! $rows) {
$sql = "Create Table profile (ID integer auto_increment primary key,name char (255), produce char (255), Lianluo char (255), Tel Integer (+), Email char (255)) ";
mysql_query ($sql);
}

$rows = mysql_query ("SELECT * from aplication");
if (! $rows) {
$sql = "Create Table aplication (Name char (255) Primary Key,ip char (255), Ap char (255), Directory char (255))";
mysql_query ($sql);
}
Mysql_close ($link);
}
CreateTable ();
?>

Input.htm:




Input form

Input form





insert.php:




Successfully entered a piece of information to see


Include (".. /db.func ");

if (!empty ($Send)) {
Connectdatabase ("Pcadmin");
$sql = "INSERT into profile (Name,produce,lianluo,tel,email) VALUES ($Name, $Produce, $Lianluo, $Tel, $Email)";

mysql_query ($sql);
}
?>

This news a total of 2 pages, currently on the 1th page 1 2


show.php:

function Showonepage ($rows, $No) {
Mysql_data_seek ($rows, $No);

echo "
















"; echo " "; while ($field = Mysql_fetch_field ($rows)) {echo " "; } echo " "; $nums = mysql_num_rows ($rows); for ($I =1; $I <=10; $I + +) {if ($row = Mysql_fetch_row ($rows)) {for ($K =0; $K < count ($row); $K + +) {echo " "; } echo " "; } } echo "
" . $field->name. "
" . $row [$K]. "
";
}
?>



server list

server checklist

http://www.bkjia.com/PHPjc/532634.html www.bkjia.com true http:// www.bkjia.com/PHPjc/532634.html techarticle db.func:?" function GetRows ($Database, $Query) {mysql_connect ("ftp", "Root", ""); $db = mysql_select_db ($Database); if (! $db) {echo ' cannot connect to the database! "; Exit } $r ...

  • 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.