include("index.php"); require_once('db_con.php'); $call_result = mysql_query("SELECT * FROM comments WHERE Cust_No='$cust_no' AND Call_No='$call_no'") or die(mysql_error());?> <table border="1"> <? while ($call_row = mysql_fetch_array($call_result)) ?> <tr> <td><img src="images/STAR50x50.jpg"> <? echo mysql_num_rows($call_result) . '<br>'; //$date = $call_row['Date']; echo 'Original date: ' . $call_row['Date'] . '<br>'; echo $call_row['Type'] . '<br>'; //echo 'Original date: ' . $date . '<br>'; $strDate = date('m/d/y g:i:s a', strtotime($date)); echo 'Date: ' . $strDate . '<br>'; echo '<br>' . $call_row['Type']; echo $cust_no . '<br>' . $call_no?> </td> </tr> </table> PHP: There is the code.. i've copied and pasted the values from the mysql database, so I don't think its something wrong with the case or anything like that.. thanks for the help! I am getting the cust_no and call_no by manually putting it into the url.. it seems to work though.
Put some curly braces around the while loop, otherwise it will just loop on the next statement (which, with the way you break out of PHP there, might be nothing). Also, get into the habit of using long PHP tags (<?php / ?>) as opposed to short ones (<? / ?>). So, try this: include("./"); require_once('db_con.php'); $call_result = mysql_query("SELECT * FROM comments WHERE Cust_No='$cust_no' AND Call_No='$call_no'") or die(mysql_error());?> <table border="1"> <?php while ($call_row = mysql_fetch_array($call_result)) { ?> <tr> <td><img src="images/STAR50x50.jpg"> <?php echo mysql_num_rows($call_result) . '<br>'; //$date = $call_row['Date']; echo 'Original date: ' . $call_row['Date'] . '<br>'; echo $call_row['Type'] . '<br>'; //echo 'Original date: ' . $date . '<br>'; $strDate = date('m/d/y g:i:s a', strtotime($date)); echo 'Date: ' . $strDate . '<br>'; echo '<br>' . $call_row['Type']; echo $cust_no . '<br>' . $call_no?> </td> </tr> <?php } ?> </table> PHP:
I've placed a ; after $call_no. include("./"); require_once('db_con.php'); $call_result = mysql_query("SELECT * FROM comments WHERE Cust_No='$cust_no' AND Call_No='$call_no'") or die(mysql_error());?> <table border="1"> <?php while ($call_row = mysql_fetch_array($call_result)) { ?> <tr> <td><img src="images/STAR50x50.jpg"> <?php echo mysql_num_rows($call_result) . '<br>'; //$date = $call_row['Date']; echo 'Original date: ' . $call_row['Date'] . '<br>'; echo $call_row['Type'] . '<br>'; //echo 'Original date: ' . $date . '<br>'; $strDate = date('m/d/y g:i:s a', strtotime($date)); echo 'Date: ' . $strDate . '<br>'; echo '<br>' . $call_row['Type']; echo $cust_no . '<br>' . $call_no; ?> </td> </tr> <?php } ?> </table> PHP:
Glad you got it working. Basically it's because support for it is defined by an option. Some people have it enabled, some don't, whereas the long tags are supported no matter what.