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. Quote Link to comment Share on other sites More sharing options...
pocobueno1388 Posted November 9, 2007 Share Posted November 9, 2007 Post your code Quote Link to comment 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 Quote Link to comment Share on other sites More sharing options...
TutorMe Posted November 9, 2007 Author Share Posted November 9, 2007 *Bump* Quote Link to comment 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? Quote Link to comment 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 Quote Link to comment 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. Quote Link to comment 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. Quote Link to comment Share on other sites More sharing options...
TutorMe Posted November 9, 2007 Author Share Posted November 9, 2007 It didn't show any errors. Quote Link to comment 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 Quote Link to comment 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. Quote Link to comment 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? Quote Link to comment 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? Quote Link to comment 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. Quote Link to comment 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.