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. 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? 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` 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()); 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. 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
Archived
This topic is now archived and is closed to further replies.