Jump to content

please help with php mysql game math functions


Jiraiya

Recommended Posts

i want a to have a fighting like system in the game i am making. like in the mysql table

there are npc enemys for players to fight against to train there characters. the npc enemys have preset health Skill(what is used to determine strength basically its just subtracting the skill from the enemys health and keep doing that until the one of them dies by having there health reach zero. and when a player kills a npc enemy i want the player to gain a set amount of "skill" points and cash to add to there character profiles.

Don't post the question twice please. It keeps from having all relevant information and responses in the same area.

 

In your other post you asked how to use SELECT, ALTER, and UPDATE

 

Sounds like you need to learn the basics of MySql before you can tackle this project.

<?php
$result = mysql_query("SELECT * FROM users WHERE username = 'bob'");
$numUsers = mysql_num_rows($result);

echo 'there are '. $numUsers.' named bob';

$result = mysql_query("UPDATE users SET city='Miami' WHERE username='bob'");
$affected = mysql_affected_rows();

echo 'Updated '.$affected.' row(s)';

$result = mysql_query("ALTER TABLE userId AUTO_INCREMENT = '0'";
?>

 

that is the basics of how to use them. Get a book or find an online tutorial and happy learning.

 

Nate

 

 

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.