markvaughn2006
Members-
Posts
108 -
Joined
-
Last visited
Everything posted by markvaughn2006
-
I'm making a php game, ok..user gets attacked, I got it to set his "location" to "hospital" and I'm fine with the attacked person not knowing he has been attacked until he leaves the area that he was attacked in, I can't figure out how to restrict that persons actions while in the hospital when they do leave though... Basically here is an example, when you go to a location - Tavern, the php code sets your location to Tavern, but any suggestion on how to (when the attacked person goes to another location) check if location = "hospital" and then either redirect them to the hospital.php or at least echo -"You got your ass beat" and restrict their actions and movements until they are healed?? I appreciate all you guys help, not asking for actual code just a point in the right direction. Thanks!!
-
Click Submit - Updates DB and Refreshes IFrame??
markvaughn2006 replied to markvaughn2006's topic in PHP Coding Help
I'm don't really understand that.. Is there a simple refresh command? Ideally I would want to do it like this (assuming there is a refresh command named REFRESH) If there is an actual refresh command it would replace REFRESH in the example below.. <?php if ($item1 == "empty") { echo "Empty"; } else { echo '<form target="actions" method="post" action="equip.php"><input type="submit" value="Equip" />'.$row['item1'].'<input type="hidden" name="equip" value="'.$row['user_name'].'" /></form>'; REFRESH; } ?> Any idea?? Thanks!! -
How would I go about making an IFrame named Action refresh when a submit button is pressed?? Here is the code in question <?php if ($item1 == "empty") { echo "Empty"; } else { echo '<form target="actions" method="post" action="equip.php"><input type="submit" value="Equip" />'.$row['item1'].'<input type="hidden" name="equip" value="'.$row['user_name'].'" /></form>'; } ?> Thanks!!
-
[SOLVED] Add 1 to a field every day
markvaughn2006 replied to markvaughn2006's topic in PHP Coding Help
yep I'm wanting to know how many days the account has been active, the field name is date_first and the format of it is 16-09-2009. The field that will actually say how many days account has been active is called days_old. I did some research on DATEDIFF and thats exactly what I need, thanks for all your help!! -solved- -
[SOLVED] Add 1 to a field every day
markvaughn2006 replied to markvaughn2006's topic in PHP Coding Help
Thanks for the quick reply I would have to manually run this code every day though wouldn't I? UPDATE table SET days_old=days_old+1 The second one is a little over my head... -
I know this should be pretty simple...can't figure it out though. I have a field that tells how long a person has been a member, when they sign up it fills in the date that they joined, is there a way to add 1 to a days_old field each new day?? thanks!
-
I have a field that stores the date a character in this game was created and a days_old field, how would I go about adding 1 to that field each new day? Thanks a bunch!!
-
[SOLVED] echo "attack".$row['user_name'];
markvaughn2006 replied to markvaughn2006's topic in PHP Coding Help
boo-ya, thanks -
[SOLVED] echo "attack".$row['user_name'];
markvaughn2006 replied to markvaughn2006's topic in PHP Coding Help
Hey Ozestretch, thanks for the fast reply!! It's giving me an error though... Parse error: syntax error, unexpected T_VARIABLE, expecting ',' or ';' in /home/content/55/4878855/html/game/who/burgerqueentest.php on line 34 any idea? Thanks again! mjdamato- Each user has an ID and it is stored in a session variable, I'll check out your suggestion too, thanks for the quick replies! very helpful -
I'm making a game, and when you go to a location, you see a list of who else is there by this code... <?php $result = mysql_query("SELECT user_name FROM users_tbl WHERE location='Ye Olde Tavern'") or die(mysql_error()); while ($row = mysql_fetch_array($result)) { echo $row['user_name']; echo '<br />'; }?> So the result is something like : Bob Tom Sally Ed I want to display the names of who is there and also add next to it a "submit" button but with the caption "Attack" or something similar and when the Attack button is pressed next to Bob, it runs an attack.php that will automatically use "Bob" as the variable to be "attacked". So ideally the output would look something like... Bob (attack) Tom (attack) Sally (attack) Ed (attack) with the (attack) being a submit button. Any pointers as to how to make this happen? I greatly appreciate all of you guy's help!
-
I'm making a PHP/MySQL game where you can travel to different locations and there is PHP code that tells you who else is in the room with you but the problem is that if someone else enters the room you can not see them unless you refresh the page. Is there any way to use AJAX to constantly refresh only this small part of the page with the PHP code that is telling you who is there with you?? Thanks for any help!!!
-
[SOLVED] Refresh a Section of a .php page??
markvaughn2006 replied to markvaughn2006's topic in PHP Coding Help
cool, thanks Keith -
I'm making a PHP game where you go to different locations and you can see who else is there, but if someone else comes there you won't see them unless the page is refreshed.. Someone mentioned to me there is a PUSH thing, but I think thats a little out of my league, I would hate to set the whole page to refresh every 2 seconds, would there be a way just to refresh the part of the page that shows who else is there? If not is there a big problem with refreshing the page every 2 seconds? like server load or something? Thanks!!
-
Echo - Capitalize First Letter in name
markvaughn2006 replied to markvaughn2006's topic in PHP Coding Help
-
I've found that most people when registering their username use all lowercase letters, is there a way that if someone were to enter their username as - markvaughn2006 it would echo something like "Welcome Markvaughn2006" ? I know how to add the Welcome and the username, just wondering if there is a way to capitalize the first letter. Thanks you guys are the best.
-
Drop Down Box connected to $_POST, $_GET
markvaughn2006 replied to markvaughn2006's topic in PHP Coding Help
i love you -
Would there be a way to have a drop down box containing DB variables and someone could select one of those in the box and then it would store it in a variable and use it in a mySQL Query? Thanks for any help. I'm assuming that $_POST, $_GET would come into play here..
-
bump?
-
I'm making a php/mysql game where you can go to different locations and you will see others that are at the same location, but if someone comes into that location while you are there, you will not see them unless the page is refreshed, I could set the page to refresh every second or so, but that would probably bog the site down, is there a way to refresh the page only when a person enters that location (and updates their 'location' field in the DB )?? Thanks for any help!
-
While Loop (display all data in a column)
markvaughn2006 replied to markvaughn2006's topic in PHP Coding Help
awesome, thanks! -
I know this is simple, but all the while loop examples show you how to count to ten and then stop looping when it is greater than 10. I just need a while loop to display all data in a column and stop when it gets to the bottom. This is my jacked up attempt to display all usernames in the user_name column. Also how would I go about putting a <br> in between each echo? Thanks much! $result = mysql_query("SELECT user_name FROM users_tbl'") or die(mysql_error()); while $row = mysql_fetch_array( $result ); echo $row['user_name'];
-
PARTIALLY SOLVED :you are guys are great, but still have the problem that if you hit refresh it adds 100 gold every time, any idea how to prevent this? $result = mysql_query("SELECT * FROM users_tbl WHERE user_name='$_SESSION[myusername]'") or die(mysql_error()); $row = mysql_fetch_array( $result ); // Print out the contents of each row into a table $gold = $row['gold'] + '100'; mysql_query("UPDATE users_tbl SET gold = '$gold' WHERE user_name = '$_SESSION[myusername]' ");