Jump to content

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.