Fixing of Application ID

Results 1 to 8 of 8
  1. #1
    Member Janzeer is offline
    MemberRank
    Mar 2012 Join Date
    96Posts

    Fixing of Application ID

    Hey! Sorry but i am trying to work on something which acts like a view staff application, i made it to echo the username of submitted application username's and manage to create a hyperlink in the username so now i am having a trouble where i want it to go to like viewapplication?userid=Janzeer when clicked on my name which echo's the other details such as AppID experience and stuff.

    Here is the code i have done so far:
    [PHP]<!DOCTYPE html>
    <html>
    <head>
    </head>

    <body>
    Applied Applicants :
    <?php
    $ID = mysql_query("Select AppID from staffapps where UserName") or die(mysql_error());
    while($Applicant = mysql_fetch_assoc($SQL)) {
    echo '<a style="color: black;text-decoration: none;" href="viewapplication?id='.$ID['AppID'].'">'.$Applicant['UserName'].'</a><br />';
    }
    ?>

    </body>
    </html>


  2. #2
    Alpha Member Glee is offline
    MemberRank
    Jun 2009 Join Date
    Niagara Falls,Location
    2,225Posts

    Re: Fixing of Application ID

    Try this I fixed up the code just a tiny bit

    PHP Code:
    <?php
    $ID 
    mysql_query("SELECT AppID FROM staffapps WHERE UserName") or die(mysql_error());
    while(
    $Applicant mysql_fetch_assoc($ID)) {
    echo 
    '<a style="color: black;text-decoration: none;" href="viewapplication?id='.$ID['AppID'].'">'.$Applicant['UserName'].'</a><br />';
    }
    ?>
    Ps I added you on skype

  3. #3
    Member Janzeer is offline
    MemberRank
    Mar 2012 Join Date
    96Posts

    Re: Fixing of Application ID

    Quote Originally Posted by Glee View Post
    Try this I fixed up the code just a tiny bit

    PHP Code:
    <?php
    $ID 
    mysql_query("SELECT AppID FROM staffapps WHERE UserName") or die(mysql_error());
    while(
    $Applicant mysql_fetch_assoc($ID)) {
    echo 
    '<a rel="nofollow" style="color: black;text-decoration: none;" href="viewapplication?id='.$ID['AppID'].'">'.$Applicant['UserName'].'</a><br />';
    }
    ?>
    Ps I added you on skype
    It didn't work, blank page.

  4. #4
    Hakuna Matata Matata is offline
    MemberRank
    Sep 2012 Join Date
    DenmarkLocation
    807Posts

    Re: Fixing of Application ID

    Your query doesn't make sense.
    Code:
    Select AppID from staffapps where UserName
    Select AppID from staffapps where UserName ... UserName is what?
    You should try something like this:

    Code:
    SELECT `AppID` FROM `staffapps` WHERE `UserName` = "USERNAME";
    Also, please do not use mysql as it's deprecated. Switch to mysqli or PDO before it gets removed.

  5. #5
    Check http://arcturus.pw The General is offline
    DeveloperRank
    Aug 2011 Join Date
    7,608Posts

    Re: Fixing of Application ID

    Why using uppercases in database columns / tables? It is highly recommended not doing that and if you want to seperate words you should use an underscore '_'

    Code:
    <?php
    $query = mysql_query("SELECT AppID, UserName FROM staffapps ORDER BY AppID DESC") or die(mysql_error());
    while($row = mysql_fetch_assoc($query)) {
    echo '<a style="color: black;text-decoration: none;" href="viewapplication?id='.$row['AppID'].'">'.$row['UserName'].'</a><br />';
    }
    ?>
    This should return a list of links to the application. (Assumed your database structure is correct)

  6. #6
    Member Janzeer is offline
    MemberRank
    Mar 2012 Join Date
    96Posts

    Re: Fixing of Application ID

    Quote Originally Posted by Matata View Post
    Your query doesn't make sense.
    Code:
    Select AppID from staffapps where UserName
    Select AppID from staffapps where UserName ... UserName is what?
    You should try something like this:

    Code:
    SELECT `AppID` FROM `staffapps` WHERE `UserName` = "USERNAME";
    Also, please do not use mysql as it's deprecated. Switch to mysqli or PDO before it gets removed.
    Sorry, i was trying if a Where would fetch the other information but forgot to erase it off when it didnt work. Anyways, i am sorry but how do you switch to mysqli? New to mysql. :(
    Quote Originally Posted by The General View Post
    Why using uppercases in database columns / tables? It is highly recommended not doing that and if you want to seperate words you should use an underscore '_'

    Code:
    <?php
    $query = mysql_query("SELECT AppID, UserName FROM staffapps ORDER BY AppID DESC") or die(mysql_error());
    while($row = mysql_fetch_assoc($query)) {
    echo '<a rel="nofollow" style="color: black;text-decoration: none;" href="viewapplication?id='.$row['AppID'].'">'.$row['UserName'].'</a><br />';
    }
    ?>
    This should return a list of links to the application. (Assumed your database structure is correct)
    I'll rename the database with a underscore, yes the code works perfectly fine. However have you got any idea on how to fetch the other queries in the database to be echo-ed when clicked on the my Username such as RealName, Age, Timezone, Experience sort of? Thank you for your reply.
    Last edited by Janzeer; 13-02-15 at 04:08 AM.

  7. #7
    R.I.P Millercent FatalLulz is offline
    MemberRank
    Nov 2012 Join Date
    AustraliaLocation
    2,248Posts

    Re: Fixing of Application ID

    Change where it says - SELECT AppID, UserName FROM staffapps to - SELECT * FROM staffapps (or replace * with all your column names, example AppID, UserName etc etc)

  8. #8
    Member Janzeer is offline
    MemberRank
    Mar 2012 Join Date
    96Posts

    Re: Fixing of Application ID

    Quote Originally Posted by FatalLulz View Post
    Change where it says - SELECT AppID, UserName FROM staffapps to - SELECT * FROM staffapps (or replace * with all your column names, example AppID, UserName etc etc)
    Thank you for a reply, however i meant i would like to have after clicking my username it shows a link like http://hablit.net/viewapplication?id=Janzeer then it shows everything, not like http://hablit.net/viewapplication which shows everything. i want all the details of the username clicked after clicking the username.
    Last edited by Janzeer; 13-02-15 at 07:31 AM.



Advertisement