Displaying Mysql Data One Row at a Time

General discussions related to php

Moderators: egami, macek, gesf

Post Reply
New php-forum User
New php-forum User
Posts: 12
Joined: Thu Feb 16, 2012 1:03 pm

Tue Aug 28, 2012 9:51 am

Looking for some help! :)

I have a table where a user can input up to 20 employee ID #s and once they hit the submit button, it will display all 20 employee's information (first name, last name, dept, etc.) on the same page. This is what I wanted but after looking at my table, I want to take it one step further.

I am wondering if I can create a separate submit button for each row so that if they input an incorrect ID #, they can re-search just that ONE row and won't erase the entire table. Anyway ideas????

Here is a bit of my code and I have attached an image my table:

Code: Select all

$data1 = mysql_query("SELECT * FROM table_name WHERE id LIKE '$search1'") or die(mysql_error());
echo "<tr height='40'>";
echo "<td class='int_numbers'>1</td>";
echo "<td><input name='id1' type='text' size='5' maxlength='5' /></td>";
while($info1 = mysql_fetch_array( $data1 ))
	echo "<td><input type='text' size ='5' name='id1' value='". $info1['oasis']."'/></td>";
	echo "<td><input type='text' size ='18' name='id1' value='".$info1['lname'] ."'/></td>";
	echo "<td><input type='text' size ='15' name='id1' value='".$info1['fname'] . "'/></td>";
	echo "<td><input type='text' size ='15' name='id1' value='".$info1['service'] ."'/></td>";
	echo "<td><input type='text' size ='5' name='id1' value='".$info10['level'] ."'/></td>";
echo "</tr>";
Clipboard01.jpg (45.68 KiB) Viewed 959 times

User avatar
New php-forum User
New php-forum User
Posts: 10
Joined: Mon Sep 24, 2012 6:58 pm

Mon Sep 24, 2012 7:38 pm

The first solution is using Ajax/Jquery to change a specific row in the table.
and the second one is passing the information in the other rows to the page again to show them and it'll be a disaster for your server resources.

Fady Joseph

Post Reply