west4me Posted December 4, 2008 Share Posted December 4, 2008 My school recently updated our mysql to 5.1.29 and to PHP 5.2.6 Now a script that someone wrote for me no longer works. The connection is made but nothing is being populated to the page. Here is the script: <?php mysql_connect('localhost', 'username', 'password') or die(mysql_error()); mysql_select_db('tablename') or die(mysql_error()); function getName($table = 'names', $date = '') { $date = empty($date) ? date('Y-m-d') : $date; $day = date('z', strtotime($date)); $x = mysql_query("SELECT * FROM $table ORDER BY id"); $names = array(); while ($n = mysql_fetch_array($x)) $names[] = $n['name']; for ($x = 0; $x < $day; $x++) { $fname = array_shift($names); $names[] = $fname; } return $names[1]; } $male = getName('male'); $female = getName('female'); $manager = getName(); ?> Then in the html this is where the "name" gets put <h1><?= $manager; ?></h1> All the html displays and there are no connection errors. You can see the page here: http://www.hallsville.org/elementary/cunningham/moodle/daily/ I use this in my classroom everyday and it is driving me nuts. I have tried figuring it out but I am stuck. Any help would be appreciated. Quote Link to comment https://forums.phpfreaks.com/topic/135532-solved-upgraded-to-5129-connecting-but-not-pulling-info/ Share on other sites More sharing options...
Mchl Posted December 4, 2008 Share Posted December 4, 2008 Check if short tags are enabled in php.ini (Hint, you should not use short tags at all: change <?= $manager; ?> to <?php echo $manager; ?> ) Quote Link to comment https://forums.phpfreaks.com/topic/135532-solved-upgraded-to-5129-connecting-but-not-pulling-info/#findComment-706034 Share on other sites More sharing options...
west4me Posted December 4, 2008 Author Share Posted December 4, 2008 That did the trick. I replaced the short tags and all is well. Thank you. Quote Link to comment https://forums.phpfreaks.com/topic/135532-solved-upgraded-to-5129-connecting-but-not-pulling-info/#findComment-706084 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.