-
Posts
16,734 -
Joined
-
Last visited
-
Days Won
9
Everything posted by PFMaBiSmAd
-
Session variables (all variables) start with a $. You should be using $_SESSION Because a form tag is a block level HTML element, text (including php error messages) won't necessarily be rendered in the browser, but will appear in the "view source" in the browser. Also, the use of isset() prevents some php errors from being produced.
-
importing data to mysql from microsoft word document
PFMaBiSmAd replied to shane07's topic in PHP Coding Help
Your first step will be to export your Word document as a plain text file so that the content in it will be saved as plain ASCII text without all the underlying encoding being used in the file. The second best option would be to use the COM extension to let you open and process the Word document. This will require that you research and learn the Word commands necessary to locate and select text within the document. The worst option would be to attempt to read the raw .doc file and attempt to parse it yourself. -
You already have an active thread for this problem, don't start another one. That just looses the history of how you got to this point. Also, your problem has nothing to do with the forum section where you posted this thread, so moving it to the PHP Help section... You already have a relevant reply in your existing thread as well. LOL, and your first thread on this was also posted in the wrong forum section and had to be moved. What are you doing?
-
Since you are not escaping the string data being put into the query, it is highly likely that SQL special characters in the data, such as ' or ", are breaking the SQL syntax. See this link - mysql_real_escape_string. Using mysql_real_escape_string on the string data being put into a query will also protect against sql injection in that data.
-
One way to accomplish what you are doing - <?php session_start(); if(isset($_POST['Submit'])){ // code to process the form goes here echo "<p>"; echo $_POST['answer1']; echo "</p>"; echo "<p>"; echo $_SESSION['answer1']; echo "</p>"; if ($_POST['answer1'] == $_SESSION['answer1']) { echo "<p>Correct answer</p>"; } else { echo "<p>Incorrect answer</p>"; } } else { // code to produce the form goes here, including setting any session variables you expect to have a specific value when the form is processed $_SESSION['number1'] = $number1 = rand(1,10); $_SESSION['number2'] = $number2 = rand(5,15); $_SESSION['answer1'] = $number1 + $number2; echo "<p>"; echo "<b>Q1.</b> $number1 + $number2 = <form name='answer1form' method='post' action=''> <input type='text' size='1' name='answer1'/>"; echo "</p>"; echo "<input type='submit' name='Submit' value='Submit'>"; echo "</form>"; } ?>
-
Not really, that is just code that allows you to see what exactly your script is receiving as data and would be used for debugging purposes only. Error checking code would be logic that tests for errors, such as an empty $_FILES array or upload errors in the $_FILES[....]['error'] element; outputs a meaningful user error message telling them that the upload could not be processed, why it could not be processed, and what about the supplied data was invalid; logging all the available information about the error so that the system administrator will know that problems are occurring and can find and fix them as necessary; and takes an appropriate action when an error occurs, like not blindly attempting to use nonexistent data in the remainder of the code. For your specific symptom of an empty $_FILES array for larger files - http://us.php.net/manual/en/ini.core.php#ini.post-max-size
-
Internet Explorer won't print my SQL resultset
PFMaBiSmAd replied to nd3_2000's topic in PHP Coding Help
If you have data present on one page, but it is not being submitted to another page as $_POST variables, it is highly likely that your form is invalid HTML and one browser is ignoring the markup errors while a different browser is not. You have not posted the code of the page that is submitting to the code you did post, so it will be a little hard for anyone to directly help with what is causing the problem. You have just posted the code that is using the data and are expecting that someone can tell why it is not receiving data that is being produced somewhere else. -
Yes, but that does not show the relevant code leading up to that point that is causing that function definition to be evaluated more than once. The function definition is either within a loop or is in a file that is being included more than once. Without showing the context where the function definition exists, it is not possible to directly help with the problem.
-
How about using var_dump() on both $_SERVER['DOCUMENT_ROOT'] and $row['PosterURL'] so that you can tell if they contain something unexpected. You are testing values in your code and the test is failing. Investigate what exactly is being tested.
-
Internet Explorer won't print my SQL resultset
PFMaBiSmAd replied to nd3_2000's topic in PHP Coding Help
Are any of the $_POST variables from an image being used as a submit button? If so, read the following link on how you should be accessing the data so that it works in all browsers (according to the w3.org HTML specification) - http://us.php.net/manual/en/faq.html.php#faq.html.form-image -
That's because the code is unconditionally assigning the values to the session variables, so they will be replaced on each page request. You need to separate your form code from your form processing code - if($_POST['Submit']){ // code to process the form goes here } else { // code to produce the form goes here, including setting any session variables you expect to have a specific value when the form is processed }
-
What does your error checking logic in the upload section of your code tell you for the reason the upload is failing?
-
The only thing that ties any HTTP requests together is what the browser supplies when it makes the HTTP request. You would either need to pass the answer in a hidden field in the form (not secure), in a COOKIE (not secure) or using session variables on the server.
-
Remove the distinct() term from the SELECT clause. Distinct is not a FUNCTION. It removes duplicate rows from the result set. Add this after the WHERE clause - GROUP BY DATE(r.ride_date)
-
To take a date in any format consisting of numeric values for the year, month, and day and produce a YYYY-MM-DD format, it is generally fastest to do this - A) Separate the date into the individual year, month, and day values - explode B) Validate the date (everyone IS validating their user supplied data?) - checkdate C) Concatenate the individual parts with the '-' separator character to get the desired format.
-
DATEDIFF() return minutes passed isntead of days?
PFMaBiSmAd replied to thefollower's topic in MySQL Help
You would need to use TIMESTAMPDIFF() with the first parameter set to MINUTE -
The issue in this thread are the links (URLs) in the included file. You can use $_SERVER['HTTP_HOST'] when forming the absolute URLs to get the host name so that you don't need to change anything when you move from your development system and a live server.
-
The contents of the type='file' input box can ONLY BE SET by the browser. You cannot set it using javascript and you cannot set it using a value="..." attribute in the HTML. IF you could do what you are attempting, it would result in the file being uploaded to the server twice.
-
The variable names you are using in your php code don't match up. You should be learning php, developing php code, and debugging php code on a system with error_reporting set to E_ALL and display_errors set to ON in your master php.ini so that php will help you by displaying all the errors it detects. There would be some undefined variable messages that would help point out the mixed up variable names in your code.
-
How about investigating what is in $email when your code runs? Does var_dump($email) show one extra character, beyond the visible characters, for the length? Where and what is $email being set from and what processing is your code doing on it that could be adding a character to the end of it?
-
Some web server configurations require that you put a local php.ini in each folder that you need the changed settings to affect. What did your web host (or his FAQ documents) state about using a local php.ini?
-
Why doesn't thios MySQL query from php page work?
PFMaBiSmAd replied to Gamerz's topic in MySQL Help
Single-quotes make things string data values, not column or table identifiers. -
The settings that affect the maximum upload file size can be set in the master php.ini (when you have access to it), in a local php.ini (when php is running as an CGI application), or in a .htaccess file (when php is running as an Apache Module.)
-
You cannot use an ini_set() in your script for the upload size settings because the settings are used by php before your script is ever executed (which is why the error message reports that error is occurring in Unknown on line 0.) If you have a dedicated server, why not make the change in the master php.ini? The leading dot in the .htaccess file name is there to make it so that you cannot normally see the file. Also, you can only put php settings in to a .htaccess file when php is running as an Apache Module. If php is running as a CGI application, you would need to use a local php.ini. If php is running as anything else then these two combinations, you must use the master php.ini.