apw
-
Posts
96 -
Joined
-
Last visited
Posts posted by apw
-
-
Hello I'm trying to pull just certin information from my km_switch
table such as ONLY the information in the default column that
has a Y in its column .. is this possible?
Also is it possible to use php to ADD new field to my km_switch
table ..
Adding it
ALTER TABLE `km_switch` ADD `test2` VARCHAR( 1 ) NOT NULL ;
Code the SQL gives me in php (which errors when place into a php
document.
$sql = 'ALTER TABLE `km_switch` ADD `test2` VARCHAR(1) NOT NULL;';
Thanks
-
Hello,
my php website is a free link directory similar to dmoz directory. My website uses templates to handle the content but my question is i want to add meta-tags and other content to get my website seo ready .. Is this possible with templates?
-
Hello, i have a general link directory that i am looking for a general overview of the website as well as a security test.
-
Dang ok .. What would be another way of doing this use the php time/date .. ?
-
Hello i have a cron time running and executing my php script every x-minutes but is there a way i can have a php script actually tell me how much time is left before the script runs
-
The fields in the km_user table are which handles the login info for players! id, empirename(username) and password the presource table, which handles what resources the player has are: id, empirename(wasnt sure if this was necessary), food and wood. What im trying to do is keep everything seperated and not confusing and jumbled into one large table.
-
Hello i am woundering about how to correctly join one or more tables together. The tables in question would be my km_user and presource tables. The field theses tables have in common would be the ID that is given to then when player registers. Ive read through the tutorial about this topic on this website but am still lost so any help would be appreciated.
-
Then what would be the easies, most effective way to fix the problem using the info in the labor.php and peasants2labor.php
-
The error message was the following: could not get user stats: near 'where id='16'' at line 1
-
Hello my question is about using #include statement. I wrote a php/sql internet based search engine. The main search is located in x.php and my main portion of my website is located in the trusty index.php now without copy and pasting the contents of x.php could i instead cal l the contents of x .php using an #include x.php? And the contents of x.php show where i have the #include for x.php?
-
Thank-you for the help i will read more into how to joim my tables together
-
The userid field will carryover the players id# across every table i create without having to carryover the players login name?
-
My question is regarding info that should either be in a single table database or multiple tables. The data that will be in this or these tables is data that my web-game uses to handle player information. For example one table called pfile handles the basic login info and a few starting stats. As the player plays he will gain new technologies, new buildings, units, etc. My question is with so much info that will be processed and needed is it smart and wise to push this into one table or expand and have multiple tables for each technology, unit, resource, etc. And how would i link this info together so nothing goes wrong?
-
Hello
I'm interested in comparing two times .. from when the member submits a form, the process should start, stamping the exact time from when the member submitted the form to exactly 5-minutes (300 sceonds) afterwards, which then SQL UPDATE should update my database ..
However, after hours of trying (and pulling what hair I have left on my head is pulled out) I still cannot get the script to work correctly.
Could I get an example of the time to time compare with the 5-minute increase?
Some problems I ran into also is if the member doesn't click any links, then the time isn't compared so I tried adding the faulty time compare time script to each and every link so the times would be compared .. unless anyone could think of another, more simple way of doing this without using cron.
Thanks
-
Yes that has been changed yet still the script doesnt execute and print the right result .. Is the portion above the sql_query correct with peasan=peasant-'$lesspeasant' and so forth?
-
Hello ive got inspired to "write and create" an online game where players run their own empires, manage resources and build grand armies to attack others! While this looks great on paper and sounds great after spending months seaching for a programming language to start work its been narrowed down to php/sql and flash. The game is browser based so no download required but what do you think? Im looking more towards my possible gamer audiance to bring them a fun, yet challenge
-
Hello
I'm working on a script that handles the form add, subtracts and even multiplies the variables and queries the SQL.
When player registers, the player receives the following:
* 100 peasants
* 0 labor
* 0 manpower
The script changes the players number of peasants to labor .. when player changes the labor amount, the player
also receives 2-points per labor receives:
Please check over the script, the peasants, labor and manpower isn't changing...
ajobs.php (form action handle)
<?php
if ($userstats3[peasants]<=0)
{
print "Not enough peasants";
}
else
{
print "You have $userstats3[peasants] peasants available!<br>";
print "<form action='ajob.php' method='post'>";
print "<input type='text' name='lesspeasant' size='5'><br>";
print "<input type='submit' name='submit' value='Change'></form>";
}
?>
[/code]from ajob.php (handles the query with math)
<?php include 'connect.php'; session_start(); ?> <link rel="stylesheet" href="style.css" type="text/css"> <?php if (isset($_SESSION['player'])) { $player=$_SESSION['player']; $userstats="SELECT * from km_users where playername='$player'"; $userstats2=mysql_query($userstats) or die("Could not get user stats"); $userstats3=mysql_fetch_array($userstats2); if(isset($_POST['submit'])) { $lesspeasant=$_POST['lesspeasant']; $lesspeasant=strip_tags($lesspeasant); $lesslaboe=$_POST['lesslabor']; $lesslabor=strip_tags($lesslabor); print "<center>"; print "<table class='maintable'>"; print "<tr class='headline'><td><center>Buy Science</center></td></tr>"; print "<tr class='mainrow'><td>"; if($peasant<0) { print "You cannot change, not enough peasants!. Back to <A href='index.php'>Main</a>"; } else if($userstats3[playerturns]<1) { die("You must have at least 1 turn to Change. Go back to <A href='index.php'>Main</a>"); } $lesspeasants=$userstats3[peasants]; $lesspeasant=$userstats3[peasants]-$lesspeasant; $lesslabor=$lesspeasant; $userstats3[labor]=$lesspeasant; $userstats3[labor]*2; $updatestats="update km_users set peasants=peasants-'$lesspeasant', playerturns=playerturns-1 where ID='$userstats3[iD]'"; mysql_query($updatestats) or die("Could not update stats"); print "You Changed $lesspeasant peasants to labor and have $manpower manpower and $userstats3[labor] laborers! Back to <A href='index.php'>Main Page</a>"; } print "</td></tr></table>"; } else { print "Sorry, not logged in please <A href='login.php'>Login</a><br>"; } ?>
-
Hello
I'm working on a script that handles the form add, subtracts and even multiplies the variables and queries the SQL.
When player registers, the player receives the following:
* 100 peasants
* 0 labor
* 0 manpower
The script changes the players number of peasants to labor .. when player changes the labor amount, the player
also receives 2-points per labor receives:
Please check over the script, the peasants, labor and manpower isn't changing...
ajobs.php (form action handle)
<?php
if ($userstats3[peasants]<=0)
{
print "Not enough peasants";
}
else
{
print "You have $userstats3[peasants] peasants available!<br>";
print "<form action='ajob.php' method='post'>";
print "<input type='text' name='lesspeasant' size='5'><br>";
print "<input type='submit' name='submit' value='Change'></form>";
}
?>
from ajob.php
<?php include 'connect.php'; session_start(); ?> <link rel="stylesheet" href="style.css" type="text/css"> <?php if (isset($_SESSION['player'])) { $player=$_SESSION['player']; $userstats="SELECT * from km_users where playername='$player'"; $userstats2=mysql_query($userstats) or die("Could not get user stats"); $userstats3=mysql_fetch_array($userstats2); if(isset($_POST['submit'])) { $lesspeasant=$_POST['lesspeasant']; $lesspeasant=strip_tags($lesspeasant); $lesslaboe=$_POST['lesslabor']; $lesslabor=strip_tags($lesslabor); print "<center>"; print "<table class='maintable'>"; print "<tr class='headline'><td><center>Buy Science</center></td></tr>"; print "<tr class='mainrow'><td>"; if($peasant<0) { print "You cannot change, not enough peasants!. Back to <A href='index.php'>Main</a>"; } else if($userstats3[playerturns]<1) { die("You must have at least 1 turn to Change. Go back to <A href='index.php'>Main</a>"); } $lesspeasants=$userstats3[peasants]; $lesspeasant=$userstats3[peasants]-$lesspeasant; $lesslabor=$lesspeasant; $userstats3[labor]=$lesspeasant; $userstats3[labor]*2; $updatestats="update km_users set peasants=peasants-'$lesspeasant', playerturns=playerturns-1 where ID='$userstats3[iD]'"; mysql_query($updatestats) or die("Could not update stats"); print "You Changed $lesspeasant peasants to labor and have $manpower manpower and $userstats3[labor] laborers! Back to <A href='index.php'>Main Page</a>"; } print "</td></tr></table>"; } else { print "Sorry, not logged in please <A href='login.php'>Login</a><br>"; } ?>
-
Hello again .. My question and problem is with handling forms. Most input with formr in my game deals with numbers but if i gets a player who wants to be funny and starts putting letters or even numbers and letters or other odd stray characters that doesnt belong how do i tell the code to handle this? I have strip_tags already in place and when decimals are used the form rounds. Thanks
-
My apologies for the copy and paste with the provided source, the mouse didnt copy that portion and didnt catch the mistake when i read over the post. As for the question, did i do the correct format for the change from peasants to labor, take the turn away from the player and had the right math figure for manpower when each labor is worth 2points of manpower?
-
Hello,
I'm trying to work code for my game. The oject for the code is for the player to change their peasants, which at the start of the game, receive 100, along with 0 labor, 1,000 units of food and 50 turns.
The code below is for the form to allow players to change their peasants to labor:
<?php if ($userstats3[peasants]<=0) { print "Not enough peasants"; } else { print "You have $userstats3[peasants] peasants available!<br>"; print "<form action='ajob.php' method='post'>"; print "<input type='text' name='lesspeasant' size='5'><br>"; print "<input type='submit' name='submit' value='Change'></form>"; } ?>
The code below is suppose to process the form from ajobs.php and make changes to the database!
<?php include 'connect.php'; session_start(); ?> <link rel="stylesheet" href="style.css" type="text/css"> <?php if (isset($_SESSION['player'])) { $player=$_SESSION['player']; $userstats="SELECT * from pfile where playername='$player'"; $userstats2=mysql_query($userstats) or die("Could not get user stats"); $userstats3=mysql_fetch_array($userstats2); if(isset($_POST['submit'])) { $lesspeasant=$_POST['lesspeasant']; $lesspeasant=strip_tags($lesspeasant); print "<center>"; print "<table class='maintable'>"; print "<tr class='headline'><td><center>Change Peasants</center></td></tr>"; print "<tr class='mainrow'><td>"; if($peasant<0) { print "You cannot change, not enough peasants!. Back to <A href='index.php'>Main</a>"; } else if($userstats3[playerturns]<1) { die("You must have at least 1 turn to Change. Go back to <A href='index.php'>Main</a>"); } $updatestats="update km_users set peasants=peasants-'$lesspeasant', playerturns=playerturns-1 where ID='$userstats3[iD]'"; print "You Changed $lesspeasant peasants to labor and have $manpower manpower and $userstats3[labor] laborers! Back to <A href='index.php'>Main Page</a>"; } print "</td></tr></table>"; } else { print "Sorry, not logged in please <A href='login.php'>Login</a><br>"; } ?>
However, I'm not doing something right because the peasants to labor numbers aren't being changed when the player changes the numbers, such as ..
If playerA wants to change 10 peasants to labor, the database isn't being changed and that I also need manpower, which also needs to be changed when PlayerA has labors. Each labor gives PlayerA 2pts of manpower (so if playerA has 10 labor, then PlayerA should have 20 manpower.
Thanks for your help!
-
Parse error: syntax error, unexpected T_LNUMBER in main.php on line 27
print "<table border="1" cellspacing="1" cellpadding="1" width="100%" bgcolor="black">"; print "<font color="silver">";
Linr 27 above
-
Good Day
I would like you to have a look around my internet directory website done with php, sql and smarty scripting. We also plan some major changes including going from a directory-based to a full-service internet search engine.
www.lmninfo.com
thanks
-
Hello
i run a internet directory service allowing webmasters to categorize and post thier websites free amoung hundreds of listings, however once my additions of keywords is complete i plan to go from a small-scale directory to a full-scale search engine similar to yahoo and google using php and sql. Using php and sql would this be possible with sql query or should we consider alternative ways to better maxamize query responses?
Flash question
in Other Programming Languages
Posted
Hello i am interested in creating simple multiplayer games using flash. I am quite the newbie in doing this but im sure there are guides and books to teach and help along the way but with those who do know the flash language i have a question or two:
do i need any special software to compile or even write code to do multiplayer games in flash?
how is the learning curve with flash can i study books and material online and quickly learn the basics or is learning the flash language difficult and waste of time for someone new?