Professional Web Applications Themes

P error not understood - PHP Development

Greetings learned PHP(eople); My HTML : -------------------------- <input type="input" class="input" name="usernamebox" value="Enter user name.."></input><br> <input type="radio" name="useroption" value="add">Add User</input><br> <input type="radio" name="useroption" value="edit">Edit User</input><br> <input type="radio" name="useroption" value="delete">Delete User</input><br> My PHP Code : ------------------------------------ <?php include('pbpc_client_connect_db'); //If usernamebox is empty------ if ($_REQUEST['usernamebox'] =="") { header('location: user_blank.php'); exit(); } //If default value is left in-------- if($_REQUEST['usernamebox'] =="Enter user name..") { header('location: user_blank.php'); exit(); } //If 'Add New User' is selected--------- if ( $_REQUEST['useroption'] == 'add') { //First, check that the username doesn`t exist already $query = "select count(*) from pbpc_client where username = '" . $_REQUEST['usernamebox'] . "';"; $result = mysql_query($query); ...

  1. #1

    Default P error not understood

    Greetings learned PHP(eople);

    My HTML :
    --------------------------
    <input type="input" class="input" name="usernamebox" value="Enter user
    name.."></input><br>
    <input type="radio" name="useroption" value="add">Add User</input><br>
    <input type="radio" name="useroption" value="edit">Edit User</input><br>
    <input type="radio" name="useroption" value="delete">Delete
    User</input><br>

    My PHP Code :
    ------------------------------------
    <?php
    include('pbpc_client_connect_db');
    //If usernamebox is empty------
    if ($_REQUEST['usernamebox'] =="")
    {
    header('location: user_blank.php');
    exit();
    }

    //If default value is left in--------
    if($_REQUEST['usernamebox'] =="Enter user name..")
    {
    header('location: user_blank.php');
    exit();
    }

    //If 'Add New User' is selected---------
    if ( $_REQUEST['useroption'] == 'add')
    {
    //First, check that the username doesn`t exist already
    $query = "select count(*) from pbpc_client where username = '" .
    $_REQUEST['usernamebox'] . "';";
    $result = mysql_query($query);
    if(!$result)
    {
    echo 'Cannot run query.';
    exit();
    }
    $count = mysql_result($result, 0, 0);
    if($count>0)
    {
    //User already exists in database
    header('location: user_exists.php');
    exit();
    }
    header("location:add_new_user.php?usernamebox=" .
    $_REQUEST['usernamebox']);
    exit();
    }
    // If "Edit User" is selected-------------
    if ( $_REQUEST['useroption'] == 'edit')
    {

    //First, check that this user account actually exisits in the database
    $query = "select count(*) from pbpc_client where username = '" .
    $_REQUEST['usernamebox'] . "';";
    $result = mysql_query($query);
    if(!$result)
    {
    echo 'Cannot run query.';
    exit();
    }

    $count = mysql_result($result, 0, 0);
    if($count==0)
    {
    //User does not exist in the database
    header('location: user_not_exists.php');
    exit();
    }

    }
    //If "Delete User" is selected----------
    if ( $_REQUEST['useroption'] == 'delete')
    {
    //First, check that the user already exists
    $query = "select count(*) from pbpc_client where username = '" .
    $_REQUEST['usernamebox'] . "';";
    $result = mysql_query($query);
    if(!$result)
    {
    echo 'Cannot run query.';
    exit();
    }

    $count = mysql_result($result, 0, 0);
    if($count==0)
    {
    //User does not exist in the database
    header('location: user_not_exists.php');
    exit();

    header('location:del_new_user.php');
    exit();
    }
    //header('location: content.php');
    ?>

    No matter which option I select I get the following output :
    ------
    P error: p error, unexpected $ in
    /var/www/html/Sessions/userman.php on line 83

    Line 83 is '?>'......

    Any ideas and help greatly appreciated....I been staring at this for an
    hour now and can`t see whats wrong.....

    Thanks


    --
    Chris Blake
    Office : (011) 782-0840
    Cell : 083 985 0379

    Injustice anywhere is a threat to justice everywhere.
    -- Martin Luther King, Jr.

    Chris Blake Guest

  2. #2

    Default Re: P error not understood

    > //If "Delete User" is selected----------
    > if ( $_REQUEST['useroption'] == 'delete')
    > {
    > //First, check that the user already exists
    > $query = "select count(*) from pbpc_client where username = '" .
    > $_REQUEST['usernamebox'] . "';";
    > $result = mysql_query($query);
    > if(!$result)
    > {
    > echo 'Cannot run query.';
    > exit();
    > }
    >
    > $count = mysql_result($result, 0, 0);
    > if($count==0)
    > {
    > //User does not exist in the database
    > header('location: user_not_exists.php');
    > exit();
    >
    > header('location:del_new_user.php');
    > exit();
    > }
    > //header('location: content.php');
    > ?>
    >
    > No matter which option I select I get the following output :
    > ------
    > P error: p error, unexpected $ in
    > /var/www/html/Sessions/userman.php on line 83
    >
    > Line 83 is '?>'......
    You missed a '}' at lines :


    if($count==0)
    {
    //User does not exist in the database
    header('location: user_not_exists.php');
    exit();

    Add a '}' after this, and your problem is fixed!


    --
    Ivo Fokkema
    PHP & MySQL programmer
    Leiden University Medical Centre
    Netherlands


    Ivo Fokkema Guest

  3. #3

    Default Re: [PHP] P error not understood

    From: "Chris Blake" <cblakepbpc.co.za>
    [snip]
    > //If "Delete User" is selected----------
    > if ( $_REQUEST['useroption'] == 'delete')
    > {
    [snip]
    > No matter which option I select I get the following output :
    > ------
    > P error: p error, unexpected $ in
    > /var/www/html/Sessions/userman.php on line 83
    >
    > Line 83 is '?>'......
    You're missing a closing brace for the above IF condition...

    ---John Holmes...
    Cpt John W. Holmes Guest

  4. #4

    Default Re: P error not understood

    Holy schmoley...something so small.....I must get off this green tea,
    all this good health stuff is causing havoc in my brain...

    Thanks Fokkema, and John....for pointing out an obvious error...

    Regards


    On Wed, 2003-08-06 at 14:48, Fokkema, I.F.A.C. (HKG) wrote:
    > > //If "Delete User" is selected----------
    > > if ( $_REQUEST['useroption'] == 'delete')
    > > {
    > > //First, check that the user already exists
    > > $query = "select count(*) from pbpc_client where username = '" .
    > > $_REQUEST['usernamebox'] . "';";
    > > $result = mysql_query($query);
    > > if(!$result)
    > > {
    > > echo 'Cannot run query.';
    > > exit();
    > > }
    > >
    > > $count = mysql_result($result, 0, 0);
    > > if($count==0)
    > > {
    > > //User does not exist in the database
    > > header('location: user_not_exists.php');
    > > exit();
    > >
    > > header('location:del_new_user.php');
    > > exit();
    > > }
    > > //header('location: content.php');
    > > ?>
    > >
    > > No matter which option I select I get the following output :
    > > ------
    > > P error: p error, unexpected $ in
    > > /var/www/html/Sessions/userman.php on line 83
    > >
    > > Line 83 is '?>'......
    > You missed a '}' at lines :
    >
    >
    > if($count==0)
    > {
    > //User does not exist in the database
    > header('location: user_not_exists.php');
    > exit();
    >
    > Add a '}' after this, and your problem is fixed!
    >
    >
    > --
    > Ivo Fokkema
    > PHP & MySQL programmer
    > Leiden University Medical Centre
    > Netherlands
    --
    Chris Blake
    Office : (011) 782-0840
    Cell : 083 985 0379

    "None of our men are "experts." We have most unfortunately found it
    necessary
    to get rid of a man as soon as he thinks himself an expert -- because no
    one
    ever considers himself expert if he really knows his job. A man who
    knows a
    job sees so much more to be done than he has done, that he is always
    pressing
    forward and never gives up an instant of thought to how good and how
    efficient
    he is. Thinking always ahead, thinking always of trying to do more,
    brings a
    state of mind in which nothing is impossible. The moment one gets into
    the
    "expert" state of mind a great number of things become impossible."
    -- From Henry Ford Sr., "My Life and Work," p. 86 (1922):

    Chris Blake Guest

Similar Threads

  1. Replies: 1
    Last Post: August 26th, 08:46 PM
  2. #25256 [Bgs->Opn]: P error: p error, unexpected $ in ... on line 642
    By a dot schat at streamedge dot com in forum PHP Development
    Replies: 0
    Last Post: August 26th, 08:26 PM
  3. #25256 [NEW]: P error: p error, unexpected $ in ... on line 642
    By a dot schat at streamedge dot com in forum PHP Development
    Replies: 0
    Last Post: August 26th, 07:20 PM
  4. [PHP] P error not understood
    By Ivo Fokkema in forum PHP Development
    Replies: 0
    Last Post: August 6th, 02:00 PM
  5. [PHP] P error not understood
    By Miles Thompson in forum PHP Development
    Replies: 0
    Last Post: August 6th, 01:32 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

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 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139