Thread: Phase Error

    #1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2000
    Posts
    0
    Rep Power
    0
    Hiya I've been scrating my head over this for nearly 1/2 a day trying to figure out why i have yet another phase error if some one could look and let me know i will be very greatful

    Code below

    Peter
    <html>
    <head>
    <title>Erentals</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    </head>

    <body bgcolor="#FFFFFF">
    <?
    $db = mysql_connect("172.16.201.6", "root");

    mysql_select_db("erentals", $db);

    if ($submit) {

    // here if no ID then addin else we're editing

    if ($id){
    $sql = "update users set name='$name',email='$email',username='$username',userpass='$userpass',company='$company',address='$a ddress',state='$state',post='post'";
    } else {
    $sql = "insert into users (name,email,username,userpass,company,address,state,post) values ('$name','$email','$username','$userpass','$company','$address','$state','$post')";
    }

    // run sql against the db
    $result = mysql_query($sql);
    echo "Record updated/edited<p>";
    } elseif ($delete) {

    // delete a record
    $sql = "delete from users where id=$id";
    $result = mysql_query($sql);
    echo "$sql Record deleted! <p>";
    } else {
    // this part happens if we don't press submit

    if (!$id) {
    // print the list is there is not editing
    $result = mysql_query("select * from users",$db);
    while ($myrow = mysql_fetch_array($result)) {
    printf("<a href="%s?id=%s">%s %s</a> n","$php_self",$myrow["member_id"],$myrow["name"],$myrow["email"],$myrow["username"],$myrow["userpass"],$myrow["company"],$myrow["address"],$myrow["state"],$myrow["post"]");
    printf("<a href="%s?id=%s&delete=yes">(DELETE)</a><br>","$php_self",$myrow["member_id"],$myrow["name"],$myrow["email"],$myrow["username"],$myrow["userpass"],$myrow["company"] ,$myrow["address"],$myrow["state"],$myrow["post"]");
    }
    }

    ?>

    <a href="<? echo $PHP_SELF ?>">Add A Record</a>
    <p>
    <form method="post" action="<? echo $php_self ?>>
    <?

    if ($id) {
    //editing so select a record
    $sql = "select * from users where id=$id";
    $result = mysql_query($sql);
    $myrow = mysql_fetch_array($result);
    $id = $myrow["member_id"];
    $name = $myrow["name"];
    $email = $myrow["email"];
    $username = $myrow["username"];
    $userpass = $myrow["userpass"];
    $company = $myrow["company"];
    $address = $myrow["address"];
    $state = $myrow["state"];
    $post = $myrow["post"];
    // print id for editing
    ?>
    <input type="hidden" name="member_id" value="<? echo "member_id" ?>">
    <?
    }

    ?>
    <table width="750" border="0">
    <tr>
    <td width="98">Name:</td>
    <td width="642">
    <input type="text" name="name" value="<? echo $name ?>">
    </td>
    </tr>
    <tr>
    <td width="98">Email:</td>
    <td width="642">
    <input type="text" name="email" value="<? echo $email ?>">
    </td>
    </tr>
    <tr>
    <td width="98">User Name:</td>
    <td width="642">
    <input type="text" name="username" value="<? echo $username ?>">
    </td>
    </tr>
    <tr>
    <td width="98">User Password</td>
    <td width="642">
    <input type="text" name="userpass" value="<? echo $userpass ?>">
    </td>
    </tr>
    <tr>
    <td width="98">Company</td>
    <td width="642">
    <input type="text" name="company" value="<? echo $company ?>">
    </td>
    </tr>
    <tr>
    <td width="98">Address</td>
    <td width="642">
    <input type="text" name="address" value="<? echo $address ?>">
    </td>
    </tr>
    <tr>
    <td width="98">State</td>
    <td width="642">
    <input type="text" name="state" value="<? echo $state ?>">
    </td>
    </tr>
    <tr>
    <td width="98">Post</td>
    <td width="642">
    <input type="text" name="post" value="<? echo $post ?>"size="4" maxlength="4">
    </td>
    </tr>
    </table>
    <input type="submit" name="Submit" value="Submit">
    <input type="reset" name="reset" value="Reset">
    <br>
    </form>
    <?

    }

    ?>
    </body>
    </html>
  2. #2
  3. Banned (not really)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Dec 1999
    Location
    Brussels, Belgium
    Posts
    14,642
    Rep Power
    4492
    What's a phase error? is that like a parse error? does it give you a line number?

    ---John Holmes...
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2000
    Posts
    0
    Rep Power
    0
    sorry it is parse error and on line 40

IMN logo majestic logo threadwatch logo seochat tools logo