Ask a Question related to PHP Development, Design and Development.
-
Sugapablo #1
Looking for the most EFFICIENT way to do the following...
I have a table that has links in it.
Columns: id, item, link_name, url.
I want to run through the recordset of this table and so something like
the following.... (Obviously, the following didn't work. I'd like to be
able to do something like this, avoiding having to make several seperate
database calls.)
[begin code]
$sql = "SELECT * FROM table ORDER BY item";
$res = pg_query($db,$sql);
//Echo out all links with an item of 1...
while(list($id,$item,$link_name,$url) = pg_fetch_row($res) && $item == 1) {
printf("<a href=\"%s\">%s</a><br>",$url,$link_name);
}
//Echo out other junk
echo $someStuff1;
//Echo out all links with an item of 2...
while(list($id,$item,$link_name,$url) = pg_fetch_row($res) && $item == 2) {
printf("<a href=\"%s\">%s</a><br>",$url,$link_name);
}
//Echo out other junk
echo $someStuff2;
//Et cetera
while(list($id,$item,$link_name,$url) = pg_fetch_row($res) && $item == 3) {
printf("<a href=\"%s\">%s</a><br>",$url,$link_name);
}
echo $someStuff3;
while(list($id,$item,$link_name,$url) = pg_fetch_row($res) && $item == 4) {
printf("<a href=\"%s\">%s</a><br>",$url,$link_name);
}
echo $someStuff4;
[end code]
Any ideas?
--
Sugapablo - [email]russpghREMOVE@stargate.net[/email]
[url]http://www.sugapablo.com[/url] | ICQ: 902845
Sugapablo Guest
-
Efficient Lingo Tips
Hi all. This may be old news to the smart people out there, but a couple of recent experiments surprised me, and I figured it wouldn't hurt to share... -
Working Efficient with ID CS
Hello, A couple of weeks ago I went to a seminar of ID CS Page maker edition. I saw that ID has much more possibilities than Page maker 6.5 which... -
What is more efficient (*.a or *.so) libraries?
Hi, Recently I developed a series of static libraries (*.a files) for performing various different operations. I used these libraries to create... -
How to write efficient calculations?
FM5.5 WINXP I have been working on a calculation that would subtract the type of street at the end of an address field and leave the number and... -
Efficient structure
I have multiple types of information to associate to one object. I have data structures that store data structures. What is the best/most...



Reply With Quote

