Hi,
  I am running into a problem that I can't figure out the solution to.  So
I'm hoping that someone can give me some pointers here.  I have two files
(see below):  verify.php and edit.php
  The job of verify.php is basically to verify that a user is in the
database before allowing him/her to edit the information.  The information
retrieved is saved to arrary varaiable $row.  I do a session_register() to
$row and that information should be passed to subsequent pages that has
session_start(), right?  However, when I tried to print out the information
again in edit.php, it doesn't seem to register it in.  At first I thought it
was the array problem, so I put the array variable $dummy to test it out and
that can be reigstered and retrieved correctly.  What am I doing wrong???
Also, how do I redirect to a page automatically once the user is verfied
(right now I have to ask the user to click on a link to redirect).

Thanks in advance,
Peter

/******* verify.php ********/
<?php
   session_start();

    include("config.php");
    mysql_connect($host_name, $user_name, $passwd)
                  or die("Unable to connect to $hostname.");
    // select database on MySQL server
    mysql_select_db($db_name) or die("Unable to select databse.");

    // formulate the query
    $sql_statement = "SELECT * FROM $table_name WHERE
                   user_id  = '$user_id' AND
          password = '$password'";

    $result = mysql_query($sql_statement) or die("Unable to execute
query.");

    $num_of_rows = mysql_num_rows($result);
    /* XXX: test array variable...take out later */
    $dummy = array("one", "two", "three");
    session_register(dummy);

    if (!$num_of_rows) {
        echo "<h3>User ID and password missmatch, try again!</h3>";
    } else {
        while ($row = mysql_fetch_array($result)) {
           session_register(row);  // register information retrieved from
MySQL
        }
        printf("Successfully Logged In! <a href=\"edit.php\">Click
Here</a>");
        echo "<br>";
    }
?>


/************* edit.php *****************/
<?php
    session_start();
    foreach ($dummy as $val) {
        echo $val . "<br>";
    }

    foreach ($row as $data) {
        echo $data . "<br>";
    }
?>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to