?
Solved

Array results problem

Posted on 2011-02-21
2
Medium Priority
?
243 Views
Last Modified: 2012-05-11
Hi;
This is the way I put my query results in an array

while($row=mysql_fetch_assoc($rsKeywords))
{
$results[]=$row ;
}
 
and this is my query


mysql_select_db($database_Remoteiran79, $Remoteiran79);
$query_rsArticles = "SELECT *, a.id AS id, s.type AS type, a.title AS title FROM rss_articles a LEFT JOIN rss_sources s ON (s.id = source_id)
WHERE  a.type!='trashed' AND (MATCH (a.title) AGAINST ('$keywords' IN BOOLEAN MODE))ORDER BY a.timestamp DESC";
$query_limit_rsArticles = sprintf("%s LIMIT %d, %d", $query_rsArticles, $startRow_rsArticles, $maxRows_rsArticles);
$rsArticles = mysql_query($query_limit_rsArticles, $Remoteiran79) or die(mysql_error());
$row_rsArticles = mysql_fetch_assoc($rsArticles);

When I want to print the array with

print_r ($results[5][keywords]);

I can get the result correctly

but when I try this

print_r ($results[keywords])

it does not return any results at all.  Would you please tell me what is wrong with this?

Thanks a lot
0
Comment
Question by:babak62
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 3

Accepted Solution

by:
imaki06 earned 2000 total points
ID: 34949100
$results[5][keyword] does get value of column keyword from row 5.
$results[keyword] tries to get row keyword, which cannot be found.

If you want to get column keyword from each line, then use following syntax:
foreach ($results as &$resrow) {
    print_r ($resrow[keywords]);
}
0
 

Author Closing Comment

by:babak62
ID: 34949189
EXCELLENT Million thanks
0

Featured Post

WordPress Tutorial 2: Terminology

An important part of learning any new piece of software is understanding the terminology it uses. Thankfully WordPress uses fairly simple names for everything that make it easy to start using the software.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
In this series, we will discuss common questions received as a database Solutions Engineer at Percona. In this role, we speak with a wide array of MySQL and MongoDB users responsible for both extremely large and complex environments to smaller singl…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question