arrays and functions .. and passing them around ;P
| From: | hentis at twilyt dot com | Date: | Mon, 02 Oct 2000 10:08:16 +0000 |
| Subject: | arrays and functions .. and passing them around ;P | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-18262@lists.php.net to get a copy of this message | ||
Hi all :)
I have a question ;p
I step thu an array in a result to a query .. and I assign values to variables as normal, but I want
to return a multidimentional array
withh all the details in .. here is a source code ...
function news($offset,$sort){
include "dbaccess.php3";
$query="select * from $tblname SORT by $field_name $sort";
if ($result = mysql_query($query)){
$lastid=mysql_num_rows($result);
while $row=(mysql_fetch_array($result)){
$news_ID=$row["news_ID"];
$user_ID=$row["user_ID"];
$news_content=$row["news_content"];
$news_heading=$row["news_heading"];
$news_status=$row["news_status"];
$submit_date=$row["submit_date"];
}
} else {
print" no news ... duhhhh";
}
as you can see everything so far is ok *might be some mistakes .. don't worry about them for
now*
after $submit_date=$row["submit_date"]; I want to do something like
$query_results=array($news_id=>$user_id,$news_id=>$news_content,etc,etc);
so that I have one array with all the information that I need to build the news page in one array
is there a better way of doing this ... and am I doing it correctly ... ?
Henti