Jump to content

aQ

Members
  • Posts

    66
  • Joined

  • Last visited

    Never

Everything posted by aQ

  1. There is two pieces. with a | in between. That is where I want it to explode.
  2. The wardrobe-field in the users table has info|info|and some other info
  3. Well. It prints all the items in wardrobe, BUT it prints it hundreds of times. Any ideas?
  4. Hi again! I have this value in a table in my database called wardrobe: Socks|Pants|Cap I use explode to cut it into pieces. explode("|", $wardrobe); Then, I want to print all the pieces from "wardrobe". I do not want to do this manually, because each user has different amount of stuff in his wardrobe. Am I able to create a loop for these? Example (this doesn't work) while($wardrobe) print $wardrobe[$number]; } Thank you for a great forum!
  5. It works now... The reason it didn't work was that I calculated the "turns" before the username was read by PHP. I just needed to re-organize the code a little bit. Thank you.
  6. float(993) is returned by var_dump($newturns); My code is: $nowtime = date("YmdHis"); $qlastclaim = mysql_query("SELECT lastclaim FROM users WHERE uname = '$uname'"); $lastclaim = mysql_fetch_row($qlastclaim); $newturns = $nowtime - $lastclaim[0]; mysql_query("UPDATE users SET turns = '$newturns', lastclaim = '$nowtime' WHERE uname = '$uname' LIMIT 1"); I get the time the user last time claimed "turns" and I want the "nowtime" to be taken away from "lastclaim" to calculate how many turns the user will get.
  7. Hello again! I am trying to take calculate a variable - a variable. My variables are: $time and $lastclaim my calculation is: $turn = $time - $lastclaim; and then I print the "$turn". print $turn. This does not print anything... What is wrong? Thank you.
  8. I'm feeling stupid now... To ask in another way: Are there any way that I can search for a letter in a variable?
  9. If I use "is_numeric()", it accepts + and -. If I use "is_int($num)" it doesn't any numbers + or -. Any other ways? ???
  10. What about minus or plus? Will it show as an integer anyway?
  11. Hello! Are there any functions that can be used to delete all other characters than number in a form or a variable?
  12. Hello! I think this have been answered before, but I really don't know what to search for. I am making a messaging system now, and when you reply to people, the url becomes something like this "index.php?page=pm&to=The user to message&subject=blabla..." When the user has a name with spaces like for example "George Bush", php splits his name, and the only thing what will be shown is "George". Does anyone know how I can fix this?
  13. Hey, that's great! Thank you a lot, it worked like a charm.
  14. Thank you map. I think you meant print_r($_GET)? Now I get this: Array ( => news [delete] => 6 ) What can I do with it to delete id 6 now? By the way: What is the difference between "print_r" and "print"? pedropedroc: I want to delete it using php since I don't want to go into phpmyadmin every time.
  15. Hello! I am a php-newbie, so don't please keep your replies easy to understand. I want to take data from the URL to do something. I'll try to explain. Let's say that I have this url: index.php?page=news&delete=4 4 is the "id"-field of a post in my mysql-database. I want to delete the post with the id 4 belongs to. I hope you understand. Thanks, aQ.
×
×
  • 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.