Jump to content

Simple counter and list of registered users?


Jest

Recommended Posts

Hi everyone, I am new to PHP and am trying to add it into my website.  I have a form to sign up for registration for an event and need a counter of all people to register and a list of registered people. 

 

This counter from the PHP Code Library is the one I want to use.

 
$file = "counter.txt";
if ( !file_exists($file)){
       touch ($file);
       $handle = fopen ($file, 'r+');
       $count = 0;
}
else{
       $handle = fopen ($file, 'r+');
       $count = fread ($handle, filesize ($file));
       settype ($count,"integer");
}

rewind ($handle); 
fwrite ($handle, ++$count);
fclose ($handle);
}   

 

The other thing I need is similar.  When someone registers I add their name to a txt, sorted into alphabetical order.  Can anyone help me out with this?

I don't know anything about Databases.  I do have access to a MySQL database though.  Any ideas?

 

if you're going to get into php, you need to get into mysql (or a database of some persuasion).

 

my suggestion is to start here:

w3schools php, tizag php, tizag mysql, php/mysql tutorial, freewebmasterhelp... and of course the manual.

 

that should get you goin.

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.