Jump to content

[SOLVED] Code works, but doesn't.


TutorMe

Recommended Posts

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
Share on other sites

<?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
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.