php-db | 2001072
Date: 07/29/01
- Next message: Luc Servaas: "Re: [PHP-DB] Still trying to get image from /tmp path"
- Previous message: David Balatero: "RE: [PHP-DB] Still trying to get image from /tmp path"
- Next in thread: Hugh Bothwell: "[PHP-DB] Re: Query displays one"
- Reply: Hugh Bothwell: "[PHP-DB] Re: Query displays one"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hello,
I've got a pretty basic query which I am trying to run within a function.
The query looks like this:
SELECT
a.title,a.alt_title,a.articleID,a.articleSectionID,sect.URLname
FROM
$articlestable a, $categorytable sect
WHERE
a.articleSectionID = sect.articleSectionID
ORDER BY
a.date
DESC
limit 5
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?
The function is here:
function latest_articles() {
global $id,$main_file,$front_end_url,$alt, $articlestable, $categorytable;
$alt_var="";
$contentquery4 = mysql_query("SELECT
a.title,a.alt_title,a.articleID,a.articleSectionID,sect.URLname FROM
$articlestable a, $categorytable sect WHERE a.articleSectionID =
sect.articleSectionID ORDER BY a.date DESC limit 5") 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"];
}
$content .= "\n<li><a
href=\"".$front_end_url."/".$main_file."/".urlencode($category)."/".$contentarray4["articleID"]."/"
. $alt_var ."\" class=\"articleslink\">".stripslashes($link_name)."</a>";
}
}
return $content;
}
And Table below:
CREATE TABLE articles (
articleID bigint(21) unsigned NOT NULL auto_increment,
articleSectionID bigint(21),
uid bigint(21),
title varchar(255),
content mediumtext,
image_suffix varchar(4),
date date,
alt_title varchar(255),
alt_content BLOB,
meta_keywords varchar(255),
meta_description varchar(255),
blerb TEXT,
alt_blerb TEXT,
PRIMARY KEY (articleID)
);
The missing results can (not) be seen here (under new postings):
http://airdiv.cupe.ca/union.php/Division/
Mike
-- 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: Luc Servaas: "Re: [PHP-DB] Still trying to get image from /tmp path"
- Previous message: David Balatero: "RE: [PHP-DB] Still trying to get image from /tmp path"
- Next in thread: Hugh Bothwell: "[PHP-DB] Re: Query displays one"
- Reply: Hugh Bothwell: "[PHP-DB] Re: Query displays one"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

