School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!

Welcome to Dream.In.Code
Become an Expert!

Join 300,443 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,522 people online right now. Registration is fast and FREE... Join Now!




php football game

 

php football game

jens121

1 Jul, 2009 - 08:39 AM
Post #1

New D.I.C Head
*

Joined: 27 Jun, 2009
Posts: 11

Hej hej im hard working to become very good in php and i really want to make something like www.hattrick.org like i said before but i am thinking thinking so hard but cant script it for so far...
So i want to start with basics of making this game then like :
When you register a user he will become in table users and you can login then with the user information then when you Login! that user will get 15players from the table : Players ... so 1 user from table users will get 15 players from that table players but i know how to get the information from my table players into a page but dont know how to put 15 random players from my table players into 1 user and the 15 players need to stay in that user then! and when someone else registers that user will get also 15 different players ... so i will make a great table where are much players in it but dont know how to give a user those 15 random players then and keep them can someone plz help me or is someone intrested to make a game like this with me ?

User is offlineProfile CardPM
+Quote Post


modi123_1

RE: Php Football Game

1 Jul, 2009 - 10:46 AM
Post #2

Suiter #2
Group Icon

Joined: 12 Jun, 2008
Posts: 1,760



Thanked: 72 times
Dream Kudos: 150
My Contributions
You just outlined some pretty basic php - database interaction.

User logs in - their info goes into a table.

When they start up and want a game make another database call that randomly selects 15 users and return that data to the form.

When the stored procedure makes that call you would probably want to mark a bit column to indicate they are being "used" and not to be used by another user.
User is offlineProfile CardPM
+Quote Post

jens121

RE: Php Football Game

1 Jul, 2009 - 11:37 AM
Post #3

New D.I.C Head
*

Joined: 27 Jun, 2009
Posts: 11

QUOTE(modi123_1 @ 1 Jul, 2009 - 10:46 AM) *

You just outlined some pretty basic php - database interaction.

User logs in - their info goes into a table.

When they start up and want a game make another database call that randomly selects 15 users and return that data to the form.

When the stored procedure makes that call you would probably want to mark a bit column to indicate they are being "used" and not to be used by another user.

thanks for replying but i know how to think about it and how it would be but dont know how to put it in script

<?php
$con = mysql_connect("localhost","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}

mysql_select_db("db_name", $con);

$result = mysql_query("SELECT * FROM players");

while($row = mysql_fetch_array($result))
{
echo $row['username'] . " " . $row['password'];
echo "<br />";
}

mysql_close($con);
?>
with that you can get the list from the table from the database 'players'
but how to put 15 random players in a user when he logs in plz can someone give script so i could understand
User is offlineProfile CardPM
+Quote Post

modi123_1

RE: Php Football Game

1 Jul, 2009 - 12:27 PM
Post #4

Suiter #2
Group Icon

Joined: 12 Jun, 2008
Posts: 1,760



Thanked: 72 times
Dream Kudos: 150
My Contributions
I would suggest making a stored procedure so the statement is on the Database. So that means stop using the script and learn how to write a MySQL stored procedure, call it from PHP, and then get the data back out.

Here's a page off MySQL about the 'rand' function.
http://dev.mysql.com/doc/refman/5.0/en/mat...l#function_rand

There are tons of information there about writing a stored procedure.

Google just showed how to 'call mysql stored procedure from php'/

This post has been edited by modi123_1: 1 Jul, 2009 - 12:28 PM
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic

Time is now: 11/8/09 01:28AM

Live Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month