Jump to content

Jiraiya

Members
  • Posts

    206
  • Joined

  • Last visited

    Never

Everything posted by Jiraiya

  1. i was hoping this would do it $username = $_COOKIE['ID_my_site']; username = persons user name
  2. that code that you posted didnt do anything
  3. 1. yes i did mean name=pic 2. im trying to update the pic variable in my database with the text submitted in the form above
  4. I need help creating this php updating form its supposed to update a pic url with a new one that is submitted by a html form i what i have is shown below <form> Picture URL: <input type="text" pic="pic" /> <input type="submit" value="Submit" /> </form> <br /> </form> <?php $username = $_COOKIE['ID_my_site']; mysql_connect("mysql", "username", "password") or die(mysql_error()); mysql_select_db("members") or die(mysql_error()); $sql = mysql_query("UPDATE users SET `pic` = name") or die(mysql_error()); ?>
  5. how would that be written like this? if ($row['potions'] >= 1 && $row['gold']>=1)
  6. i was wondering about "IF" statements if i could have multiple requirements for the if statement?
  7. i do know the basics the thing im really not sure is how to substitute the variable with one choosen by a user
  8. I need to know how to create a math system that pulls variables from a table that are selected im trying to create a program to do math with variables that are choosen by the user for example if i were to use a fighitng game it would be like Player 1 options Health (variable) is 25 punch(variable) is 10 kick 5 i need to make it so that the user picks the variable from a list and then the the variable that they pick is put into a equation with the only thing changing in the equation is the variable choose by the user
  9. what should the url be stored as in the database a char??
  10. im trying to display a image that is stored as a url in my database how would i retreive the image url in the database but have it show the image??
  11. im trying to set the random number that is generated to be set as the value of variable "number"
  12. here is the code it displays a random number but doesn't update the variable $username = $_COOKIE['ID_my_site']; $sql = mysql_query("SELECT * FROM users WHERE username = '$username'") or die(mysql_error()); echo (rand(1,10)); $var = rand(1, 10); $sql = "SELECT * FROM users WHERE number = '$var'"; mysql_query($sql) or die(mysql_error()); ?>
  13. yea kinda i have the variable set to "0" on default so i guess it would be an update mabey?
  14. i have a script that generates a random number <?php echo (rand(1,10)); ?> my question is how do i set a mysql variable to equal that random number all in one script?
  15. how would i make it so a random number is picked and then stored all in the same script?
  16. no i dont want random numbers i want random words from a list i create and then have a set percentage that that word will be chosen
  17. so i have to make a different database that contains the words? then how would i make a percent chance that a word will be choosen to be placed into the users variable when they sign up since i dont want the user to pick it?
  18. i was wondering how would i make it so a random word from a list would be put into a database table when they sign up for my site? so in other words i want to have a random word to be set as one of the users variables when they sign up and i want to have it so that each word has a preset percentage of that word being picked for the database.
  19. i want to add a timer to a script of mine so that after the script has run the user will have to wait 10 even if the user leaves that page so how would i do this?
  20. ok it now displays "You have bought one health potion." but its not updating the database Code: [select] $sql = mysql_query("SELECT * FROM `users` WHERE `username` = '$username'"); $row = mysql_fetch_array($sql); if ($row['gold'] >= 100) { $sql = ("UPDATE users SET `gold` = `gold`-100, `potions` = `potions`+ 1 WHERE `username` = '$username'") or die(mysql_error()); echo "<center>You have bought one health potion.</center>"; }else{ echo "<center>You don't have enough gold. Come back when you getmore.</center>"; }
  21. ok it now displays "You have bought one health potion." but its not updating the database $sql = mysql_query("SELECT * FROM `users` WHERE `username` = '$username'"); $row = mysql_fetch_array($sql); if ($row['gold'] >= 100) { $sql = ("UPDATE users SET `gold` = `gold`-100, `potions` = `potions`+ 1 WHERE `username` = '$username'") or die(mysql_error()); echo "<center>You have bought one health potion.</center>"; }else{ echo "<center>You don't have enough gold. Come back when you getmore.</center>"; }
  22. No rows were returned by the SQL. Username entered was is what it displayed
×
×
  • 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.