Parsing database via PHP. Display options, etc.

SpaceshipSpaceship
SpaceshipSpaceship
SpaceshipSpaceship
Watch

Miyavi

o-re-sa-maVIP Member
Impact
41
I have a MySQL database in phpMyAdmin with one table and over 7,000 entries/rows.

How do I go about parsing this information and displaying them on a website? What PHP code do I need to use?

Also, how do I go about making sure each of these 7,000 entries gets its own URL? I want each entry name and id# to be included. For example...
http://www.mysite.com/db/dogs?id=1
http://www.mysite.com/db/cats?id=2
http://www.mysite.com/db/monkeys?id=3
etc.

I am still very new to this, so please keep it as simple as possible.

At least I already have the database set up! I just need to figure out the output.

:lala:
 
0
Close
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
have you got started with anything as of yet?

for the url's you will need to use mod rewrite so that http://www.mysite.com/db/dogs?id=1 would be rewritten too

http://www.mysite.com/db/script-name.php?cat=dogs&id=1

or alternatively have a php file for each category and do the rewrite too:

http://www.mysite.com/db/dogs.php?id=1

The displaying details you will need to do something like the following:

$db = mysql_connect('server-name', 'username', 'password');
$sql = "Select * from table_name where cat='dog' and id = 1";
$resultset = mysql_query($sql,$db);
while($row = mysql_fetch_assoc($resultset))
{
//output the row this is an array with keys that match the colum headers from mysql
}

As you have got 7000 results however I would strongly suggest splitting the results over pages (like ebay etc do, they dont show every result they split it into batches od 50 or so)
 
0
Close
DomainEasy: flexible LTO options. Close more domain deals with financing.

We're social

Escrow.com
Spaceship
CryptoExchange.com
Domain Recover

NamePros updates

Quick replies: search, your most used replies, and more on every post
Quick replies are easier to find and use now. The quick reply menu has a search box. Type a few letters to find the reply you want. A...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back