Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html><head><title>Creating student table </title> </head>
- <body>
- <?php
- $u = "";
- $p = "";
- if (isset($_POST['u']))
- {
- $u = $_POST['u'];
- }
- if (isset($_POST['p']))
- {
- $p = $_POST['p'];
- }
- if ($u == 'myuser' && $p == 'mypass')
- {
- require("connectcode.php");
- $tname = "student_table";
- $fields = "sid INT NOT NULL AUTO_INCREMENT PRIMARY KEY, sfname CHAR(15), slname CHAR(15), sgpa FLOAT(5,4), sdept CHAR(30)";
- $query = "DROP TABLE $tname";
- mysql_query($query);
- $query = "CREATE TABLE $tname ($fields)";
- if (mysql_query($query)) {
- print ("The table, $tname, was created successfully.<br>\n");
- }
- else {
- print ("The table, $tname, was not created. <br>\n");
- }
- mysql_close($link);
- //header("location: create_t_links.php");
- }
- else {
- //header("location: create_t_links.html");
- header("location: index.html");
- }
- ?>
- </body>
- </html>
Add Comment
Please, Sign In to add comment