-
Posts
16,734 -
Joined
-
Last visited
-
Days Won
9
Everything posted by PFMaBiSmAd
-
For debugging purposes, add the following two lines of code immediately after your first opening <?php tag to show all php detected errors - ini_set("display_errors", "1"); error_reporting(E_ALL);
-
Post your upload form processing code if you want someone on the forum to help with what it might or might not be doing. Edit: Also post other relevant details such as .htaccess files that are in place to either prevent the execution of .php files or browsing to files in the upload destination folder.
-
php.ini SMTP setting ignored
PFMaBiSmAd replied to jamesm6162's topic in PHP Installation and Configuration
Without seeing the error message, your code, or confirmation that the setting is syntactically correct (php.ini settings that contain invalid syntax do display as what they are set as but aren't actually used) best guess is that your code is not actually dependent on the php.ini SMTP setting, such as when you use one of the php mailer classes. -
SELECT query is not pulling full value from table
PFMaBiSmAd replied to yammez's topic in Microsoft SQL - MSSQL
Have you done a "view source" of the page in your browser to see if all the content is actually present? All content that could contain any HTML special characters (<, >, ', ") must be passed through the htmlentities function to insure that any HTML special characters in it don't break the HTML on your page. -
Based on the part of the query being printed in the error message, either $note or $ID1 contains part of your CREATE TABLE query statement. It would take seeing your actual code up to that point to be able to help with what it is doing wrong.
-
bluethundr, as mentioned in one of the other threads concerning the book/tutorials you are trying to use, the approach of processing information on one page, then redirecting to another page to display the results is a poor one, both for displaying errors and displaying normal expected output. I seriously would not waste any more time with the book, i.e. you need to already have some experience troubleshoot code (or have someone at hand who does) just so that you can get the code to output the expected results. That's not how tutorials are supposed to work.
-
Why a normal variable keeps its value on another page
PFMaBiSmAd replied to ejarnutowski's topic in PHP Coding Help
What does a phpinfo() statement show for the actual register_globals setting? -
I'll guess the line the error mentioned was the following one - else { php?> There is an extra php on that line that is out of place where php thinks you are trying to use a defined constant named 'php'.
-
turn off buffering in php.ini
PFMaBiSmAd replied to bluethundr's topic in PHP Installation and Configuration
It would be - error_reporting = E_ALL Have you checked using a phpinfo() statement if the settings are actually being changed to those values (in case the php.ini that you are changing is not the one that php is using)? -
The temp uploaded file is actually deleted automatically when the script on the page that is the target of the form finishes execution, so you would actually need to store the whole temp uploaded file somewhere and a session variable is about the best place if you want it to be automatically deleted once you are finished with it.
-
create temporary file that will be automatically deleted
PFMaBiSmAd replied to atomicrabbit's topic in PHP Coding Help
By default, the session id cookie has a zero session.cookie_lifetime setting and the cookie expires when all open browser windows/tabs are closed. session garbage collection will then automatically remove the session data files that are older then the session.gc_maxlifetime setting. -
Here is really the minimum logic that should be used when executing a query - <?php $query = " ... "; // your query in a string variable (makes error reporting easier because you can log or display the actual query) // execute the query and check for success or failure if($result = mysql_query($query)){ // the query executed without any errors and returned a result resource or a TRUE value // check if any rows were returned by the query (SELECT queries) if(mysql_num_rows($result)){ // the result set contains one or more rows // process the row(s) in the result set here... } else { // no rows were matched, output a helpful user error message echo "The query did not match any rows in the database<br />"; } } else { // the query failed and returned an FALSE value // do your application level error reporting here... // output a helpful user error message echo "The query could not be executed at this time due to an error<br />"; } ?>
-
Finally, some relevant information. Too bad you did not tell us the name of the file where that is located so it could be found or just post the relevant code that is outputting that.
-
$_FILES['template_readme']['type'] does not contain one of your expected values. I recommend echoing $_FILES['template_readme']['type'] as part of your error message so that you know exactly what it is. Your code is also not checking the ['error'] element before it attempts to check any of the other pieces of data concerning the uploaded file(s) so it is entirely possible that $_FILES['template_readme']['type'] is empty because the file was not actually uploaded without error to your server. See this thread for more complete error checking ideas - http://www.phpfreaks.com/forums/index.php/topic,278952.msg1320835.html#msg1320835
-
Why isn't this insert working when another is?
PFMaBiSmAd replied to Cultureshock's topic in PHP Coding Help
LOL, your first query has some error checking and error reporting logic (the or die(mysql_error()) ) to get it to tell you if it failed and why it failed. But your second query does not. If you added that same error checking and error reporting logic to the second query, you would get an sql syntax error at the point where the desc column is listed because desc is a reserved keyword and should not be used as a column name. You should either rename the column to something else or enclose it in back-ticks ` ` -
When you do a "view source" of the page in your browser, what do you get? Specifically, is the raw php code at the top of the page visible or does the page start with the doctype output? Is the code in a file with a .php extension? Does any other .php page with some php code on it work as expected? Define "in conjunction with"? Is the posted code an independent .php page that you are browsing to directly or is it some template or other content that the CMS is reading in?
-
The syntax you are attempting is for stored procedures and functions - What is your whole query and it would really help if you post the exact error message.
-
Your code is either not calling the function to set the value (have you tried echoing something inside of the function as confirmation), is overwriting the value (have you echoed it right after the function call), you have something like a session_write_close() statement before the point where the function is being called (what is you code doing that could affect the existence of that session variable), register_globals are on (I hope not, but you should be aware if they are on and what the ramifications are of them being on) and you have a get/post/cookie or program variable by that same name, short open tags are being used in your code so that some of the php code is not really php code, your including code using a URL instead of a file system path so the results are not really what you think they are, or ... There are literally a couple dozen different possible causes for the symptom, so you would really need to post the full code involved, with any included files and showing the php tags being used, for both the page you are setting the variable and the page where it does not contain the expected value.
-
create temporary file that will be automatically deleted
PFMaBiSmAd replied to atomicrabbit's topic in PHP Coding Help
Why not store the file in a session variable? It will be automatically deleted when the session ends. -
Until you investigate (or provide us with information) what the URL actually is that is producing that error and determine what about it is incorrect about it, no one can help you. For all we know you don't have permission to access that URL.
-
Dynamic dropdown with dynamically selected value
PFMaBiSmAd replied to jrobles's topic in PHP Coding Help
Not unless you tell us what exactly it did do and what your current code is and what you found when you investigated why it did not work. You know, provide some feedback. For all we know, your $value that you put into the code is not what you expect. -
Have you done a "view source" of the href="..." link so that you know exactly what it is?
-
Here is some information I just found out by testing under Windows - If the CONTENT_LENGTH header (it's the sum of the size of all files under one form submission) of the file(s) being uploaded is greater than either the post_max_size or upload_max_filesize setting, then the temp file(s) is(are) not written to the temporary directory. When the CONTENT_LENGTH of the file(s) being uploaded is less then both those settings, the files are written to the temp folder as they are being uploaded.
-
The error means that there are zero rows in your result set. mysql_result has the misfortune of being the only way to fetch data from a result set that generates an error when there are no rows in the result set. The error is either because your query failed to execute at all (you should test that value that mysql_query returns before you blindly attempt to access the result resource) or simply because the WHERE clause did not match any rows (you should use mysql_num_rows() to find out if there are any rows in the result set before you attempt to fetch any data from the result set.)
-
It's the web server that processes the file while it is being uploaded. The web server only invokes the .php file that is the target of the upload once the request has been received (i.e. the whole file has been uploaded.) It's likely the size of the file you are trying is small enough that it is being entirely held in the disk cache in memory while the web server is receiving it. You might try a larger file. Why exactly do you need to know this?