Server IP : 172.16.15.8 / Your IP : 18.222.164.176 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/tasantos/public_html/ |
[ Home ] | [ C0mmand ] | [ Upload File ] |
---|
<!-- File Name: hw9createdb.php Author: Tara Santos Due Date: April 20, 2009 Class: CS480 Instructor: Dr. Wang Goal: Database with PHP. --> <TITLE>Create Database</TITLE> <BODY><CENTER> <FONT size=4 color=2B3856> <?php $server = 'localhost'; $user = 'tasantos'; $pass = 'cs480'; $mydb = 'tasantos'; $table_name = 'Survey'; $connect = mysql_connect($server, $user, $pass); if( !$connect ) { die ("Cannot connect to $server using $user"); } else { $SQLcmd = "CREATE TABLE $table_name ( SurveyID INT unsigned auto_increment primary key, gender varchar(10), grade varchar(10), course varchar(10), question1 int, question2 int, question3 int, question4 int, question5 int)"; MYSQL_select_db($mydb); if( mysql_query ( $SQLcmd, $connect) ) { print 'Create table success!'; print "<br>SQLcmd = $SQLcmd"; print "<img src='http://tmonews.com/blog/wp-content/uploads/2008/09/happy-face-istock-456.jpg'>"; } else { die("<img src='http://www.blog.0tutor.com/archive/227/glossy-error-icon.jpg'> <br>Table Creation Failed<br><A HREF='hw9.html'>Back to Homepage</A>"); } mysql_close($connect); } ?> <br><br> <A HREF="hw9.html">Back to Homepage</A> </CENTER> </BODY>