PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
When I test the code that is below, only the date appears in the query string. I know that the month and year are in the database. Can someone please make a suggestion to what could be wrong? Thanks in advance.
require "config.php";
$id = $_GET['id'];
$select = mysql_query("SELECT * FROM newsletters WHERE id = '$id'") or die ("Could not query because: ".mysql_query());
while($r = mysql_fetch_array($select)) {
echo '<a href=newsletter.php?date='.$r['date'].'&month='.$r['month'].'&year='.$r['year'].'>'.$r['date'].' '.$r['month'].' '.$r['year'].'</a>';
}
if (mysql_affected_rows() == 0) {
print "No newsletters to be displayed.";
}
mysql_close();
When I place var_dump($r); into my code it just displays int(1) continuously down the page. That is after I replace mysql_affected_rows() with mysql_num_rows(). I have tried mysql_fetch_assoc() and mysql_fetch_array() but the query string still doesn't display properly. When I try mysql_fetch_assoc() with var_dump($r) it displays: