Renegade Public Forums
C&C: Renegade --> Dying since 2003™, resurrected in 2024!
Home » Renegade Discussions » Mod Forum » database type script
Re: database type script [message #231116 is a reply to message #231091] Sun, 19 November 2006 03:59 Go to previous messageGo to previous message
danpaul88 is currently offline  danpaul88
Messages: 5795
Registered: June 2004
Location: England
Karma:
General (5 Stars)
I assume your talking about phprenbot here?



Anyway, assuming your using PHP with a MySQL database, and ignoring the connection to the database code.

Code to increment a counter each time a name is seen.. code is case-insensitive.

$playerNameQuery = mysql_query ( "SELECT * FROM players WHERE LOWER(name) = \"" . lc($playerName) . "\"" );

if ( mysql_num_rows ( $playerNameQuery ) > 0 )
{
  $playerData = mysql_fetch_assoc ( $playerNameQuery );
  mysql_query ( "UPDATE players SET timesSeen = (timeSeen+1) WHERE name = \"" . $playerData['name'] . "\"" );
}
else
{
  mysql_query ( "INSERT INTO players ( name, timeSeen ) VALUES ( \"" . lc($playerName) . "\", 1, )" );
}


http://steamsignature.com/card/1/76561197975867233.png
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: My new map issues
Next Topic: More animation help
Goto Forum:
  


Current Time: Mon Dec 02 14:34:45 MST 2024

Total time taken to generate the page: 0.00624 seconds