Jump to content

Thisnamewilldo

New Members
  • Posts

    5
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Thisnamewilldo's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Anyone able to solve this or give some sort of advice? It's urgent.
  2. Thanks for this it seems to be working great, just one question. Is the - 60; part the length of time after the entry is inserted into the database that it will wait before being deleted? if so is this measured in seconds? so there for, if i changed it to say 120, would that mean it would wait 2 mins before deleteing the entry? sorry for the basic questions but i have never used PHP before and am trying to fix parts of a website that i have had dumped on me. thanks, gavin No problem, glad it is working. The -60 part says after 60 seconds the entries will be deleted. It basically just gets the current time then takes away 60 seconds and finds any entries less than that time. It is measured in seconds, yes, so if you changed it to 120 it would mean 2 minutes before deletion. - Vince.
  3. Here is how I would do it personally.. $thetime = $_SERVER['REQUEST_TIME']; $maxtime = $thetime - 60; mysql_query("DELETE FROM temp_users WHERE book_stage='0' AND creation < $maxtime");
  4. <?php $name = $_POST['username']; $pass = $_POST['password']; $squname = "root"; $sqpword = ""; $conn = @mysql_connect("localhost", $squname, $sqpword) or die ("Err: Conn"); $rs = mysql_select_db("test3", $conn) or die ("Err: Db"); $name = @mysql_real_escape_string(trim($name)); $pass = @mysql_real_escape_string(trim($pass)); $sql = "select * from users where name = '$name' and pass = '$pass'"; // Surely you only want the user with that username and password they entered? $rs = mysql_query($sql, $conn); // If you have more than one result, that's also a problem while ($row = mysql_fetch_array($rs)) { if (mysql_num_rows($rs)>=1) { // You might want to set some session variables here, too. header('Location:congrats.php'); } else { echo "Invalid username and password combination"; } } ?>
  5. Hello, thank you for taking the time to read this. Basically, I have a table in a mySQL database that holds people's inventory on a game and it is stored like this : [2(17:0)x1] [slotID(ItemID:ItemValue)xAmount] I also have another table which stores the hundreds of available items. I need it so that I can do something like: <? $checktheiritem = mysql_query("SELECT * FROM inventory WHERE owner='$logged[username]'"); while ($theiritem = mysql_fetch_array($checktheiritem)) { $amount = AMOUNT; // AMOUNT would need to be the amount from the inventory table. $getitem = mysql_query("SELECT * FROM items WHERE itemid = 'ITEMID'"); // ITEMID would need to be the item id from the inventory table. $item = mysql_fetch_array($getitem); echo "$item[name] x $amount"; } ?> Does anyone have any idea how I can separate the amount, itemid, item value etc from the one result [slotID(ItemID:ItemValue)xAmount]? I tried doing this, my code is below.. but as you can imagine, it is having to check the hundreds of items first which takes about 10 seconds for the script to load. Also I still cannot get the amount. <? $getitem = mysql_query("SELECT * FROM items"); while ($item = mysql_fetch_array($getitem)) { $checktheiritem = mysql_query("SELECT * FROM inventory WHERE owner='$logged[username]' AND inventory LIKE '%($item[itemid]:$item[value])%'"); $theiritem = mysql_fetch_array($checktheiritem); if ($theiritem != NULL) { echo "$item[name]"; } } ?> Any help at all would be appreciated! Thanks, Vince.
×
×
  • 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.