Web Directory

Hi,
Hope someone can help me!

I have a mysql table with the following fields:

[id] [surname] [catergory] [details] [userlink]

I want to list the pages similar to open directory/yahoo.
For example the initial page will list [surnames] by [catergory] a,b,c,d,e,f,g, ect… upto z (full alphabet) giving a number of links in each catergory. i.e: catergory A (12 links), catergory B (28 links), catergory C (53 links)…and on…
Then on clicking [a] will go to all the names starting with the letter ‘a’, listing the [id] [surname] [details] [userlink], prefably listing no more than 20 entries on each page, if there are more, to have next / previous page links.

Can anyone help
Many thanx,
Dave

So what is your question?

also take a look at
http://www.phphelp.com/phpBB2/viewtopic.php?t=4089

Hi,

The question is I do not know how to do it!
I can list the basic fields (as below), but do not how to go on from there - I am a complete ‘beginner’ slowly picking up bits here and there!

I am even lost trying to put a link "<a href=“contactform.php?id=$row[‘id’]” in an echo as follows (its near the bottom-this is a link to go to the contactform.php taking the [id] iwth it to enter details in a form):

[code]connect to database…
$query = “SELECT * FROM wanted ORDER BY catergory”;
$result = mysql_query($query) or die (“Query failed”);

$numofrows = mysql_num_rows($result);

echo “

n”;
echo “n”;
for($i = 0; $i < $numofrows; $i++) {
$row = mysql_fetch_array($result);
if($i % 2) {
echo “n”;
} else {
echo “n”;
}
echo “n”;
echo “n”;
}
echo “
id surname dates country county details Contact
”.$row[‘id’]." ".$row[‘surname’]." ".$row[‘dates’]." ".$row[‘country’]." ".$row[‘county’]." ".$row[‘details’]." ".$row"<a href=“contactform.php?id=$row[‘id’]”.“
n”;
?> [/code]
I am sorry to ask - but I am stuck!
regards,
Dave

Hi,
Sorted that a href problem - missed a ;

My previous question still stands:

I have a mysql table with the following fields:

[id] [surname] [catergory] [details] [userlink]

I want to list the pages similar to open directory/yahoo - BUT a LOT simpler!!
For example the initial page will list [surnames] by [catergory] a,b,c,d,e,f,g, ect… upto z (full alphabet) giving a number of links in each catergory. i.e: catergory A (12 links), catergory B (28 links), catergory C (53 links)…and on…
Then on clicking [a] will go to all the names starting with the letter ‘a’, listing the [id] [surname] [details] [userlink], prefably listing no more than 20 entries on each page, if there are more, to have next / previous page links.

Has anybody got an idea on how to do this?
Cheers,
Dave

go to http://www.codewalkers.com and check out the tutorials section. There you will find a number of tutorials that can help you (look at all the sub-sections). There is a tutorial for previous and next links, showing only a portion of a result set (multiple pages for navigation) and allowing the user to sort it, as well as a few more. They should gett you going in the right directions and leave us only to answer specific problems - rather then trying to teach you how to do it.

Good luck!

Hi lig
Thanks for that!

I have read codewalkers back to back (I think), and many other sites and still cannot find a relevant lesson!
Maybe I missed something!
As I am stuck I thought I would ask someone at PHP Help Community Forums,

Thanks,
Dave

if your looking for the number of links thing - check out SQL’s COUNT feature.

psuedocode:

full alphabet page-

get a count of each letter in alphabet (Hint: COUNT)
display alphabet list with link to individual letter page/function
if submitted 
    pass letter submitted
end if

individual letter page/function-

accept letter passed
get all listings for letter from DB
display first 10
if more
    handle display for them
end-if 

Or something like that.

Sponsor our Newsletter | Privacy Policy | Terms of Service