Fixing of Application ID

Newbie Spellweaver
Joined
Mar 31, 2012
Messages
96
Reaction score
4
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>
 
Custom Title Activated
Loyal Member
Joined
Jun 27, 2009
Messages
1,571
Reaction score
170
Try this I fixed up the code just a tiny bit

PHP:
<?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
 
Upvote 0
Newbie Spellweaver
Joined
Mar 31, 2012
Messages
96
Reaction score
4

It didn't work, blank page.
 
Upvote 0
Hakuna Matata
Joined
Sep 5, 2012
Messages
804
Reaction score
137
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.
 
Upvote 0
Joined
Aug 10, 2011
Messages
7,399
Reaction score
3,310
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)
 
Upvote 0
Newbie Spellweaver
Joined
Mar 31, 2012
Messages
96
Reaction score
4

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.
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:
Upvote 0
Newbie Spellweaver
Joined
Mar 31, 2012
Messages
96
Reaction score
4
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 then it shows everything, not like which shows everything. i want all the details of the username clicked after clicking the username.
 
Last edited:
Upvote 0