Page 1 of 1

Field type

Posted: Sat Sep 15, 2007 8:26 pm
by Arsench2000
Hi Im a new in phpmyadmin and need a advice.

Im using field for a web address ,that user can type there any web sait and when showing that records on the web can be a like links that can click and go to the web selected.For example.

Category email url description
any any http://www.anysait.com some text


when shows this records on the web can be clickable the url.

here are the page http://khaarsen.ueuo.com/list.php


thanks

Posted: Sat Sep 15, 2007 8:50 pm
by s.dot
When you display it on the page just put it in link tags.

Code: Select all

echo '<a href="' . $url . '">' . $url . '</a>';

Field

Posted: Sun Sep 16, 2007 4:32 am
by Arsench2000
feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


[quote="scottayy"]When you display it on the page just put it in link tags.

Code: Select all

echo '<a href="' . $url . '">' . $url . '</a>';
[/quote]


Hi thank you for your help I dont know where to put it here is my code for select (add is a web sait field)

Code: Select all

$sql = 'SELECT * FROM `links` ORDER BY id DESC';  
$result=mysql_query($sql); 

?> 
              </div>
              <TABLE BORDER=1 align="center" CELLPADDING=0 CELLSPACING=0> 
      <TR><TD><div align="center"><span class="style3">&nbsp;Id</span></div></TD>
      <TD><div align="center"><span class="style3">&nbsp;Category</span></div></TD>
      <TD><div align="center"><span class="style3">&nbsp;E-mail&nbsp;</span></div></TD>
      <TD><div align="center"><span class="style3">&nbsp;URL&nbsp;</span></div></TD>
      <TD><div align="center"><span class="style3">&nbsp;Description&nbsp;</span></div></TD>
      </TR> 
<?
 while($row = mysql_fetch_array($result)) { 
      printf("<tr><td>&nbsp;%s</td><td>&nbsp;%s</td><td>&nbsp;%s</td><td>&nbsp;%s</td><td>&nbsp;%s</td></tr>", $row["id"],$row["cat"],$row["email"],$row["add"],$row["desc"]); 
   } 
   mysql_free_result($result); 
   mysql_close(); 
?>

feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]

Posted: Sun Sep 16, 2007 5:21 am
by josa
Maybe this post should belong in the PHP Code forum instead. Anyway, I think this would work:

Code: Select all

while($row = mysql_fetch_array($result)) {
printf("<tr><td>&nbsp;%s</td><td>&nbsp;%s</td><td>&nbsp;%s</td><td>&nbsp;<a href=\"%s\">%s</a></td><td>&nbsp;%s</td></tr>", $row["id"],$row["cat"],$row["email"],$row["add"],$row["add"],$row["desc"]);
}
/josa

Thanksss

Posted: Sun Sep 16, 2007 5:44 am
by Arsench2000
josa wrote:Maybe this post should belong in the PHP Code forum instead. Anyway, I think this would work:

Code: Select all

while($row = mysql_fetch_array($result)) {
printf("<tr><td>&nbsp;%s</td><td>&nbsp;%s</td><td>&nbsp;%s</td><td>&nbsp;<a href="%s">%s</a></td><td>&nbsp;%s</td></tr>", $row["id"],$row["cat"],$row["email"],$row["add"],$row["add"],$row["desc"]);
}
/josa

Yes friend now it workes thank you very much very much ,please if you can help me in one thing else.
how can I show only 5 records in the page?


thank you again very much

Re: Thanksss

Posted: Sun Sep 16, 2007 8:07 am
by superdezign
Arsench2000 wrote:how can I show only 5 records in the page?
Make use of MySQL's LIMIT. i.e. "... ORDER BY `id` DESC LIMIT 5;"

Re: Thanksss

Posted: Sun Sep 16, 2007 8:35 am
by Arsench2000
superdezign wrote:
Arsench2000 wrote:how can I show only 5 records in the page?
Make use of MySQL's LIMIT. i.e. "... ORDER BY `id` DESC LIMIT 5;"

Hi thanks for your message,I need show o5 records on the page but with link to the next records exampl


1
2
3
4
5

then click on the link and show the next 5 records

Posted: Sun Sep 16, 2007 8:48 am
by superdezign
The format of the LIMIT clause is "LIMIT whereToStart, howManyToRetrieve" i.e. LIMIT 0,5.

MySQL's LIMIT is very useful for pagination. On the first page, you'd have LIMIT 0,5 and on the second you'd have LIMIT 5,5 and on the third LIMIT 10,5 etc.

You should be able to figure it out from there. ;)

Limit

Posted: Sun Sep 16, 2007 10:26 am
by Arsench2000
superdezign wrote:The format of the LIMIT clause is "LIMIT whereToStart, howManyToRetrieve" i.e. LIMIT 0,5.

MySQL's LIMIT is very useful for pagination. On the first page, you'd have LIMIT 0,5 and on the second you'd have LIMIT 5,5 and on the third LIMIT 10,5 etc.

You should be able to figure it out from there. ;)
Thanks again but I think I cant do it because Im new in php and didnt have many experience Im a begginer:)will try to find in other places anyway thanks again

Posted: Sun Sep 16, 2007 10:51 am
by superdezign