Petty_Crim Posted August 17, 2007 Share Posted August 17, 2007 $get_matches=mysql_query("SELECT matches.match_id, matches.game, matches.opponent, matches.map, DATE_FORMAT(`matches.date`, '%d/%c/%y') AS 'matches.date', matches.time, players.player_id, players.match_id FROM matches, players WHERE matches.match_id = players.match_id AND players.player_id='$player_id' AND matches.game='$game'") OR die(' ERROR GETTING TOTAL $game MATCHES ' . mysql_error()); Basically I'm trying to format a date column from the american style date format into the european one, but for some reason its not working. I've got it working in non join statements but I don't know how to do it in a join statement. Quote Link to comment https://forums.phpfreaks.com/topic/65447-solved-date-format-in-join-statement/ Share on other sites More sharing options...
Petty_Crim Posted August 18, 2007 Author Share Posted August 18, 2007 Anyone know? Quote Link to comment https://forums.phpfreaks.com/topic/65447-solved-date-format-in-join-statement/#findComment-327368 Share on other sites More sharing options...
jitesh Posted August 18, 2007 Share Posted August 18, 2007 What error are you getting ? test : For AS matches.date remove quatation (') : AS 'matches.date' and place (`) : AS `matches.date` Quote Link to comment https://forums.phpfreaks.com/topic/65447-solved-date-format-in-join-statement/#findComment-327370 Share on other sites More sharing options...
mmarif4u Posted August 18, 2007 Share Posted August 18, 2007 $get_matches=mysql_query("SELECT matches.match_id, matches.game, matches.opponent, matches.map, DATE_FORMAT(`matches.date`, '%d/%c/%y') AS 'matches.date', matches.time, players.player_id, players.match_id FROM matches, players WHERE matches.match_id = players.match_id AND players.player_id='$player_id' AND matches.game='$game'") OR die(' ERROR GETTING TOTAL $game MATCHES ' . mysql_error()); Basically I'm trying to format a date column from the american style date format into the european one, but for some reason its not working. I've got it working in non join statements but I don't know how to do it in a join statement. try ur query like this: $get_matches=mysql_query("SELECT matches.match_id, matches.game, matches.opponent, matches.map,DATE_FORMAT(`matches.date`, '%d/%c/%y') AS formatted_date, matches.time, players.player_id, players.match_id FROM matches, players WHERE matches.match_id = players.match_id AND players.player_id='$player_id' AND matches.game='$game'") OR die(' ERROR GETTING TOTAL $game MATCHES ' . mysql_error()); Quote Link to comment https://forums.phpfreaks.com/topic/65447-solved-date-format-in-join-statement/#findComment-327371 Share on other sites More sharing options...
Petty_Crim Posted August 18, 2007 Author Share Posted August 18, 2007 Thx for the help but neither of those two methods worked. After testing a few different things I just did: $get_matches=mysql_query("SELECT matches.match_id, matches.game, matches.opponent, matches.map, DATE_FORMAT(`date`, '%d/%c/%y') AS 'date', matches.time, players.player_id, players.match_id FROM matches, players WHERE matches.match_id = players.match_id AND players.player_id='$player_id' AND matches.game='$game'") OR die(' ERROR GETTING TOTAL $game MATCHES ' . mysql_error()); This worked and for some reason I didn't have to refer to the table ie matches.date if I did that it wouldn't work but just the field by itself does. Quote Link to comment https://forums.phpfreaks.com/topic/65447-solved-date-format-in-join-statement/#findComment-327380 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.