Auto genrate a link????

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
Skywalker
Forum Contributor
Posts: 117
Joined: Thu Aug 29, 2002 3:33 am
Location: The Netherlands

Auto genrate a link????

Post by Skywalker »

I have just a litle question. About php incombination with an datbase.

Is it posible to auto generate voor each row that is inserted in a database?
For example I have a client of mine and I am making a database of my clients so I can see when I added them to search engines.

No I added him 3 times for example. Is it then posible to generate a page automaticly when you klick on the stat of the client that you are getting three links with the three divrend dates.

So you can see at what time you added the client the first time and see what time you added the client the second time.

Simple example:

I add three times something in to the database. Is it then posible to generate for each enterd row an link so you can see for every enterd row the diffrend information?

Please help me with this one. I am searching for information.

Greathings Skywalker
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

e.g. let's take the table-def

Code: Select all

CREATE TABLE `accounts` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `NAME` varchar(64) NOT NULL default '',
  `PRIV` varchar(16) NOT NULL default '',
  `PASSWORD` varchar(64) NOT NULL default '',
  `TOTALCONNECTTIME` int(10) unsigned NOT NULL default '0',
  `LASTCONNECTTIME` int(10) unsigned NOT NULL default '0',
  `LASTCHARUID` int(10) unsigned NOT NULL default '0',
  `FIRSTCONNECTDATE` datetime NOT NULL default '0000-00-00 00:00:00',
  `FIRSTIP` varchar(24) NOT NULL default '
};'
now, somehow (miraculously :) ) a query reveals the feasable (unique) ids for a request, e.g.

Code: Select all

$query = "SELECT id,NAME FROM accounts WHERE PRIV='01040'";
$result = mysql_query($query, $db_conn);
all you have to do is to create links that contain the record-id

Code: Select all

while($row=mysql_fetch_row($result))
	echo '<a href="detail.php?id=', $row[0], '" >', $row[1], '</a><br />';
and query those records in your detail-script

Code: Select all

$query = "SELECT * FROM accounts WHERE id=".(int)$_GET['id'];
User avatar
Skywalker
Forum Contributor
Posts: 117
Joined: Thu Aug 29, 2002 3:33 am
Location: The Netherlands

Post by Skywalker »

OK thx for the information :D
Post Reply