Jump to content

pocobueno1388

Members
  • Posts

    3,369
  • Joined

  • Last visited

    Never

Everything posted by pocobueno1388

  1. Put all the files in the same directory
  2. Did that work for you? If not, change you field to a datetime.
  3. Are you sure the DB field is a datetime?
  4. Change it to mysql_query("UPDATE teams SET lastactive=NOW() WHERE id='{$_COOKIE['user']}'")or die(mysql_error());
  5. UPDATE users SET last_active=NOW() WHERE username = '$username'
  6. I'm not going to do it all for you, but I will tell you what you need to know to do it yourself. You need to call session_start(); at the top of all your scripts To create a session $_SESSION['whatever'] = "Whatever"; To check if a session exists if(isset($_SESSION['whatever'])){ //it exists } Lets look at this line setcookie(ID_Loria, $_POST['username'], $hour); To make a session instead, you would change that to $_SESSION['ID_Loria'] = $_POST['username']; See if you can do it from that.
  7. When the user logs in you should set a session holding their userID, or whatever unique field you set for them. Then all you have to do when they type something in the chat is store their session in the chat table to figure out who said it. Then when your displaying the information from the database you can set it up to pull who said what with their username next to it because you know who said it.
  8. You only use one equal sign in MySQL, other than that though, that would get anyone online at that EXACT moment which would be pretty pointless as it would be hard to catch people who were being active.
  9. <?php $array = file('input.txt'); foreach ($array as $row) { echo $row.'<br>'; } ?>
  10. If you want to know how many users are online, this is what you need to do. Put a datetime field in the users table called "last_active" On your header page, put an update query that will update that field for that specific user to the current date/time. Now on your online users page, do a query like this SELECT username FROM users WHERE last_active > (NOW - INTERVAL 5 minute) That will get every user (registered) thats been active within the last 5 minutes.
  11. startsession() doesn't exist, I think your thinking about session_start()...although I'm not sure how that relates to the question asked. Just do a google for "PHP online users tutorial", tons of results come up for this topic.
  12. Use LIKE in your query, so give this a try <?php if (isset($_POST['search'])) { $key = trim(mysql_real_escape_string(addslashes(strip_tags($_POST['key'])))); $results = mysql_query("SELECT * FROM `posts` WHERE `post` LIKE '%$key%'", $conn1); while ($threadinfo = mysql_fetch_array($results)) { echo "<table><tr class=\"infor\"><td>Thread Name</td><td>Started By</td><td>Date Posted</td></tr><tr><td>" .$threadinfo['name']."</td><td>".$results['post']."</td><td>".$results['by']."</td><td>".$results['date'] ."</td></tr>"; } } ?>
  13. I don't understand what your trying to do...Are you saying instead of showing the item more than once, if they have more than one of that item, you want to display just one of them, and how much they have of it? ITEM 1 ITEM2 ITEM 3 1 in stock 4 in stock 5 in stock Kinda like that? Or am I completely off?
  14. This has nothing to do with PHP, try the CSS forum.
  15. Setup a daily cron that will check for users that have had more then 10 views, and delete all the old ones.
  16. preg_replace is for replacing using regex, you want to use str_replace() $Text = str_replace('', '<img src=\"smileys/smile.gif\">', $Text);
  17. Okay...tell me exactly what your trying to select from each table.
  18. Okay...then explain what you want when you say "wordwrap".
  19. Yes, you have the idea. Although selecting the item_id from both tables would basically be pointless since they should be the same...but if you were selecting the item_owner_id, then yes, that would be just fine
  20. Okay, once again your selecting ONLY from one table in that query...so there is no need for a join. You only need to join the tables if you are selecting information from TWO or more tables with some sort of relationship. Don't worry about not understanding it right away. It took me FOREVER to be able to do joins. I finally got so frustrated with not being able to perform more advanced queries that I sat down and just kept reading and practicing. It will come to you eventually, you just have to be patient when your first learning something Also, the query you just did will substitute fine for a join, but I've heard it isn't as fast or as efficient.
  21. Your getting closer. You don't need two item_price fields, if they hold the same information at least. Your query is very close, but there would be no point in doing a join as your not selecting anything from the other table. You could do something like this SELECT i.item_id, i.item_quantity, ui.item_price FROM items i LEFT JOIN user_items ui ON i.item_id = ui.item_id
  22. Try this... <?php if (isset($_POST['Groups'])){ foreach ($_POST['Groups'] as $xx){ $klg .= "$xx,"; } } ?> If that doesn't work, post your form HTML...maybe your not setting it up to be an array.
  23. No...no table to connect them. They are connected by the item_id field.
  24. <?php if (empty($valxx)){ //it's empty } else { //not empty } ?>
×
×
  • 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.