Your problem seems to stem from the $content .= $row; $row is an Array and
you must use an index to get at any given value it holds. If you need all of
the values in $row, use the count() function to get the number of elements
(columns in this case), then loop through them adding them to $content along
with any separators (IE: commas or semi colons or spaces) etc. the code
might look like this:

$content = ""; // I like to make sure that the variable is always
initialized to something before I use it.

$num_results_cat = mysql_num_rows($result_cat);

for ($i=0; $i < $num_results_cat; $i++)
$row = mysql_fetch_array($result);
  $num_of_cols = count($row);
  for ($x=0; $x<$num_of_cols; $x++)
      $content .= ", ".$row[$x];

This will allow you to loop through every row in the query and add every
column to the $content variable.


-------Original Message-------

From: Wilmar Perez
Date: Friday, September 06, 2002 14:50:44
To: php-db mailing list
Subject: [PHP-DB] Can't see the results

Hello guys

Thanks to all those you helped me with y the question I made before (not a 
valid MySQL result) it's working now. 

Now, I want to display the result of my search with the following code:


$query_cat = "select author.author_names || ' '|| author.author_surnames 
as full_name from author, authorxcat
where authorxcat.cat_code = $code
and author.author_code = authorxcat.author_code"
or die($mysql_error());

$result_cat = mysql_query($query_cat);

$num_results_cat = mysql_num_rows($result_cat);

for ($i=0; $i < $num_results_cat; $i++)
$row = mysql_fetch_array($result);
$content .= $row;
$content .= htmlspecialchars(stripslashes($row["author_names"]))
." ".htmlspecialchars(stripslashes($row ["author_surnames"]))."<br>";*/


But I just get the following:


I also tried to do it commenting the "$content .= $row;" and uncommenting 
the lines that are commented in the code but I just get a blank page. 

What am I doing wrong? 

Thanks a lot for your help.
Wilmar Pérez
Network Administrator
Library System
Tel: ++57(4)2105145
University of Antioquia
Medellín - Colombia

PHP Database Mailing List (
To unsubscribe, visit:


Reply via email to