You are here: Re: Create Hyperlinked Images within a Auto Cascading Table PHP « PHP Programming Language « IT news, forums, messages
Re: Create Hyperlinked Images within a Auto Cascading Table PHP

Posted by strawberry on 08/16/06 13:03

daniellee2006@hotmail.co.uk wrote:
> I am creating a basic website to store people profiles and within this
> website
> i have a page that creates a table dependent on the number of records
> in mysql
> written in PHP within these tables they show images i need these images
>
> to hyperlink to
> other HTML pages...
>
> Note these tables are written within the <?PHP> area of the full Script
>
> so the basic
> HTML - <a href="URL"><img src="PATH"></a>
> written inside the auto table script does not work as it is HTML with
> PHP
> i need the same process to work within the generated PHP Table
>
>
> Easy - A - Store image (Locations) in Mysql
> Easy - B - Display images in Automatic Table produced by number of
> records in PHP
> Help - C - Make these same images within the Auto Table Hyperlink to
> other HTML pages
>
>
> (Note the reason this is a Auto table is simply the fact the PHP
> requests the number of records
> then with this it creates the table of fields, i need the images in
> those fields to hyperlink
> the basic <a href="URL"><img src="PATH"></a> within PHP does not work
> as the table is autogenerated
> all the contents need to be in the PHP Area )
>
>
> Example
>
>
> <?php
>
>
> Generate table if records exist
> <Table>
> contents
> Hyperlink Images
> </table>
>
>
> ?>
>
>
> <html>
> Echo Table Contents
> </Html>
>
>
> Pls help if you can thanks in advanced....

here's one way (abridged)

echo "<table>\n";
while ($row = mysql_fetch_array ($result,MYSQL_ASSOC))
{
//results
echo "<tr>\n";
echo "<td><a
href='your_url/page.htm?&eg={$row['field']}'>{$row['field']}</a></td>\n";
echo "</tr>\n";
}
echo "</table>\n";

You can also write it something like this (which might,for all I know,
be better practice). Personally, I find it less readable:
?>
<table>
<?
while ($row = mysql_fetch_array ($result,MYSQL_ASSOC))
{
//results
?>
<tr><td>
<a
href='your_url/page.htm?&eg=<?{$row['field']}?>'><?{$row['field']}?></a>

etc, etc

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация