Jump to content

Displaying all the values


franknu

Recommended Posts

ok, I want to display all the values from a colum that matches. Right now i am only displaying the the last value that was inserted in know it has to do with $row['value']

 

but i am not displaying anything when i do it that way so here is my current code

 

here is my code

 


</tr>
                       <td><input type="checkbox" name="checkbox" value="checkbox"></td>
                        <td><? echo"$date"; ?></td>
                        <td><? echo"$from"; ?></td>
                        <td><? echo"$status"; ?></td>
                        <td><? echo"$subject"; ?></td>
                      
                      <tr>

Link to comment
https://forums.phpfreaks.com/topic/56421-displaying-all-the-values/
Share on other sites

well, this is my sql code which work fine

 


<?


$sql=" SELECT   messages.* FROM business_info,messages
WHERE business_info.BusinessName=messages.BusinessName";
$result=mysql_query($sql);
while($row=mysql_fetch_assoc($result))
{
      $BusinessName= $row['BusinessName'];
      $date = $row['date'];
      $from =  $row['from'];
  $status = $row['status'];
      $subject = $row['subject'];
      $message =$row['message'];

  }






?>

 

i know it has to do with the way i am pulling the info

ok this is really what is relevant the tables and stuff would only make look long .  and if i put it inside he while loop, how would the table look wouldnt it look messy

 

here is my code more simpler

 


<?

$sql=" SELECT   messages.* FROM business_info,messages
WHERE business_info.BusinessName=messages.BusinessName";
$result=mysql_query($sql);
while($row=mysql_fetch_assoc($result))
{
      $BusinessName= $row['BusinessName'];
      $date = $row['date'];
      $from =  $row['from'];
  $status = $row['status'];
      $subject = $row['subject'];
      $message =$row['message']; 

  }


?>

<input type="checkbox" name="checkbox" value="checkbox"></td>
                        <td><? echo"$date"; ?></td>
                        <td><? echo"$from"; ?></td>
                        <td><? echo"$status"; ?></td>
                        <td><? echo"$subject"; ?></td> // this one i also want to make it a link
                      
                      <tr>

<?php

$sql=" SELECT   messages.* FROM business_info,messages
WHERE business_info.BusinessName=messages.BusinessName";
$result=mysql_query($sql);
while($row=mysql_fetch_assoc($result))
{
      $BusinessName= $row['BusinessName'];
      $date = $row['date'];
      $from =  $row['from'];



  $status = $row['status'];
      $subject = $row['subject'];
      $message =$row['message']; 

?>

<input type="checkbox" name="checkbox" value="checkbox"></td>
                        <td><? echo"$date"; ?></td>
                        <td><? echo"$from"; ?></td>
                        <td><? echo"$status"; ?></td>
                        <td><? echo"$subject"; ?></td> // this one i also want to make it a link
                      
                      <tr>

<?php

  }

?>

Try this:

 

var_dump($row);

 

That will at least show you all the columns that mysql_fetch_array() is returning into your stack(array).  Once you do that, then you can see how you need to reference your stack (i.e $row['stack_element']).

 

If the stack is missing element that you think should be there then look at your query statement and make sure its asking the database what you think its asking.

Try this:

 

var_dump($row);

 

That will at least show you all the columns that mysql_fetch_array() is returning into your stack(array).  Once you do that, then you can see how you need to reference your stack (i.e $row['stack_element']).

 

If the stack is missing elements that you think should be there then look at your query statement and make sure its asking the database what you think its asking.

well, my problem now is that it is showing  like 20 rows the sameway meaning, repeating itself


				   
<?

$sql=" SELECT   messages.* FROM business_info,messages
WHERE business_info.BusinessName=messages.BusinessName";
$result=mysql_query($sql);
while($row=mysql_fetch_assoc($result))
{
      $BusinessName= $row['BusinessName'];
      $date = $row['date'];
      $from =  $row['from'];
  $status = $row['status'];
      $subject = $row['subject'];
      $message =$row['message'];

				echo"<tr>";
                      echo" <td>";   
				  echo' <input type="checkbox" name="checkbox" value="checkbox"></td>';
                       echo" <td> $date </td>";
                       echo" <td> $from </td> ";
                        echo"<td> $status </td>";
                        echo"<td> $subject </td>";
                     echo"</tr>";

				  }
				  ?>

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.