homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

MYSQL with PHP help : Urgent
nani nisha06

Msg#: 4494239 posted 11:17 am on Sep 12, 2012 (gmt 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!




WebmasterWorld Senior Member eelixduppy us a WebmasterWorld Top Contributor of All Time 5+ Year Member

Msg#: 4494239 posted 1:17 pm on Sep 12, 2012 (gmt 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...]

nani nisha06

Msg#: 4494239 posted 7:26 am on Sep 17, 2012 (gmt 0)

Hi EElixduppy,

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


Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved