franknu Posted June 20, 2007 Share Posted June 20, 2007 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 More sharing options...
chigley Posted June 20, 2007 Share Posted June 20, 2007 Paste more code? You need to use a while() loop Link to comment https://forums.phpfreaks.com/topic/56421-displaying-all-the-values/#findComment-278649 Share on other sites More sharing options...
franknu Posted June 20, 2007 Author Share Posted June 20, 2007 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 Link to comment https://forums.phpfreaks.com/topic/56421-displaying-all-the-values/#findComment-278652 Share on other sites More sharing options...
chigley Posted June 20, 2007 Share Posted June 20, 2007 Is that all your code? Post more please. You need to do your echos inside the while() loop Link to comment https://forums.phpfreaks.com/topic/56421-displaying-all-the-values/#findComment-278659 Share on other sites More sharing options...
franknu Posted June 20, 2007 Author Share Posted June 20, 2007 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> Link to comment https://forums.phpfreaks.com/topic/56421-displaying-all-the-values/#findComment-278662 Share on other sites More sharing options...
chigley Posted June 20, 2007 Share Posted June 20, 2007 <?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 } ?> Link to comment https://forums.phpfreaks.com/topic/56421-displaying-all-the-values/#findComment-278663 Share on other sites More sharing options...
phporcaffeine Posted June 20, 2007 Share Posted June 20, 2007 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. Link to comment https://forums.phpfreaks.com/topic/56421-displaying-all-the-values/#findComment-278678 Share on other sites More sharing options...
phporcaffeine Posted June 20, 2007 Share Posted June 20, 2007 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. Link to comment https://forums.phpfreaks.com/topic/56421-displaying-all-the-values/#findComment-278679 Share on other sites More sharing options...
franknu Posted June 20, 2007 Author Share Posted June 20, 2007 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>"; } ?> Link to comment https://forums.phpfreaks.com/topic/56421-displaying-all-the-values/#findComment-278700 Share on other sites More sharing options...
franknu Posted June 20, 2007 Author Share Posted June 20, 2007 please help, i dont see what the problem is Link to comment https://forums.phpfreaks.com/topic/56421-displaying-all-the-values/#findComment-278730 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.