473,322 Members | 1,671 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Can't get all the results to show in my form

26
I have a beautiful, dynamic and very attractive front page:

[PHP]<?php
error_reporting(E_ALL);
ini_set('display_errors', '1');
include '../../db.inc';


$id = intval( mysql_real_escape_string( $_GET['id'] ));
//echo "id = $id";
// Connect to server and select database.


$sql="SELECT name,link FROM $tbl_name where contentid = '$id'";
$result=mysql_query($sql);

?>
<table width="180" border="0" cellspacing="1" cellpadding="0">
<tr>
<td>
<table width="170" border="0" cellspacing="0" cellpadding="1">
<tr>

</tr>

<tr>

</tr>
<?php
while($rows=mysql_fetch_array($result)){
?>
<tr>
<td><? echo $rows['name']; ?></td>
<td><? echo $rows['link']; ?></td>
</tr>
<?php
}
?>
</table>
</td>
</tr>
</table>
<td align="center"><a href="update_doc.php?id=<? echo $id;?>">update</a></td>
<td align="center"><a href="delete_doc.php?id=<? echo $id;?>">delete</a></td>
<td align="center"><a href="insert_doc.php?id=<? echo $id;?>">insert</a></td>
<?php
mysql_close();
?>[/PHP]

And my update_doc.php is also very beautiful, attractive.
[PHP]<?php
error_reporting(E_ALL);
ini_set('display_errors', '1');
include '../../db.inc';

$tbl_name="jos_documentation"; // Table name
// Connect to server and select database.
//mysql_connect("$host", "$username", "$password")or die("cannot connect");
//mysql_select_db("$db_name")or die("cannot select DB");

// get value of id that sent from address bar
$id=$_GET['id'];

// Retrieve data from database
$sql="SELECT name,link FROM $tbl_name WHERE contentid='$id'";
$result=mysql_query($sql);
$rows=mysql_fetch_array($result);

?>

<table width="400" border="0" cellspacing="1" cellpadding="0">
<tr>
<form name="form1" method="get" action="update_ac.php">
<td>
<table width="100%" border="0" cellspacing="1" cellpadding="0">
<tr>
<td>&nbsp;</td>
<td colspan="3"><strong>Update Main Issues</strong> </td>
</tr>
<tr>
<td align="center">&nbsp;</td>
</tr>
<tr>
<td align="center">&nbsp;</td>
<td align="center"><strong>Name</strong></td>
</tr>
<tr>
<td>&nbsp;</td>

<td align="center"><input name="name" type="text" value="<? echo"$rows[name]"; ?>" size="30" /></td>
<td align="center"><input name="name" type="text" value="<? echo"$rows[link]"; ?>" size="30" /></td>


</label></td>
</tr>
<tr>
<td>&nbsp;</td>
<td><input name="id" type="hidden" id="id" value="<? echo $rows['contentid']; ?>"></td>
<td align="center"><input type="submit" name="Submit" value="Submit"></td>
<td>&nbsp;</td>
</tr>
</table>
</td>
</form>
</tr>
</table>

<?

// close connection
mysql_close();

?>[/PHP]

Problem is that it will only give me the first set of data, name link.



And I'm guessing it should be a petty thing that I have either a) not done or b) done wrong.

Can anyone of you point me in the right direction?

when I do an:

[PHP]SELECT name,link from table where contentid='13'[/PHP] I get two lines of results, instead of only one.


Thank's in advance for all help!

Phopman
Sep 3 '07 #1
2 1357
Atli
5,058 Expert 4TB
Hi.

Excuse my late reply. Seems your thread managed to slip by unnoticed.

If you look at your first page. Notice how you use a while() loop to loop through each and every one of the rows returned by the database.

The second page does not. It simply reads a single row and displays it, ignoring the rest of the rows completely.

If you simply add the same loop to your second page, your problem will be fixed.
Sep 11 '07 #2
phopman
26
No problem. Solved it partly. Generated the code necessary in Dreamweaver, so now I have it up and running. Except that I can't make it print out every row there is... Maybe I will have to check the while inside the DW code again?

THanks for the help anyway.!
Sep 12 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: NotGiven | last post by:
Say you have three pages, a search page, a results/master, and a detail page. You choose parameters on your search page and submit the page. The results show in the reults/master page. You...
4
by: Shufen | last post by:
Hi, I'm a newbie that just started to learn python, html and etc. I have some questions to ask and hope that someone can help me on. I'm trying to code a python script (with HTML) to get...
20
by: Jeff Uchtman | last post by:
I'd like to combine (if possible these two statements drawing from a total of 3 tables. sql = "SELECT p.Sub_ID, p.Cat_ID, p.Sub_Name, COUNT(c.Sub_ID) as ct FROM Subs p LEFT JOIN Links c ON...
0
by: tom | last post by:
Hi all, I'm having a bit of trouble getting my site to output a certain number of results per page. Any help on this would be greatly appriciated. Without this function my code outputs all...
1
by: John Phelan-Cummings | last post by:
When I add the name of a new individual in a, bound form, it will not display that person’s name in a label control of a second unbound form. I have a scheduling program that I am working on. ...
5
by: Eglute | last post by:
Hello I want to show the results of database query in Visual basic. Do you know how to do this? I want to show the results in objects such as label or text box. Please help me. My code is: Dim db...
1
by: Eglute | last post by:
Hello I want to show the results of MS Access database query in Visual basic. Do you know how to do this? I want to show the results in objects such as label or text box. Please help me. My code is:...
1
lwwhite
by: lwwhite | last post by:
When a user clicks OK on form "SelectDefaults," I want to open form "Welcome" if the results of query "qry_todo_overdue" = 0 or form "OverdueToDo" if the results >= 1. First, I assume that I need to...
1
by: bgreenspan | last post by:
Hi Everyone, I'm back for some more expert help. Here's what I am doing and what I tried. My database has entries with Contract Names and Expiry Dates, among other fields. I have a form...
12
by: lawrence k | last post by:
I've a form that starts off like this: <form method="post" action="profile.php? id=5&formName=my_story_edit.htm" enctype="multipart/form-data"> <p>Email address:<br /> <input type="text"...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.