Date: 07/30/01
- Next message: Andrew Hill: "RE: [PHP-DB] PHP on Linux and MS SQL"
- Previous message: Mike Gifford: "[PHP-DB] Re: Query displays one"
- In reply to: Hugh Bothwell: "[PHP-DB] Re: Query displays one"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hi Hugh,
Hugh Bothwell wrote:
> "Mike Gifford" <mike <email protected>> wrote in message
> news:3B648EF9.6010400 <email protected>
>
>>The problem is that I am only getting one response from this query rather
>>
> than
>
>>5. I can't figure this out. What did I do to only get one response?
> Try removing the ORDER BY and LIMIT and run the query by
> hand - how many responses do you get? The search may only
> return one article.
I tried removing these and I got a similarly disappoinging response (one reply),
so I decided to look again for code that is actually working and copy it from
scratch. I hit upon this and it is working now.
Thanks for your help.
function latest_articles() {
global $id,$main_file,$front_end_url,$alt, $articlestable, $categorytable;
$alt_var="";
$contentquery4 = mysql_query("SELECT a.*,s.URLname FROM $articlestable a,
$categorytable s WHERE a.articleSectionID = s.articleSectionID ORDER BY a.date
DESC") or mysql_die();
if ($result = mysql_num_rows($contentquery4)) {
while ($contentarray4 = mysql_fetch_array($contentquery4)) {
$category = $contentarray4["URLname"];
if ($alt) {
if ($contentarray4["alt_title"]) {
$link_name = $contentarray4["alt_title"];
$alt_var = "?alt=french";
} else {
$link_name = $contentarray4["title"];
$alt_var = "?alt=french";
}
} else {
$link_name = $contentarray4["title"];
$alt_var = "";
}
$content .= "\n<li><a
href=\"".$front_end_url."/".$main_file."/".urlencode($category)."/".$contentarray4["articleID"]."/"
. $alt_var ."\" class=\"articleslink\">".stripslashes($link_name)."</a>";
$i++;
if ($i==5) {
break;
}
}
}
return $content;
}
-- Mike Gifford, OpenConcept Consulting, http://openconcept.ca Offering everything your organization needs for an effective web site. Abolish Nuclear Weapons Now!: http://pgs.ca/petition/ It is a miracle that curiosity survives formal education. - A Einstein-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-db-unsubscribe <email protected> For additional commands, e-mail: php-db-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: Andrew Hill: "RE: [PHP-DB] PHP on Linux and MS SQL"
- Previous message: Mike Gifford: "[PHP-DB] Re: Query displays one"
- In reply to: Hugh Bothwell: "[PHP-DB] Re: Query displays one"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

