Jump to content

PFMaBiSmAd

Staff Alumni
  • Posts

    16,734
  • Joined

  • Last visited

  • Days Won

    9

Everything posted by PFMaBiSmAd

  1. Php is a server side scripting language. It gets parsed, tokenized, and interpreted on the web server when the page is requested. Php outputs content to the browser. That content consists of HTML, CSS, Javascript, and media (images, movies...) So, do you in fact have a working web server with php installed and you are entering URL's in your browser like http://localhost/some_file.php?
  2. The leading slash in the file path you are putting into the include() statement pretty much says that is not your actual code. If you are using a URL in the include() statement, what you are doing won't ever work because that causes a separate http request to be made for myfile.php and the php code in it is parsed in a separate instance of the web server/php and the code does not exist in the same scope as index.php. Use file system paths in include() statements.
  3. You probably have links/redirects that are switching between www. and no www. on the URL's and your need to setup the session.cookie_domain to match both versions of your domain or you need to force any non-www. request to redirect to the corresponding www. address.
  4. Here is a summery of the sticky post that ChemicalBliss suggested that you read - You cannot output any characters on a page before a header is sent as that prevents the headers from working. Session_start() and header() both send headers. Therefore, you cannot output anything before a session_start() statement or a header() statement. You must rearrange the code on your page so that any session_start() or header() statements come before any content on your page. Content on your page is any of the following - the HTML DOCTYPE tag, css, javascript, and html.
  5. Best guess is you have nested <form> tags and the first one does not have a method= attribute (the default is GET.) The only way to get a quick answer to what is going on with your form is if you post all the actual code for your form page.
  6. That's the number of days since Jan 1, 1900 (Windows) or Jan 1, 1904 (Mac.) Earlier in this thread you were probably getting a more usable value, before you changed the excel column date format. I would recommend changing it back to what you had so that you get a m/d/yyyy value. For the current excel column format, you will need the formula to convert the number of days since Jan, 1, 1900 (or 1904 depending on Operating System) into a usable date value.
  7. Use mysql_real_escape_string() on the $js variable before you put it into the query statement so that any special sql characters in it (like the single-quotes) don't break the sql syntax. Your $js = line of code in the first post in this thread was probably okay.
  8. Actually, now that I see your code, based on the explode, you are receiving a m/d/yyyy or mm/dd/yyyy format. To convert that to a yyyy-mm-dd DATE value in your php code, you would need to do the following - $start = date('Y-m-d',strtotime($start)); // convert m/d/yyyy or mm/dd/yyyy into a yyyy-mm-dd format
  9. You should echo the date value after you receive it in your php code to see exactly what you are receiving. The fact that you are exploding on the '/' would indicate it might not be a value that mysql can parse. The actual separator being '/' is not a problem but if the fields are not in the expected order or with leading zero's in the month and day fields, mysql cannot parse it correctly into a DATE column. Why are you exploding the start date and also inserting the resulting day, month, and year? That results in duplicate data and once you have a DATE value in your table you can do anything you want with it directly in any query using the built-in mysql date/time functions.
  10. Well, something probably did happen, such as the form page just refreshed or you got a blank page... You must investigate what exactly your code is doing that is causing 'nothing happens'. The first step would be to check if the the form data is present or not. Then keep checking in the code and determine at what point you loose the expected data or expected results. There are some common php.ini configuration differences that can cause code to apparently do nothing when a form is submitted, but it would take seeing your actual code for anyone here to determine if your code is relying on old depreciated php.ini settings.
  11. In fact, I just reviewed your three threads and you are apparently dynamically adding tables (your first thread) and columns (your second and this thread.) Doing both of these things over complicates the process of managing data, takes more code to achieve, results in slower processing (you must execute multiple queries to just find the data), and results in a design that is not flexible. What exactly is the overall goal you are trying to accomplish?
  12. Are you sure you are not really talking about rows? Because a table design that is dynamically adding columns as the number of questions/answers changes would be a bad design and result in horrendous code to make it work (as has been demonstrated by the lack of progress in this thread.)
  13. What exact method are you currently using to import the data?
  14. The $_COOKIE variables are set when the browser requests a page. setcookie() sends the header to the browser to get it to change the saved cookie in the browser. You have a couple of choices - 1) After the setcookie(), perform a redirect to the same page (this will insure that the cookie was actually set to the new value.) 2) You can set the $_COOKIE variable to the value you want in your code (this has the disadvantage of not truly showing the actual value in case the setcookie() fails.) However, you should not use the existence or absence of a cookie to tell you someone is logged in. All I would need to do is create a cookie that says I am you and I can visit your site and do anything on it that you can do. You should use the cookie to identify the visitor only, through a unique value that cannot easily be guessed or reverse engineered, and determine the logged in/logged out status through a value that is kept on the server only (so that if you log out, no one that gets ahold of your cookie values can appear to be logged in without logging in using the correct username and password.)
  15. You can include anything you want. It becomes part of the source the same as if you copy/pasted the contents of the file where the include statement is at. Php code in the included file is denoted by php tags around it, the same as any other php code. While you should use an external .css file and let the browser fetch it, you can do what you are trying and include the .css file as in-line content that is then output on the page. You must use the correct path to the file being included. Your original problem is that a leading slash / on a file path refers to the root of the current hard disk.
  16. Download feedback.php from your server (saving it as a different file name so as to not overwrite any existing good file) and examine exactly what is in it.
  17. header() is the name of a php built-in function. As soon as you used that name for your function your code produced a fatal php error. Please develop and debug php code on a system with error_reporting set to E_ALL and display_errors set to ON in your master php.ini to get php to report and display all the errors it detects. You will save a TON of time.
  18. The id values that callesson mentioned would in fact relate to entries in a database table that you would simply retrieve and output for that specific id value. You would in fact not use any if/else logic for each id value.
  19. For debugging purposes only, to try and find out what is happening once the file has been uploaded, add the following code immediately after your first opening <?php tag and post the resulting output - ini_set("display_startup_errors", "1"); ini_set("display_errors", "1"); error_reporting(E_ALL); echo "<pre>"; echo "POST:"; print_r($_POST); echo "FILES:"; print_r($_FILES); echo "</pre>";
  20. You either have some character(s) in the file before the <?php tag or your file has been saved as a UTF-8 encoded file and the BOM (Byte Order Mark) characters that your editor placed at the start of the file is the output that is occurring on line 1. The solution is simple. Check if there are any character(s) before the <?php tag and delete them or save your file as a UTF-8 encode file without the BOM or save it as an ANSI encoded file.
  21. You either have some character(s) in the file before the <?php tag or your file has been saved as a UTF-8 encoded file and the BOM (Byte Order Mark) characters that your editor placed at the start of the file is the output that is occurring on line 1. The solution is simple. Check if there are any character(s) before the <?php tag and delete them or save your file as a UTF-8 encode file without the BOM or save it as an ANSI encoded file.
  22. Check if there are any php errors reported. Add the following two lines of code immediately after the first opening <?php tag - ini_set("display_errors", "1"); error_reporting(E_ALL);
  23. Just use $num=mysql_num_rows($result); Putting or die(mysql_error()) on mysql_num_rows() makes no sense because mysql_num_rows() does not set mysql_error() and it causes your code to die at that point when mysql_num_rows() returns a zero value.
  24. The only information your browser can supply is an indication that the file is/was being transfered, it does not know what happens on the web server after the file has been received. So I'll ask again, does your code contain any error checking and error reporting logic to get it to tell you if the upload worked or not or if the mysql query failed and returned an error?
  25. Does your code have error checking and error reporting logic in it to test if the upload worked without error before you attempt to use the upload file in the query and to tell you why the upload failed if it did not work? Edit: for the upload progress question - http://sourceforge.net/projects/upu
×
×
  • 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.