Jump to content
MakeWebGames

need little help on database sql


Nicholas

Recommended Posts

hi im trying to create a new mod but i require little help on the sql, what im trying to do is create new database table but with different effect...

what it does is say i create table saying:

catcher (eg. announcements)

and in that table there is sections saying:

userid

throws

catches

fails

NOTE: these are just an example, its nothing to do with the mod im gonna try make.

how can i set it up so there is the same amount of catagories as the users tables, so every user in the game has a slot

if you understand what i mean... i cant think of how to explain it :(

if you understand and can help me on the script or whatever is required to insert the information into the database section it be very greatful

NOTE: can you use the example table and catagories and ill change the information to create the table i need

i havnt though of the table names and etc yet why im using an example.

thanks Nicholas.

Link to comment
Share on other sites

there was a script out there that selects how many users you got in the game and then inserts information into the new table automaticly

i dont want to do

INSERT INTO `blah` (`userid` ,`blah` ,`blah` ,`blah`) VALUES ('1', '0', '0', '0');

INSERT INTO `blah` (`userid` ,`blah` ,`blah` ,`blah`) VALUES ('2', '0', '0', '0');

INSERT INTO `blah` (`userid` ,`blah` ,`blah` ,`blah`) VALUES ('3', '0', '0', '0');

INSERT INTO `blah` (`userid` ,`blah` ,`blah` ,`blah`) VALUES ('4', '0', '0', '0');

over 1000 times. thats just long lol, there was a script that does it all for you in secounds

but i cant think of how to create that script.

Link to comment
Share on other sites

think so. can anyone help me create this modification script?

this probably wouldnt work (wrote it on here) but maybe you find out what i mean...

<?php

$collect = mysql_query("SELECT `userid` FROM `users`");

$userid = mysql_fetch_array($collect);

INSERT INTO `ballplayer` (`userid` ,`balls` ,`throws` ,`hits`, `misses`) VALUES ('$userid', '0', '0', '0', '0');

?>

and say i have 40 users on my game, would it insert into table "ballplayer" like this?

INSERT INTO `ballplayer` (`userid` ,`balls` ,`throws` ,`hits`, `misses`) VALUES ('1', '0', '0', '0', '0');

INSERT INTO `ballplayer` (`userid` ,`balls` ,`throws` ,`hits`, `misses`) VALUES ('2', '0', '0', '0', '0');

INSERT INTO `ballplayer` (`userid` ,`balls` ,`throws` ,`hits`, `misses`) VALUES ('3', '0', '0', '0', '0');

INSERT INTO `ballplayer` (`userid` ,`balls` ,`throws` ,`hits`, `misses`) VALUES ('4', '0', '0', '0', '0');

INSERT INTO `ballplayer` (`userid` ,`balls` ,`throws` ,`hits`, `misses`) VALUES ('5', '0', '0', '0', '0');

so on upto

INSERT INTO `ballplayer` (`userid` ,`balls` ,`throws` ,`hits`, `misses`) VALUES ('40', '0', '0', '0', '0');

then stop? and everyone in the game have their own personal section on that table.

as the mod im gonna try and create uses a lot of sections in the table and i dont want to put it all in users table.

NOTE: thats just an example table lol. could come up with a mod for this table information i just put here. lol.

Link to comment
Share on other sites

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.   Paste as plain text instead

  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...