Final Project Page 4




Projects

2 | 3 | 4 | 7 | 10 | 12 | 13 | 17 | 18 | 19 | 20 | Final



Registration Form Tutorial
Modified Add member Script


The modified script should be as follows.  Copy your script and paste it into the register.php script at after " if (!$problem) { // If there weren't any problems..." (line 53).  Save register.php. Close add_entry.php.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16

17
18
19
20
21
22
23
24
25

26
27
28
29
30
// modified Script 12.5 - add_member.php
            // This script adds a member's data to the database.
            // Connect and select.
             if ($dbc = @mysql_connect ('localhost', 'username', 'password')) {
               
                if (!@mysql_select_db ('mymembers')) {
                    die ('<p>Could not select the database because: <b>' . mysql_error() .'</b></p>');
                }
   
            }  else {
                die ('<p>Could not connect to MySQL because: <b>' . mysql_error() .'</b></p>');
            }
   

            // Define the query.
            $query = "INSERT INTO member_list (member_id, username, first_name,
                   last_name, email_addy, password, date_reg)
                  VALUE (0, '{$_POST['username']}','{$_POST['first_name']}','{$_POST['last_name']}',
                   '{$_POST['email_addy']}','{$_POST['password']}', NOW())";

   
            // Execute the query.
            if (@mysql_query ($query)) {
                print '<p>The member's data has been added.</p>';
            } else {
                print "<p>Could not add the member's data because: <b>" . mysql_error() .
                       "</b>. The query was $query.</p>";
       
            }
   
            mysql_close();
           
            // End modified Script 12.5 - add_member.php



Tutorial
<---  1  2  3  4  5  6  7  8  9  10  11  12  13  14  15  16  --->


Home Resume Page Hobbies Page InfoSec Page Projects Page Advanced Web Communications Page
Top of Page
 
©
Beth Zuber, 2005