Jump to content

[SOLVED] Upgraded to 5.1.29 connecting but not pulling info


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.

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.