Jump to content

jcbones

Staff Alumni
  • Posts

    2,653
  • Joined

  • Last visited

  • Days Won

    8

Everything posted by jcbones

  1. To add to Kevin's post, PHP is not javascript, and cannot run via an "onchange" event. You would need javascript for that, as PHP never sees what a client does, only what a client sends to the server.
  2. There is a pagination tutorial on this site that is quite good. http://forums.phpfreaks.com/page/tutorials/_/basic-pagination?pg=1 That should get you where you need to go, if you hit a roadblock, post back and we can help you resolve it.
  3. Mysqli is used for MySQL databases only. PDO can be used for most any database. Deciding which one to use is up to the user. If you use different databases, then of course get comfortable with PDO.
  4. Curious that you are not using the mysqli or PDO classes. Mysql is deprecated, and will likely be removed in future versions. Having stated that, I would start out with putting more information in my error's. That would most likely lead you in the right direction. Dropping a mysql_error() in there (after the query) would be the starting point.
  5. Here is your script running on my server: with the suggested fix. Name : Password : Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/535.22+ (KHTML, like Gecko) Chromium/17.0.963.56 Chrome/17.0.963.56 Safari/535.22+ undefined x 1920 PS, the issue in this case isn't $_GET['r'] because OP is already testing if it is set.
  6. That doesn't look anything like the code snippet I gave you. Here it is again. { $name = (isset($_POST['username'])) ? $_POST['username'] : NULL; $password = (isset($_POST['password'])) ? md5 ($_POST['password']) : NULL; echo $password; //if(isset($_POST['notify_box'])){ $notify = $POST['notify_box'];} }
  7. I would say that is css. If you make every box the same size, and float them left, then they will line up perfectly everytime. No matter what the screen size is.
  8. The code snippet I gave you did fix the problem. It checks to see if the index exists, if it does it assigns it, if it doesn't it assigns a null value.
  9. You need to post your query string and logic surrounding it, and your database structure.
  10. We don't "fix" your code, we offer solutions for YOU to fix your code. You need to look at the file_put_contents().
  11. Undefined index just means that you are asking for an array key that doesn't exist, or isn't defined. That should also show up as a notice, and not an error. <?php { $name = (isset($_POST['username'])) ? $_POST['username'] : NULL; $password = (isset($_POST['password'])) ? md5 ($_POST['password']) : NULL; echo $password; //if(isset($_POST['notify_box'])){ $notify = $POST['notify_box'];} }
  12. Those errors are telling us that there is an error in your SQL syntax. Try this one: SELECT * FROM jobs WHERE userID='$userID' AND MONTH(`date`) = 4 By putting backticks around the word date, we are telling MySQL that we are looking for a column named date, and not the date function. *NOTE* normally date is allowed to be used without backticks, but I have had problems with it in the past. This is why I would try this solution. If this solution fails, then use: $getEnquiries = mysql_query("SELECT * FROM jobs WHERE userID='$userID' AND MONTH(date) = 4", $thermadoor) or die(mysql_error()); This solution will print the actual error from MySQL back to your screen, (remove before going public for security).
  13. What do you mean by "large"? The only way I see to do this is by looking ahead, depending on what "large" means, this could potentially create a good deal of overhead. Thus, slowing down the page.
  14. jcbones

    New to PHP

    You are talking about MySQL tables, which are not a part of PHP. PHP is a server side scripting language, and MySQL is a database.
  15. If you HAVE to use the files, you could try glob().
  16. I think you need a major update of your logic. Updating the database for each player that enters the chat should happen when that single player enters the chat. Which should be a single column update into a table that joins that single person to that specific chatroom. Maybe with a 5 minute cronjob that removes players that have had no chatroom interaction during the elapsed time. There should be NO CSV lists in any column in your database, because databases are NOT spreadsheets. Niether, should there be any duplicate data, as that leads to data collisions. In order for your project to be efficient as possible, I suggest you studying up on normalization
  17. If it is posting via now(), SELECT `username` FROM `navigate` WHERE `time` BETWEEN NOW() AND DATE_SUB(NOW(),INTERVAL 5 MINUTE) Just keep it in MySQL, and let her do the work.
  18. <?php session_set_cookie_params(3000); //according to the manual: /* * Set cookie parameters defined in the php.ini file. * The effect of this function only lasts for the duration of the script. * Thus, you need to call session_set_cookie_params() for every request and BEFORE session_start() is called. */ if(session_start()) { echo 'Session has started with these params:<pre>' . print_r($_SESSION,true) . '</pre>';//if you see this on the page, then the session has not been destroyed. } //ob_start(); //this is almost never NEEDED, but is instead a bandaid. //ini_set('session.gc_maxlifetime', 6 * 60 * 60); //you have already set the lifetime of the cookie by session_set_cookie_params() $session_expiration = time() + 3600 * 24 * 2; //you are not even using this variable anywhere in the posted script (which isn't complete).
  19. What you are looking at isn't PHP code, but is all styling. Which would mean HTML, CSS, possibly JS. The PHP just sends the information as output, so if you have the correct data, then styling is all that is left. The clincher is, that it is possible that all of the HTML is embedded in PHP code. Not to worry though, as this would most likely be in string format. The downside to this thread is that without any code, we cannot point you in the right direction.
  20. Why not just update each user as they enter the specific chat room. There should be no need to explode anything. Just update the field when they enter. The only thing that scares me, is I think you are saying you want to save a CSV list to a column. This would mean that your database is not even close to being normalized, which would lead to collisions like you are having. Depending on the modeling of your database, normalization could have many different forms, but I would think that you need a table to tie the user to the chat room. Perhaps also tie the personal messages to a chatroom of the same ID as the user, maybe like userID+10000 (that way each is unique, and would not collision like mt_rand could do).
  21. Chrome doesn't like this forum, and that means you lose anything after a code, quote, or any other tag. Perhaps you could repost your question with a different browser, so that the question is less confusing.
  22. That is funny right there. I don't know what is wrong, but I know it isn't what you are telling me... ? LOL. Depending on your version of PHP, session will return a true/false when called. That can always be checked to see if it failed or not.
  23. Undefined = doesn't exist Index = array key
×
×
  • 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.