bbram Posted January 15, 2011 Share Posted January 15, 2011 Hello I am getting an error in my php code. I think the error is in the first line of code but I am not 100% for sure. The error states... Notice: Undefined index: paid_date ... Can you tell me if I am going down the correct route to select the max date in a column? [b]$query = "Select MAX(paid_date) as paidDate from players INNER JOIN players_paid ON players.player_number=players_paid.player_number"; $query = mysql_query($query) or die(mysql_error());[/b] /*SELECT column_name(s) FROM table_name1 INNER JOIN table_name2 ON table_name1.column_name=table_name2.column_name*/ //echo "SELECT 1 FROM players_paid WHERE (((players_paid.player_number)="+str_replace("'","''",$rsNewPlayer__ssPlayerNumber)+") AND ((players_paid.paid_type)=1))"; ?> <html> <body> <?PHP echo $user; ?> <br> <?php echo $password; ?> <br> <?PHP while($rows=mysql_fetch_assoc($query)) { ?> <table width="100%" border="1"> <tr> <th scope="col"><?PHP echo $rows['paid_date'] ?></th> </tr> </table> <?PHP } ?> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/224499-undefined-index-and-selecting-max-date/ Share on other sites More sharing options...
requinix Posted January 15, 2011 Share Posted January 15, 2011 Select MAX(paid_date) as paidDate echo $rows['paid_date'] Compare what you do in the first with what you do in the second. Quote Link to comment https://forums.phpfreaks.com/topic/224499-undefined-index-and-selecting-max-date/#findComment-1159676 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.