Jump to content

Help with displaying single database row


jingato

Recommended Posts

Hi, I am reletively new to All this so please excuse me if I sound a little confused. I have a page that will display the contents of a database. The results are being displayed in a table with three colums, borrower's name, address, and status. I added a fourth colum to have a hyperlink that will go to another page and display that single row only. The user will be able to update the status from there. My question is, how do I get the lnk to change on each row? Here is a portion of the code I am using.

if ($myrow = mysql_fetch_array($result)) {

echo "<table border=1 cellpadding=2>\n";

echo "<tr><td><B>Borrower's Name</B></td><td><B>Address</B></td></td><td><B>Status</B></td><td><B>Update Status</B></td></tr>\n";
echo "<tr><td></td><td></td></td><td></td></tr>\n";

do {



printf("<tr><td>%s</td><td>%s</td><td>%s</td><td><a href=select.php?borrower=$name><b>Update</b></a></tr>\n", $myrow["Borrowers Name"], $myrow["address"], $myrow["status"]);

} while ($myrow = mysql_fetch_array($result));

echo "</table>\n";

} else {

echo "Sorry, no records were found!";



How do I get $name to equal the same as the Borrowers Name being displayed in each row?

Thanks for the help

John
Link to comment
Share on other sites

<?session_start();?>

if your useing sessions to let the user login.


link if using sessions
[code]
<? session_start();

echo"<a href='pic.php'>click here to see  your pic</a>";
echo"<a href='pic.php'>click here to see your messages</a>";

?>
[/code]



pic.php
[code]
<? session start();
database info

$query="select  * from database where session='session' and id='$id'";

$result=mysql_query($query);

while($row=mysql_fetch_assoc($result)) {


echo "<br> All your pics here $row["pic"]<br>";

echo "";ect.......

echo"";ect...........
}
?>
[/code]

messages.php
[code]
<? session start();
database info

$query="select  * from database where session='session' and id='$id'";

$result=mysql_query($query);

while($row=mysql_fetch_assoc($result)) {


echo "<br> all your mesages here $row["messages"]<br>";

echo "";ect.......

echo"";ect...........
}
?>
[/code]



Read up on $_sessions.

The above is an example ok.

If the user that logeed in had a session with the name session like the above example.

when the user goes to a page from a link the select statement will see were id=$id meaning that users id from sign up.

Then the user will see what evers on that page that relates to them only.

good luck.


Link to comment
Share on other sites

Thanks for the response. I am using sessions and I allready have a page describing what you are showing. What I am making now is a page for the administrator. The administrator has the ability to se all records, which I allready accomplished, but now I wanted there to be a link for each record that will bring him to a new page that will display that record only. Here is the temporary page I am working on [a href=\"http://www.njmortgagequotes.com/northfield/AdminStatus.php\" target=\"_blank\"]Page in Progress[/a] . It is filled with jibberish right now. The user name and password are both admin. (temporary)The final goal I am trying to accomplish is to allow the administrator the ability to change the status colum of any of the records. I figured it would be easiest for him to see all of the recrds, then click the upate link next to it which go to a new page which displays just that record and give him the ability to change iton that page. If there is a more logical way to do this please let me know

Thanks again for the help

John
Link to comment
Share on other sites

Are you asking when you click on a user name you get the
users information to be able to alter within admin mode.

Then alter that users information and update the database.


The first thing to do is get your long form from Appraisal Order Form then echo out all the data in that form
this will be the form you use for the admin to update the users information.

when you got that form done then you need to add the update query.

when thats done then were back to your question ok.

then add a link around the users name like this from the page i saw.

[code]

echo"<a href='the_new_update_page.php?members_name=$row['members_name']&id=$id '>$row['members_name']</a>";

[/code]

where $row["members_name"] is from line above needs to be on the page i saw when i log onto your site.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.