Jump to content

[SOLVED] how to display the results of a query on two columns


sillysillysilly

Recommended Posts

Simple question on displaying the array results from two columns.

 

this is what I am using to test

 

$result =  mysql_query("SELECT dateavail, type From avail WHERE propertyid ='$propertyid' AND (datecheck - $gooddate) > 0");

$num_rows = mysql_num_rows($result);

echo $num_rows . "<br />";

if ($num_rows){

$i=0;

    while ($dateavail = mysql_fetch_row($result)){

       

echo $dateavail[$i] .  "<br />";

    }

}

 

I get 9 rows and can see dates but cannot see types no matter what different ideas I have tried.

Your never incrementing $i, so it is always 0. Also the 'type' column will never get displayed because you only have one output.

 

There is really no need for the $i

 

echo $dateavail[0] .  "<br />";
echo $dateavail[1] .  "<br /><br />";

 

Should display the data.

thanks

 

I need to pass the data to an array that I will later put into a table for display.  So should I do something like incrementing $i in the process and saying

 

$firstavail[$i] = $dateavail[0];

$typeavail[$i] =$dateavail[1];

 

Thanks for your help.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.