TutorMe Posted November 9, 2007 Share Posted November 9, 2007 I have a script that generates an image dynamically from information in a mysql database. It works on my test server (mamp, php5, mysql5), but not on my actual server which is at one and one. Does anyone have any ideas as to why this would happen? I have changed the connection information to match my real server, but that's it. Any help is appreciated. Link to comment https://forums.phpfreaks.com/topic/76634-solved-code-works-but-doesnt/ Share on other sites More sharing options...
pocobueno1388 Posted November 9, 2007 Share Posted November 9, 2007 Post your code Link to comment https://forums.phpfreaks.com/topic/76634-solved-code-works-but-doesnt/#findComment-388019 Share on other sites More sharing options...
TutorMe Posted November 9, 2007 Author Share Posted November 9, 2007 <?php header("Content-type: image/png"); require_once('config.php'); mysql_select_db("bdays", $con); $result = mysql_query("SELECT * FROM January Union SELECT * FROM February Union SELECT * FROM March Union SELECT * FROM April Union SELECT * FROM May Union SELECT * FROM June Union SELECT * FROM July Union SELECT * FROM August Union SELECT * FROM September Union SELECT * FROM October Union SELECT * FROM November Union SELECT * FROM December"); while($row = mysql_fetch_array($result)) { if ($row['day'] == date('d') && ($row['month'] == date('F'))) $list = $row['username'] . " "; else $list = "Nobody has a birthday today."; } mysql_close($con); $string = $list; $im = imagecreatefrompng("bg.png"); $orange = imagecolorallocate($im, 89, 89, 89); $px = (imagesx($im) - 7.5 * strlen($string)) / 2; imagestring($im, 3, $px, 9, $string, $orange); imagepng($im); imagedestroy($im); ?> Here's where it is on my actual server: http://pschost.com/bdays/av.png/copy.php Link to comment https://forums.phpfreaks.com/topic/76634-solved-code-works-but-doesnt/#findComment-388021 Share on other sites More sharing options...
TutorMe Posted November 9, 2007 Author Share Posted November 9, 2007 *Bump* Link to comment https://forums.phpfreaks.com/topic/76634-solved-code-works-but-doesnt/#findComment-388068 Share on other sites More sharing options...
TutorMe Posted November 9, 2007 Author Share Posted November 9, 2007 Sorry to bump again, I just can't figure this out. Any ideas? Link to comment https://forums.phpfreaks.com/topic/76634-solved-code-works-but-doesnt/#findComment-388164 Share on other sites More sharing options...
Barand Posted November 9, 2007 Share Posted November 9, 2007 Describe "doesn't work" It might give us a clue about what we are looking for Link to comment https://forums.phpfreaks.com/topic/76634-solved-code-works-but-doesnt/#findComment-388181 Share on other sites More sharing options...
TutorMe Posted November 9, 2007 Author Share Posted November 9, 2007 It's like it won't read from the mysql database. What it should show is the username who has a birthday that day, but even when a user has a birthday, it shows "Nobady has a birthday today." I don't have this problem on the test server though. Link to comment https://forums.phpfreaks.com/topic/76634-solved-code-works-but-doesnt/#findComment-388217 Share on other sites More sharing options...
Daukan Posted November 9, 2007 Share Posted November 9, 2007 Put error_reporting(E_ALL); At the top of your script and see if any errors are being generated. Link to comment https://forums.phpfreaks.com/topic/76634-solved-code-works-but-doesnt/#findComment-388219 Share on other sites More sharing options...
TutorMe Posted November 9, 2007 Author Share Posted November 9, 2007 It didn't show any errors. Link to comment https://forums.phpfreaks.com/topic/76634-solved-code-works-but-doesnt/#findComment-388222 Share on other sites More sharing options...
Daukan Posted November 9, 2007 Share Posted November 9, 2007 Copy the sql into phpmyadmin and see if pulls any data out Link to comment https://forums.phpfreaks.com/topic/76634-solved-code-works-but-doesnt/#findComment-388224 Share on other sites More sharing options...
Barand Posted November 9, 2007 Share Posted November 9, 2007 I'm having a problem seeing how it works on any server. Suppose you have 100 records and the first 99 match but the last one doesn't. On that last one, $list becomes "Nobody has a birthday today." no matter what was in there before. Link to comment https://forums.phpfreaks.com/topic/76634-solved-code-works-but-doesnt/#findComment-388230 Share on other sites More sharing options...
TutorMe Posted November 9, 2007 Author Share Posted November 9, 2007 Is there something I could change in my code to make it not do that? Link to comment https://forums.phpfreaks.com/topic/76634-solved-code-works-but-doesnt/#findComment-388245 Share on other sites More sharing options...
Barand Posted November 9, 2007 Share Posted November 9, 2007 <?php while($row = mysql_fetch_array($result)) { if ($row['day'] == date('d') && ($row['month'] == date('F'))) $list .= $row['username'] . " "; } if ($list == '') $list = "Nobody has a birthday today."; PS Why 12 tables? Link to comment https://forums.phpfreaks.com/topic/76634-solved-code-works-but-doesnt/#findComment-388247 Share on other sites More sharing options...
TutorMe Posted November 9, 2007 Author Share Posted November 9, 2007 That worked perfectly. Thanks alot. I'm still not sure why it worked on my test server. lol But thanks for your help. Link to comment https://forums.phpfreaks.com/topic/76634-solved-code-works-but-doesnt/#findComment-388250 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.