ondi Posted August 13, 2008 Share Posted August 13, 2008 I have been through this code, and there doesn't seem to be any errors, but it still does not print anything. There is data which it should be printed in my database. Could anyone have a look? Cheers session_start(); include('admin/user.php'); $connection = mysql_connect("$host","$user","$password") or die(mysql_error()); mysql_select_db("$txt_db_name",$connection) or die(mysql_error()); // //Includes preferences // $pref = mysql_query("SELECT * FROM tplls_preferences WHERE ID = '1'",$connection) or die(mysql_error()); $pdata = mysql_fetch_array($pref); mysql_free_result($pref); $team_name = $pdata['teamname']; $d_seasonid = $pdata['defaultseasonid']; $show_all_or_one = $pdata['defaultshow']; $show_table = $pdata['defaulttable']; $language = $pdata['defaultlanguage']; $for_win = $pdata['forwin']; $for_draw = $pdata['fordraw']; $for_lose = $pdata['forloss']; $print_date = $pdata['printdate']; $top_bg = $pdata['topoftable']; $bg1 = $pdata['bg1']; $bg2 = $pdata['bg2']; $inside_c = $pdata['inside']; $border_c = $pdata['bordercolour']; $tb_width = $pdata['tablewidth']; $accept_ml = $pdata['acceptmultilanguage']; ?> <?php $get_matches = mysql_query(" SELECT O.OpponentName AS hometeam, OP.OpponentName AS awayteam, LM.LeagueMatchHomeGoals AS goals_home, LM.LeagueMatchAwayGoals AS goals_away, LM.LeagueMatchID AS id, DATE_FORMAT(LM.LeagueMatchDate, '$print_date') AS date FROM tplls_leaguematches LM, tplls_opponents O, tplls_opponents OP WHERE O.OpponentID = LM.LeagueMatchHomeID AND OP.OpponentID = LM.LeagueMatchAwayID AND LeagueMatchSeasonID LIKE '$defaultseasonid' AND LM.LeagueMatchHomeGoals IS NOT NULL ORDER BY LM.LeagueMatchDate DESC",$connection) or die(mysql_error()); $i=0; while($data = mysql_fetch_array($get_matches)) { if($i==0) { $temp = $data['date']; } if($temp == $data['date']) { //print match } else { break; } $i++; } ?> Link to comment https://forums.phpfreaks.com/topic/119482-code-prints-nothing/ Share on other sites More sharing options...
Dragoa Posted August 13, 2008 Share Posted August 13, 2008 In the code you posted the print line is commented out. Link to comment https://forums.phpfreaks.com/topic/119482-code-prints-nothing/#findComment-615513 Share on other sites More sharing options...
ondi Posted August 13, 2008 Author Share Posted August 13, 2008 Humm, i changed it so the print part is now $i=0; while($data = mysql_fetch_array($get_matches)) { if($i == 0) { $temp = $data['date']; } if($data['date'] == $temp) { //print match echo"$data[hometeam] - $data[awayteam] $data[goals_home]-$data[goals_away]<br>"; } else { break; } $i++; } but still nothing is printed Link to comment https://forums.phpfreaks.com/topic/119482-code-prints-nothing/#findComment-615517 Share on other sites More sharing options...
adam84 Posted August 13, 2008 Share Posted August 13, 2008 $i=0; while($data = mysql_fetch_array($get_matches)) { if($i == 0) { $temp = $data['date']; } if($data['date'] == $temp) { //print match echo"$data[hometeam] - $data[awayteam] $data[goals_home]-$data[goals_away]<br>"; } else { break; } $i++; } but still nothing is printed This is just an idea on what you need to do. I do not know what you were doing. echo $data['hometeam'] ." - ". $data['awayteam'] . " " . $data['goals_home'] ." - " . $data['goals_away'] . "<br>"; Link to comment https://forums.phpfreaks.com/topic/119482-code-prints-nothing/#findComment-615520 Share on other sites More sharing options...
ondi Posted August 13, 2008 Author Share Posted August 13, 2008 thanks for the try adam84, but still nothing prints! http://www.walthamforest-fc.co.uk/leaguestats/minifixtures2.php Link to comment https://forums.phpfreaks.com/topic/119482-code-prints-nothing/#findComment-615526 Share on other sites More sharing options...
revraz Posted August 13, 2008 Share Posted August 13, 2008 If nothing prints it's usually one of two things. 1. There is no data in your variables. 2. There is a error in your code and you don't have error display turned on. Link to comment https://forums.phpfreaks.com/topic/119482-code-prints-nothing/#findComment-615530 Share on other sites More sharing options...
Dragoa Posted August 13, 2008 Share Posted August 13, 2008 Taking a look at the HTML source in the page you've posted, it looks malformed since your closing 3 tables that you never open. Looks like there might be a problem earlier up in the page that's causing this. Your Generate HTML: </table> </td> </tr> </table> </td> </tr> </table> </body> </html> Link to comment https://forums.phpfreaks.com/topic/119482-code-prints-nothing/#findComment-615587 Share on other sites More sharing options...
adam84 Posted August 13, 2008 Share Posted August 13, 2008 Yea man, something else is giving you a problem. Link to comment https://forums.phpfreaks.com/topic/119482-code-prints-nothing/#findComment-615610 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.