affordit Posted January 25, 2008 Share Posted January 25, 2008 I am tring to pull just the values of field3 email address when field4 is equal to today +8 days and display them. <?php $ds = date("Y-m-d",strtotime("+8 days")); include("sharons_dbinfo.inc.php"); mysql_connect(mysql,$username,$password); @mysql_select_db($database) or die( "Unable to select database"); $query = "select field3 from test WHERE field4 = $ds"; $result=mysql_query($query) or die (mysql_error()); if (($result)||(mysql_errno == 0)) { echo "<table width='100%'><tr>"; if (mysql_num_rows($result)>0) { //loop thru the field names to print the correct headers $i = 0; while ($i < mysql_num_fields($result)) { echo "<th>". mysql_field_name($result, $i) . "</th>"; $i++; } echo "</tr>"; //display the data while ($rows = mysql_fetch_array($result,MYSQL_ASSOC)) { echo "<tr>"; foreach ($rows as $data) { echo "<td align='center'>". $data . "</td>"; } } }else{ echo "<tr><td colspan='" . ($i+1) . "'>No Results found!</td></tr>"; echo $ds; } echo "</table>"; }else{ echo "Error in running query :". mysql_error(); } ?> Quote Link to comment https://forums.phpfreaks.com/topic/87776-solved-help/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.