Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 9 of 9
  1. #1
    New Coder
    Join Date
    Mar 2003
    Posts
    63
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Parse Error on T_Variable.

    There is a problem on line twelve but i cannot find out what is wrong with it
    PHP Code:
    <html>

    <head>
    <title>Edit Members</title>

    </head>

    <body>

    <?
    if(!isset($a)
    mysql_connect(localhost,clanxssx,mysql);
    @
    mysql_select_db($members) or die( "Unable to select database");

    }
    $query="SELECT username, ranking, name FROM members ORDER BY joined DESC";
    $result=@mysql_query($query);
    if(!
    $result){
    echo(
    'Error selecting member:'.$mysql_error());
    exit();
    }
    if(
    mysql_num_rows($result)>0){
    while(
    $row=mysql_fetch_object($result))
    {
    ?>
    <b><? echo $row->hadling?></b><i><? echo "formatDate(row->timestamp"?></i>
    <br>
    <a href="edit.php?a=edit&id=<? echo "$row->id"?>">Delete</a>
    <?
    }else{
    ?>
    <b> No Members found in Database</b>
    <?
    }
    mysql_close($link);
    }elseif(
    $a=='edit'){
    if(!isset(
    $update)){
    $link=@mysql_connect(localhostclanxssxmysql);
    if (!
    $link){
    echo 
    "Error connecting to the database:'.$mysql_error()";
    exit();
    }
    $query="SELECT username, ranking, name FROM members WHERE id='$id'";
    $result=@mysql_query($query);
    if(!
    $result){
    echo 
    " Error selecting member: '.$mysql_error());
    exit();
    }
    mysql_fetch object($result);
    ?>
    <form name="
    edit" method="post" action="edit.php?a=edit&id=<? echo '$id' ?>&update=1"> <table width="395" border="0" align="center">
        <tr>
          <td width="389" bgcolor="#333333"><div align="center" class="style1">Add New Member </div></td>
        </tr>
        <tr>
          <td height="220" bgcolor="#666666"><table width="410" border="0">
              <tr>
                <td width="127"><span class="style1">Username</span></td>
                <td width="273"><span class="style1">
                  <input name="username" type="text" id="username" value="<? echo($row->username?>">
                </span></td>
              </tr>
              <tr>
                <td><span class="style1">Password</span></td>
                <td><span class="style1">
                  <input name="password" type="password" id="password" value="<? echo($row->password?>">
                </span></td>
              </tr>
              <tr>
                <td><span class="style1">Ranking</span></td>
                <td><span class="style1">Admin
                  <input name="ranking" type="radio" value="<? echo($row->ranking?>" >
    Moderator
    <input name="ranking" type="radio" value="<? echo($row->ranking?>">
    Senior Member
    <input name="ranking" type="radio" value="<? echo($row->ranking?>">
    </span></td>
              </tr>
              <tr>
                <td><span class="style1">Email</span></td>
                <td><span class="style1">
                  <input name="email" type="text" id="email" value="<? echo($row->email?>">
                </span></td>
              </tr>
              <tr>
                <td height="17"><p class="style1">AIM</p></td>
                <td><span class="style1">
                  <input name="aim" type="text" id="aim" value="<? echo($row->aim?>">
                </span></td>
              </tr>
              <tr>
                <td><span class="style1">Name</span></td>
                <td><input name="name" type="text" id="name" value="<? echo($row->name?>"></td>
              </tr>
              <tr>
                <td height="43"><span class="style1">Specialties</span></td>
                <td><span class="style1">
     Xanga

      <input name="specs" type="checkbox" id="specs" value="<? echo($row->specs?>">
      Websites
      <input name="specs" type="checkbox" id="specs" value="<? echo($row->specs?>">
    Graphics
    <input name="specs" type="checkbox" id="specs" value="<? echo($row->specs?>">
    Flash
    <input name="specs" type="checkbox" id="specs" value="<? echo($row->specs?>">
    <input name="specs" type="text" id="specs" value="<? echo($row->specs?>" ONFOCUS="clearDefaultandCSS">
    </span></td>
              </tr>
          </table>
          <input name="hiddenfield" type="hidden" value="update">
          <input type="submit" name="add" value="Update"></td>
        </tr>
      </table>
      </form>
    <?
    }else{
    $query="UPDATE members SET username='$username', password='$password', ranking='$ranking', name='$name', email='$email', aim='$aim', specs='$specs' WHERE id ='$id'";
    $result=@mysql_query($query);
    if(!
    $result){
    echo(
    'Error updating member:'.$mysql_error());
    exit();
    }else{
    mysql_close($link);
    echo 
    "Update Successful";
    }
    }elseif(
    $a=='delete'){
    $link =@mysql_connect(localhostclanxssxmysql);
    if(!
    $link){
    echo(
    'Error Connecting to the database:'.$mysql_error());
    exit();
    }
    $query="DELETE FROM members WHERE id='$id'";
    $result=@mysql_query($query);
    if(!
    $result){
    echo(
    'Error deleting member:'.$mysql_error());
    exit();
    }
    mysql_close($link);
    echo(
    'Member Deleted.');
    }
    ?>

  • #2
    Senior Coder Nightfire's Avatar
    Join Date
    Jun 2002
    Posts
    4,265
    Thanks
    6
    Thanked 48 Times in 48 Posts
    if(!isset($a)){

  • #3
    New Coder
    Join Date
    Mar 2003
    Posts
    63
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Parse Error on line 11. Unexpected {

  • #4
    New Coder
    Join Date
    Mar 2003
    Posts
    63
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Never mind i got it.. Now error on line 36 Else If

  • #5
    Senior Coder Nightfire's Avatar
    Join Date
    Jun 2002
    Posts
    4,265
    Thanks
    6
    Thanked 48 Times in 48 Posts
    Indenting your php would be alot easier for you, it's hard to follow what belongs to what. What error is it?

    You also got an error here

    echo " Error selecting member: '.$mysql_error());

    Delete the last ) and change your ' to "

  • #6
    New Coder
    Join Date
    Mar 2003
    Posts
    63
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Parse error: parse error, unexpected T_STRING, expecting ',' or ';' in C:\Program Files\Abyss Web Server\htdocs\uncoordinated\scripts\logins\edit.php on line 52

  • #7
    Senior Coder Nightfire's Avatar
    Join Date
    Jun 2002
    Posts
    4,265
    Thanks
    6
    Thanked 48 Times in 48 Posts
    Dunno which line that is, maybe this one?

    mysql_fetch_object($result);

    Try reading through your code again and read the errors, they do tell you what's wrong

  • #8
    New Coder
    Join Date
    Mar 2003
    Posts
    63
    Thanks
    0
    Thanked 0 Times in 0 Posts
    i still get the same error
    NightFire.. Do you have AIM or MSN.. Maybe i can talk to you through there
    Last edited by WeBFreaKZ; 01-03-2004 at 08:03 PM.

  • #9
    Senior Coder Nightfire's Avatar
    Join Date
    Jun 2002
    Posts
    4,265
    Thanks
    6
    Thanked 48 Times in 48 Posts
    I only have email. I've attempted to clean your code up, but your checkboxes are all gonna have the same values, incase you didn't know

    PHP Code:
    <html>
    <head>
    <title>Edit Members</title>
    </head>
    <body>
    <?php
        
    // Saw no point in having the check here, if a connection is open anyway later in the script
        
    $link mysql_connect("localhost","clanxssx","mysql");
        @
    mysql_select_db($members,$link) or die( "Unable to select database");

    if(!isset(
    $a)){

        
    $query="SELECT username, ranking, name FROM members ORDER BY joined DESC";
        
    $result=@mysql_query($query);

        if(!
    $result){
            echo(
    'Error selecting member:'.$mysql_error());
            exit();
        }

        if(
    mysql_num_rows($result)>0){
            while(
    $row=mysql_fetch_object($result)){
    ?>

                <b><?php echo $row->hadling?></b><i><?php echo formatDate(row->timestamp); ?></i><br>
                <a href="edit.php?a=edit&id=<? echo "$row->id"?>">Delete</a>

    <?php
            
    }

        }else{

    ?>

            <b> No Members found in Database</b>

    <?php

        
    }

        
    mysql_close($link);
    }

    elseif(
    $a=='edit'){
     
        if(!isset(
    $update)){
    /*
    $link=@mysql_connect(localhost, clanxssx, mysql);

    if (!$link){

    echo "Error connecting to the database:'.$mysql_error()";

    exit();

    }

    Not needed, connection already at the start of script.
    */


            
    $query="SELECT username, ranking, name FROM members WHERE id='$id'";
            
    $result=@mysql_query($query);

            if(!
    $result){
                echo 
    " Error selecting member: ".$mysql_error();
                exit();

            }
        
            
    mysql_fetch_object($result);

    ?>

    <form name="edit" method="post" action="edit.php?a=edit&id=<?php echo $id ?>&update=1"> 
        <table width="395" border="0" align="center">
            <tr>
                <td width="389" bgcolor="#333333">
                    <div align="center" class="style1">Add New Member </div>
                </td>
            </tr>
            <tr>
                <td height="220" bgcolor="#666666">
                    <table width="410" border="0">
                        <tr>
                            <td width="127"><span class="style1">Username</span></td>
                            <td width="273"><span class="style1"><input name="username" type="text" id="username" value="<?php echo $row->username?>"></span></td>
                        </tr>
                        <tr>
                            <td><span class="style1">Password</span></td>
                            <td><span class="style1"><input name="password" type="password" id="password" value="<?php echo $row->password?>"></span></td>
                        </tr>
                        <tr>
                            <td><span class="style1">Ranking</span></td>
                            <td><span class="style1">Admin  <input name="ranking" type="radio" value="<?php echo $row->ranking?>" >
                                Moderator   <input name="ranking" type="radio" value="<?php echo $row->ranking?>">
                                Senior Member       <input name="ranking" type="radio" value="<?php echo $row->ranking?>">
                                </span>
                            </td>
                        </tr>
                        <tr>
                            <td><span class="style1">Email</span></td>
                            <td><span class="style1"><input name="email" type="text" id="email" value="<?php echo $row->email?>"></span></td>
                        </tr>
                        <tr>
                            <td height="17"><p class="style1">AIM</p></td>
                            <td><span class="style1"><input name="aim" type="text" id="aim" value="<?php echo $row->aim?>"></span></td>
                        </tr>
                        <tr>
                            <td><span class="style1">Name</span></td>
                            <td><input name="name" type="text" id="name" value="<?php echo $row->name?>"></td>
                        </tr>
                        <tr>
                            <td height="43"><span class="style1">Specialties</span></td>
                            <td><span class="style1">Xanga  <input name="specs" type="checkbox" id="specs" value="<?php echo $row->specs?>">
                                Websites    <input name="specs" type="checkbox" id="specs" value="<?php echo $row->specs?>">
                                Graphics    <input name="specs" type="checkbox" id="specs" value="<?php echo $row->specs?>">
                                Flash       <input name="specs" type="checkbox" id="specs" value="<?php echo $row->specs?>">
                                <input name="specs" type="text" id="specs" value="<?php echo $row->specs?>" ONFOCUS="clearDefaultandCSS">
                                </span>
                            </td>
                        </tr>
                    </table>
                    <input name="hiddenfield" type="hidden" value="update">
                    <input type="submit" name="add" value="Update">
                </td>
            </tr>
        </table>
    </form>

    <?php

        
    }else{

            
    $query="UPDATE members SET username='$username', password='$password', ranking='$ranking', name='$name', email='$email', aim='$aim', specs='$specs' WHERE id ='$id'";
            
    $result=@mysql_query($query);

            if(!
    $result){
                echo 
    'Error updating member:'.$mysql_error();
                exit();

            }else{

                
    mysql_close($link);

                echo 
    "Update Successful";

            }
        }

    }elseif(
    $a=='delete'){
    /* Not needed
    $link =@mysql_connect(localhost, clanxssx, mysql);

    if(!$link){

    echo('Error Connecting to the database:'.$mysql_error());

    exit();

    }
    */
        
    $query="DELETE FROM members WHERE id='$id'";
        
    $result=@mysql_query($query);

        if(!
    $result){

            echo 
    'Error deleting member:'.$mysql_error();
            exit();

        }

        
    mysql_close($link);

        echo 
    'Member Deleted.';
    }

    ?>


  •  

    Posting Permissions

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