473,831 Members | 2,320 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

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

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


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


$sql="SELECT name,link FROM $tbl_name where contentid = '$id'";
$result=mysql_q uery($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=mys ql_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_do c.php?id=<? echo $id;?>">update</a></td>
<td align="center"> <a href="delete_do c.php?id=<? echo $id;?>">delete</a></td>
<td align="center"> <a href="insert_do c.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('displa y_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_q uery($sql);
$rows=mysql_fet ch_array($resul t);

?>

<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"><st rong>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 1379
Atli
5,058 Recognized Expert Expert
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 New Member
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
2583
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 click one to go the details page. You hit the browser button to go back and it shows the results/master page but shows "Page has expired" error. How can you prevent this? How can you show the results page whether you get
4
6177
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 values from a html form that consists of about 10 checkbox and a textbox where user have to key in a value to perform a search. From python tutors, I learned that I have to use the following method:
20
2937
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 p.Sub_Id = c.Sub_Id GROUP BY p.Sub_ID, p.Cat_ID, p.Sub_Name ORDER BY p.Sub_Name" sql = "select * from Subs inner join Cats on Cats.Cat_ID=Subs.Cat_ID ORDER BY Sub_Name"
0
1426
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 results on one page and for some queries there are hundreds of results that take a long time to uotput and wastes a lot of bandwidth. Heres a quick rundown on the structure of my site:-
1
2626
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. Included in the application program is a data “GRID” which I believe was created using Visual Basic, not standard Access. Its purpose is to display the results of a range of “from-to-dates” of registrations for different clients. The difficulty...
5
5694
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 As Database Dim rec As Recordset Private Sub Command1_Click() Set db = OpenDatabase("the patht of database") MsgBox "database is open" Set rec = db.OpenRecordset("SELECT DISTINCT asmenu_info.Vardas FROM asmenu_info;") While Not rec.EOF
1
1861
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: Dim db As Database Dim rec As Recordset Private Sub Command1_Click() Set db = OpenDatabase("the patht of database") MsgBox "database is open" Set rec = db.OpenRecordset("SELECT DISTINCT asmenu_info.Vardas FROM asmenu_info;") While Not...
1
1812
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 run the query in "SelectDefault's" OnOpen event, right? But having done that, I'm not sure how to incorporate the query-checking into an If...Then statement on the OK button's OnClick event. Here is the query's SQL: SELECT Count(*) AS Expr1...
1
2688
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 designed to show the expiring contracts. To do this I use a straight forward query in my form's ON LOAD code strwhere = " BETWEEN #" & Now() & "# AND #" & DateAdd("m", 6, Now()) & "#" Set MyQueryDef = MyDatabase.CreateQueryDef("qryMattersQuery",...
12
2219
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" name="totalFormInputs" value="lawrence@krubner.com" /></p>
0
10777
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10494
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10534
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10207
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9317
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6951
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5619
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5780
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4416
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.