Jump to content

[SOLVED] Upgraded to 5.1.29 connecting but not pulling info


west4me

Recommended Posts

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.