-
Posts
16,734 -
Joined
-
Last visited
-
Days Won
9
Everything posted by PFMaBiSmAd
-
Is there some reason you not simply using a numeric value and letting an auto_increment field in your table to do this for you? If you use anything that SELECTs the current highest value, modifies it, and INSERTs the new value, you will need to lock the table so that concurrent operations won't accidentally use the same new value.
-
Use the WHERE clause to get all the data for the date range you are interested in. Use a GROUP BY clause to form groups for each year_month within that range. I would use the mysql EXTRACT() function to get the year_month part of the values you will need in the query - http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html#function_extract
-
http://dev.mysql.com/doc/refman/5.0/en/numeric-types.html
-
Have you read the information in the flush() section of the php documentation? You must also disable all of the buffering (including the buffering being done to accomplish compression) that the web server is doing. Short-answer: web servers and browsers were never intended for output from a single http request to be sent this way.
-
PHP $_GET working in one page and not another
PFMaBiSmAd replied to Cultureshock's topic in PHP Coding Help
What does a phpinfo() statement show for the register_globals setting? register_globals being on is about the only reason variables will get overwritten when there is no actual code doing it. -
Fatal error: Cannot redeclare local_time()...
PFMaBiSmAd replied to Hailwood's topic in PHP Coding Help
There are only two possible causes, you are either including the definition more than once or the definition is inside of a loop. -
Using the OR operator to get statements to execute when a function call fails does not address what action your code takes when there is an error, so using OR die(), OR trigger_error() is really only useful for debugging purposes. To control what happens when an error occurs, you must use traditional logic. See the following post for some example code - http://www.phpfreaks.com/forums/index.php/topic,287244.msg1361847.html#msg1361847 Once you have traditional logic, you can do things like set a flag/variable to indicate that an error occurred. Typically an array is used to hold error messages and the array being empty is what you would test at some later point in your logic. If the array is empty, no errors. If the array is not empty, it contains the error messages and you can simply output them wherever you would like.
-
PHP $_GET working in one page and not another
PFMaBiSmAd replied to Cultureshock's topic in PHP Coding Help
What value does $boxselected end up with? You likely have some code on that page that is overwriting $boxselected, such as - if($boxselected = something) rather than if($boxselected == something) The first example sets $boxselected to something and then tests the resulting value. The second example tests if $boxselected is equal to something. -
The following contains an extra single-quote before the 'value keyword, making it invalid HTML - echo " <input type='radio' name='access' 'value='1' checked>Player "; Some browsers ignore various errors in your markup. You should always validate your resulting pages at the w3.org HTML and CSS validators.
-
The $img1_name variable is what is in $_FILES['img1_name']['name']; The $img1_size variable is what is in $_FILES['img1_name']['size']; The $img1 variable is what is in $_FILES['img1_name']['tmp_name]; It's not a matter of trying to store all those values into $img1_name, it's a matter of correcting your code to use each value where it needs to be. That code is almost 8 years out of date.
-
What is the form code? You have a problem with your HTML in the form that is causing the value to not be submitted with that name.
-
The session.save_path setting in affect at the time that your session_start() statements are executed is where the session data files are stored or retrieved from. Just set session.save_path to a folder of your choice.
-
/tmp would refer to the root of the current hard disk and is not specific to your domain.
-
Help with delete from mysql drop down list please
PFMaBiSmAd replied to jp15's topic in Third Party Scripts
The problem is because there is no closing double-quote in the following line - $sql = "SELECT `id`,`name`, FROM `upload2` ORDER BY `name`; The quotes encountered in the line where the error is reported at signaled the language parser that something was amiss with the code (it cannot tell that you did not intend everything after the missing closing quote to be part of that statement.) Parse errors often are due to something wrong before the line where the error is reported at because php cannot know what the programmer intended when he left out an element of the syntax. -
The mysql_xxxxx functions are not available for php to use because the mysql extension needs to be enabled in your master php.ini
-
You will also find that int(13) won't work for a couple of reasons. INT(11) is the biggest normal integer and that includes a +/- sign as the 11th character. For the signed integer you are trying to make, the highest area code would be 214 and if you make it unsigned, 429 would be the highest area code you could store. Phone numbers are not actually numbers, they are formatted strings consisting of numeric digits.
-
Help with scripts to download mp3 files to a client
PFMaBiSmAd replied to uc7's topic in Third Party Scripts
The posted code does not produce a php parse error. There must be something present in your actual source file that the copy/paste into the forum post filtered out. I would recommend copy/pasting what you posted here into a completely new file and trying it. -
http://en.wikipedia.org/wiki/Standard_RAID_levels and http://en.wikipedia.org/wiki/RAID
-
Which email address? The To: address or the From: address? I'll guess you meant the To: address, i.e. you want to sent this to your gmail address. You will need to use SMTP authentication (provide you username and password for the receiving mail box) in order to do this in order to get the gmail mail server to accept the emails, which the php mail() function does not support. You would need to either open a socket to the gmail mail server and send it the necessary STMP commands or you can use one of the existing php mailer scripts that will do this for you, such as phpmailer - http://phpmailer.worxware.com/ You will pick setting for the script that make it mimic an email client, such as outlook. There are tutorials posted all over the Internet that show how to use phpmiler to send to your mail box at the major ISP's.
-
The From: email address must be a valid mail box at the sending mail server. If you want to put the entered email address in as a Reply-to: address so that it is easy to send back an email, you must add a Reply-to: header. You must also validate all entered data that is put into the header to avoid header injection that would let a hacker send his email through your mail server, eventually getting it banned by all the major ISP's.
-
Please set error_reporting to E_ALL and display_errors to ON in your master php.ini so that php will help you by reporting and displaying all the errors it detects. You will save a TON of time. Stop and start your web server to get any change made to your master php.ini and confirm that the settings are actually changed by using a phpinfo() statement (in case the php.ini that you are changing is not the one that php is using.)
-
Email Code Suddenly Stopped Working?
PFMaBiSmAd replied to RaythMistwalker's topic in PHP Coding Help
For debugging purposes only, what does putting the following two lines of code in immediately after the line with your first opening <?php tag show (test with an entered email address that is not hosted at your sending mail server) - ini_set("display_errors", "1"); error_reporting(E_ALL); The From: address put into the header should be a valid email address hosted at the sending mail server, even if you are sending email to yourself. When you put the arbitrary email address that is entered in form in as the From: address you risk getting the emails marked as spam and after a number of such miss-addressed emails a lot of the major ISP's will ban mail coming from your mail server. Your code is also not validating any of the entered values being put into the header so a spammer(s) could have been sending their email through your mail server, thereby getting it banned. -
Passing array value in mysql query and get current date
PFMaBiSmAd replied to TheFilmGod's topic in PHP Coding Help
1) Put the array variable inside {} so that php can find where it starts and ends - AND ref.network_id = '{$network['id']}' 2) See the mysql CURDATE() function. -
You can only put php setting into a .htaccess file when php is running as an Apache server module. If php is running as anything else, they result in an internal server error. To use session.use_trans_sid, you must do more than simply turn the setting on, because php will only append the session id onto the end of the URL in a limited number of cases. Do you have a specific reason you are attempting to use sessions without passing the session id using a cookie?