jcbones
Staff Alumni-
Posts
2,653 -
Joined
-
Last visited
-
Days Won
8
Everything posted by jcbones
-
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.
-
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.
-
How to open & edit file in list content of directory
jcbones replied to mrbhb's topic in PHP Coding Help
What to you need help with? -
[Help] Hidden Error when insert data into database
jcbones replied to thientanchuong's topic in PHP Coding Help
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. -
[Help] Hidden Error when insert data into database
jcbones replied to thientanchuong's topic in PHP Coding Help
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. -
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.
-
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'];} }
-
Post your script of line 5 through line 12.
-
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.
-
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.
-
[Help] Hidden Error when insert data into database
jcbones replied to thientanchuong's topic in PHP Coding Help
You need to post your query string and logic surrounding it, and your database structure. -
How to open & edit file in list content of directory
jcbones replied to mrbhb's topic in PHP Coding Help
We don't "fix" your code, we offer solutions for YOU to fix your code. You need to look at the file_put_contents(). -
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'];} }
-
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).
-
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.
-
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.
-
If you HAVE to use the files, you could try glob().
-
Explode users id into array and get if chat post = unread?
jcbones replied to slyte33's topic in PHP Coding Help
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 -
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.
-
<?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).
-
Need help with a slight modification of a php classified ads script
jcbones replied to sxp's topic in PHP Coding Help
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.- 3 replies
-
- php
- modification
-
(and 3 more)
Tagged with:
-
Explode users id into array and get if chat post = unread?
jcbones replied to slyte33's topic in PHP Coding Help
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). -
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.
-
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.
-
Undefined = doesn't exist Index = array key