Back to index

php5  5.3.10
table.inc
Go to the documentation of this file.
00001 <?PHP
00002 require_once 'connect.inc';
00003 
00004 // connect + select_db
00005 if (!$link = my_mysql_connect($host, $user, $passwd, $db, $port, $socket)) {
00006        printf("Cannot connect to the server using host=%s/%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
00007          $host, $myhost, $user, $db, $port, $socket);
00008        exit(1);
00009 }
00010 
00011 if (!mysql_query('DROP TABLE IF EXISTS test', $link)) {
00012        printf("Failed to drop old test table: [%d] %s\n", mysql_errno($link), mysql_error($link));
00013        exit(1);
00014 }
00015 
00016 if (!mysql_query('CREATE TABLE test(id INT, label CHAR(1), PRIMARY KEY(id)) ENGINE=' . $engine, $link)) {
00017        printf("Failed to create test table: [%d] %s\n", mysql_errno($link), mysql_error($link));
00018        exit(1);
00019 }
00020 
00021 if (!mysql_query("INSERT INTO test(id, label) VALUES (1, 'a'), (2, 'b'), (3, 'c'), (4, 'd'), (5, 'e'), (6, 'f')", $link)) {
00022        printf("[%d] %s\n",  mysql_errno($link), mysql_error($link));
00023 }
00024 ?>