Field type

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
Arsench2000
Forum Commoner
Posts: 38
Joined: Sat Sep 15, 2007 8:18 pm

Field type

Post 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
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Post 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>';
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
Arsench2000
Forum Commoner
Posts: 38
Joined: Sat Sep 15, 2007 8:18 pm

Field

Post 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]
josa
Forum Commoner
Posts: 75
Joined: Mon Jun 24, 2002 4:58 am
Location: Sweden

Post 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
Arsench2000
Forum Commoner
Posts: 38
Joined: Sat Sep 15, 2007 8:18 pm

Thanksss

Post 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
User avatar
superdezign
DevNet Master
Posts: 4135
Joined: Sat Jan 20, 2007 11:06 pm

Re: Thanksss

Post 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;"
Arsench2000
Forum Commoner
Posts: 38
Joined: Sat Sep 15, 2007 8:18 pm

Re: Thanksss

Post 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
User avatar
superdezign
DevNet Master
Posts: 4135
Joined: Sat Jan 20, 2007 11:06 pm

Post 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. ;)
Arsench2000
Forum Commoner
Posts: 38
Joined: Sat Sep 15, 2007 8:18 pm

Limit

Post 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
User avatar
superdezign
DevNet Master
Posts: 4135
Joined: Sat Jan 20, 2007 11:06 pm

Post by superdezign »

Post Reply