Welcome to WebmasterWorld Guest from

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

MYSQL with PHP help : Urgent

11:17 am on Sep 12, 2012 (gmt 0)

New User

5+ Year Member

joined:Aug 29, 2012
posts: 16
votes: 0

Hi Friends,

I am back with another question on the webmasterworld.

I am working on a project where i need to created a ticketing information with multiple attributes. of course MYSQL database is ready but now I need the data to be projected on a template which is powered by HTML code but, I want to fetch this data using PHP & MYSQL Command.....As a sample I have created a DB as below

RosePink Tacos Cat
BradleyBlue PotatoesFrog
MarieBlack PopcornDog
AnnOrange Soup Cat

$data = mysql_query("SELECT * FROM $tbl_name")
or die(mysql_error());
Print "<table border cellpadding=3>";
while($info = mysql_fetch_array( $data ))
Print "<tr>";
Print "<th>name:</th> <td>".$info['name'] . "</td> ";
Print "<th>pet:</th> <td>".$info['pet:'] . " </td></tr>";
Print "</table>";

But when I use the above code on the data to read using PHP I get results as below:

Name: Bradleypet:Frog

But I want it to project the data on the template as is of first table

On the point 2: I want only 3o rows to be displayed in each page so, I need a code to auto generate multiple pages for this data.

Thanks in advance!

1:17 pm on Sept 12, 2012 (gmt 0)

Senior Member

joined:Nov 12, 2005
votes: 0

You are looping on too much. Try just the following:

echo '<table><tr><td>Name</td><td>Pet</td></tr>';
while($info = myself_fetch_array($data)) {
echo "<tr><td>{$info['name']}</td><td>{$info['pet']}</td></tr>";
echo '</table>';

Also, you are looking for pagination. Here's my go-to thread, but you should be able to find many examples of this online as well: [webmasterworld.com...]
7:26 am on Sept 17, 2012 (gmt 0)

New User

5+ Year Member

joined:Aug 29, 2012
posts: 16
votes: 0

Hi EElixduppy,

Thanks this is solved now but I need some help on applying filters.