Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #16056 > unrolled thread

How to retreive data from row and show it as link in a page

Started byandroidmaroso@gmail.com
First post2016-01-02 03:18 -0800
Last post2016-01-04 22:56 +0100
Articles 5 — 2 participants

Back to article view | Back to comp.lang.php


Contents

  How to retreive data from row and show it as link in a page androidmaroso@gmail.com - 2016-01-02 03:18 -0800
    Re: How to retreive data from row and show it as link in a page androidmaroso@gmail.com - 2016-01-02 03:43 -0800
    Re: How to retreive data from row and show it as link in a page Arno Welzel <usenet@arnowelzel.de> - 2016-01-02 14:49 +0100
      Re: How to retreive data from row and show it as link in a page androidmaroso@gmail.com - 2016-01-04 11:57 -0800
        Re: How to retreive data from row and show it as link in a page Arno Welzel <usenet@arnowelzel.de> - 2016-01-04 22:56 +0100

#16056 — How to retreive data from row and show it as link in a page

Fromandroidmaroso@gmail.com
Date2016-01-02 03:18 -0800
SubjectHow to retreive data from row and show it as link in a page
Message-ID<43088977-4e12-4d58-a977-aa114e491069@googlegroups.com>
Hello everyone,

i've spent all night searching how to do what for you is a simple task!

I have a mysql database with a table calles iptable with id, ip, timestamp fields.

The table receives data with new ip's every time the ip changes.

I would like to retrieve the last IP received and show it as a link.

For example :

id=1  ip=192.168.1.20
id=2  ip=192.168.1.21
id=3  ip=192.168.1.52

i would like to show as a link the id n.3 in this example.

I've done this but without results :

$link=Connection();
$ultimoip=mysql_query("SELECT * FROM `iptable` ORDER BY `id` DESC limit 1",$link);

