Jump to content


Photo

Help with displaying single database row


  • Please log in to reply
4 replies to this topic

#1 jingato

jingato
  • Members
  • PipPip
  • Member
  • 10 posts

Posted 13 May 2006 - 09:41 PM

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


#2 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 13 May 2006 - 10:49 PM

<?session_start();?>

if your useing sessions to let the user login.


link if using sessions
<? 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>";

?>



pic.php
<? 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...........
}
?>

messages.php
<? 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...........
}
?>



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.



Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#3 jingato

jingato
  • Members
  • PipPip
  • Member
  • 10 posts

Posted 14 May 2006 - 12:33 AM

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

#4 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 14 May 2006 - 03:39 AM

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.


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


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


Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#5 jingato

jingato
  • Members
  • PipPip
  • Member
  • 10 posts

Posted 15 May 2006 - 06:21 PM

Thanks for the help. Everythings working great!




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users