Jump to content

Random Name from mysql


west4me

Recommended Posts

I am a teacher and I try to keep my class as un-biased as possible. To help me do this I draw random student names from a script. My problem is, I would like to do this with ajax so it is faster, I wouldn't have to wait on the page to reload each time.

I have been searching for something that I could use but can't find anything.

I have a mysql database that holds my students names for another script and I was wondering if someone could help me make an ajax script that would pull a random name from the database.
Link to comment
Share on other sites

Unless the web page is really big, I dont think you're going to see much improvement by using ajax.  Your time may be better spent determining why a page refresh is taking so long.  Have you run explain on your SQL?

If you're sure that ajax will help you, then we'll need to know what framework you are using, or what language you have on the server.  Please provide an overview of your environment.
Link to comment
Share on other sites

The current script I am running does not pull from the database for the names. You can see what I am using here: [url=http://cunninghamclassroom.com/daily/name.php]http://cunninghamclassroom.com/daily/name.php[/url]

I am on a hosted server and I am not very familiar with the environment. This is what it says in my server information that is provided.

operating system

FreeBSD 4.11-STABLE
mysql version

mysql Ver 12.22 Distrib 4.0.16
perl version

perl, v5.8.3
php version

PHP 4.4.1

Is that what you need?
Link to comment
Share on other sites

How are the names populated in the names.php webpage?  PHP might be pulling them from MySQL, but that is irrelevant at this point.

Ajax would be overkill for your application.  All you need is to wrap your random selector in a javascript function and then add the function name as an onclick event for a button or function key (I would suggest something other than f5 since that is the standard browser refresh button).  You could also do something fancy like making a mouseover event on the name, so all you would do is swipe over the name and it would change.

Do you have update access to names.php on the server?  If so, you can email it to me and I can take a gander. 

PS - Since you dont need Ajax, your post might be off topic.  I'm new on this forum so I dont know how strictly it's moderated.  Make a note of my email address in case this thread is removed.
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.