if($ultimoip!==FALSE){
		     while($row = mysql_fetch_array($ultimoip)) {
	printf($row["ip"]);
	echo '<a href="' . $row["ip"] . '">IP Attuale</a>';
					}
        mysql_free_result($ultimoip);

can anyone help me please?

[toc] | [next] | [standalone]


#16057

Fromandroidmaroso@gmail.com
Date2016-01-02 03:43 -0800
Message-ID<d3551cf2-290f-4f71-aed3-ca728b09d4ac@googlegroups.com>
In reply to#16056
Il giorno sabato 2 gennaio 2016 12:18:12 UTC+1, androi...@gmail.com ha scritto:
> Hello everyone,
> 
> i've spent all night searching how to do what for you is a simple task!
> 
> I have a mysql database with a table calles iptable with id, ip, timestamp fields.
> 
> The table receives data with new ip's every time the ip changes.
> 
> I would like to retrieve the last IP received and show it as a link.
> 
> For example :
> 
> id=1  ip=192.168.1.20
> id=2  ip=192.168.1.21
> id=3  ip=192.168.1.52
> 
> i would like to show as a link the id n.3 in this example.
> 
> I've done this but without results :
> 
> $link=Connection();
> $ultimoip=mysql_query("SELECT * FROM `iptable` ORDER BY `id` DESC limit 1",$link);
> 
> if($ultimoip!==FALSE){
> 		     while($row = mysql_fetch_array($ultimoip)) {
> 	printf($row["ip"]);
> 	echo '<a href="' . $row["ip"] . '">IP Attuale</a>';
> 					}
>         mysql_free_result($ultimoip);
> 
> can anyone help me please?

Maybe i figured it out :

   <?php 
	
$ultimoip=mysql_query("SELECT * FROM `iptable` ORDER BY `id` DESC limit 1",$link);

if($ultimoip!==FALSE){
		     while($row = mysql_fetch_array($ultimoip)) {
				echo "<a href='http://".$row['ip']."'>" . $row['ip'] . "</a></td>";
				echo "</br>";
					}
		     mysql_free_result($ultimoip);
}

	?>

[toc] | [prev] | [next] | [standalone]


#16058

FromArno Welzel <usenet@arnowelzel.de>
Date2016-01-02 14:49 +0100
Message-ID<5687D554.6050409@arnowelzel.de>
In reply to#16056
androidmaroso@gmail.com schrieb am 2016-01-02 um 12:18:

[Getting the last record of a table in MySQL]

> I've done this but without results :
> 
> $link=Connection();
> $ultimoip=mysql_query("SELECT * FROM `iptable` ORDER BY `id` DESC limit 1",$link);
> 
> if($ultimoip!==FALSE){
> 		     while($row = mysql_fetch_array($ultimoip)) {
> 	printf($row["ip"]);
> 	echo '<a href="' . $row["ip"] . '">IP Attuale</a>';
> 					}
>         mysql_free_result($ultimoip);
> 
> can anyone help me please?

Any error messages? Any server side logs? What does Connection() do and
where is that function - in an included script?


-- 
Arno Welzel
http://arnowelzel.de
http://de-rec-fahrrad.de
http://fahrradzukunft.de

[toc] | [prev] | [next] | [standalone]


#16070

Fromandroidmaroso@gmail.com
Date2016-01-04 11:57 -0800
Message-ID<c65c6b16-208e-466f-ae7c-6a45a8811edb@googlegroups.com>
In reply to#16058
Il giorno sabato 2 gennaio 2016 14:49:38 UTC+1, Arno Welzel ha scritto:
> androidmaroso@gmail.com schrieb am 2016-01-02 um 12:18:
> 
> [Getting the last record of a table in MySQL]
> 
> > I've done this but without results :
> > 
> > $link=Connection();
> > $ultimoip=mysql_query("SELECT * FROM `iptable` ORDER BY `id` DESC limit 1",$link);
> > 
> > if($ultimoip!==FALSE){
> > 		     while($row = mysql_fetch_array($ultimoip)) {
> > 	printf($row["ip"]);
> > 	echo '<a href="' . $row["ip"] . '">IP Attuale</a>';
> > 					}
> >         mysql_free_result($ultimoip);
> > 
> > can anyone help me please?
> 
> Any error messages? Any server side logs? What does Connection() do and
> where is that function - in an included script?
> 
> 
> -- 
> Arno Welzel
> http://arnowelzel.de
> http://de-rec-fahrrad.de
> http://fahrradzukunft.de

Yes it's an included file where database connection info is set to connect to database.

[toc] | [prev] | [next] | [standalone]


#16072

FromArno Welzel <usenet@arnowelzel.de>
Date2016-01-04 22:56 +0100
Message-ID<568AEA95.5050507@arnowelzel.de>
In reply to#16070
androidmaroso@gmail.com schrieb am 2016-01-04 um 20:57:

> Il giorno sabato 2 gennaio 2016 14:49:38 UTC+1, Arno Welzel ha scritto:
>> androidmaroso@gmail.com schrieb am 2016-01-02 um 12:18:
>>
>> [Getting the last record of a table in MySQL]
>>
>>> I've done this but without results :
>>>
>>> $link=Connection();
>>> $ultimoip=mysql_query("SELECT * FROM `iptable` ORDER BY `id` DESC limit 1",$link);
>>>
>>> if($ultimoip!==FALSE){
>>> 		     while($row = mysql_fetch_array($ultimoip)) {
>>> 	printf($row["ip"]);
>>> 	echo '<a href="' . $row["ip"] . '">IP Attuale</a>';
>>> 					}
>>>         mysql_free_result($ultimoip);
>>>
>>> can anyone help me please?
>>
>> Any error messages? Any server side logs? What does Connection() do and
>> where is that function - in an included script?
>>
>>

This is a signature (it starts with the line "-- "), which is usally NOT
cited:

>> -- 
>> Arno Welzel
>> http://arnowelzel.de
>> http://de-rec-fahrrad.de
>> http://fahrradzukunft.de
> 
> Yes it's an included file where database connection info is set to connect to database.

And what about error messages or log entries?


-- 
Arno Welzel
http://arnowelzel.de
http://de-rec-fahrrad.de
http://fahrradzukunft.de

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.php


csiph-web