Re: Query displays one
| From: | Mike Gifford | Date: | Mon, 30 Jul 2001 17:07:11 +0000 |
| Subject: | Re: Query displays one | ||
| References: | 1 2 | Groups: | php.db php.db |
| Request: | Send a blank email to php-db+get-10909@lists.php.net to get a copy of this message | ||
Hi Hugh,
Hugh Bothwell wrote:
"Mike Gifford" <mike@openconcept.on.ca> wrote in message news:3B648EF9.6010400@openconcept.on.ca...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 EinsteinThe problem is that I am only getting one response from this query ratherthan5. 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.