Jump to content

PFMaBiSmAd

Staff Alumni
  • Posts

    16,734
  • Joined

  • Last visited

  • Days Won

    9

Everything posted by PFMaBiSmAd

  1. The VC6 Windows packages should be used with Apache. The thread-safe versions should be used when php is running as a server module. The non-thread-safe versions should be used when php is running as a CGI application.
  2. About the only time php actually crashes or causes the web server to crash is when you have a mix of different version of .dll/.exe files. What exact method did you use to upgrade the version and are you sure there were no files copied into the Windows folder that where then not replaced with the new version files? When php is installed and configured correctly, all the files can be kept in the php folder and an upgrade simply involves replacing the php folder with a new one containing all the files of the new version (I actually rename and keep the old php folder and then just rename the main folder in the distribution to 'php') and account for any differences in your existing php.ini and the new recommend php.ini.
  3. You can use a mysql REPLACE() function to remove all the spaces in the data -
  4. You would normally just do this in a single DELETE query, no looping is necessary. You would just form a WHERE clause in the DELETE query that deletes the rows you want, assuming that your date/time information is in format where you can use the mysql date and time functions to do the date/time comparison in the query.
  5. It's probably because of the space characters that are in the string data. Jonh's data does not have any spaces with the 32 values. Ram's does. I'll bet if you try 41 with John's data that it won't match anything.
  6. The LOAD DATA ... query accepts a SET term that can be used to modify values, for example - LOAD DATA LOCAL INFILE 'file.txt' INTO TABLE t1 (column1, @var1) SET column2 = @var1/100; You would use the mysql TRIM() function to remove any leading spaces. You can use an upload form, then in the php form processing code execute the LOAD DATA LOCAL INFILE ... query using php code. http://us2.php.net/manual/en/features.file-upload.php
  7. If you were developing and debugging this on a system with error_reporting set to E_ALL and display_errors set to ON in your master php.ini, you would already know why it is not working. In the following line - $now = date("Y-m-d", $thismonth); $thismonth is not a Unix Timestamp that date() expects, it is an array that getdate() returns.
  8. Just about every database management tool has a method of importing a text file of data with a specific format. You can even get mysql to do this with a query like the following (depending on the exact format of the data in the file) - LOAD DATA LOCAL INFILE 'c:/your_file.csv' INTO TABLE your_table FIELDS TERMINATED BY ',' LINES TERMINATED BY '\r\n';
  9. For debugging purposes, if you echo mysql_error() at some point after a query that fails, it will point you in the right direction of finding out why the query failed. In this case you would have gotten an error that mysql_query() attempted to create a database connection, because there was not one at the time the query was executed.
  10. Yes it is possible, but consider this - Php is a parsed, tokenized, interpreted language. Database engines are complied code. It will be from 10 to 100 times slower to use php to search through a file than it will be for a database engine to search through a table. This becomes a bigger problem as the amount of data increases. What exact reason is there that you don't want to use a database?
  11. I tried that script (at the link you posted) and it works as expected. It is cookie based, so if it only worked on the first visit to your page, then either you have disabled cookies in your browser or there is a header() error occurring because something was output to the browser before the cookie, or because the cookie they are using does not set the path or domain portion and something caused the path or domain (actually the subdomain/hostname) to change and the cookie no longer matched the page.
  12. Ummm. To make sure that the code I posted worked before I posted it, I made a test page using phpMyEdit that has 90+ pages. I was able to switch pages, change, delete... while still remaining 'logged in'. We cannot really tell you why what you tried did not work without seeing the actual code that exhibited the symptoms.
  13. It would help if you described the flow of data and at what point it has the excess slashes. However, the problem is likely due to magic_quotes_gpc (escapes GET, POST, and COOKIE data, even if you don't want them to be) and magic_quotes_runtime (escapes data retrieved from databases and files, even if you don't want them to be.) If your data is escaped correctly, a single time by mysql_real_escape_string(), the actual \ should not be present in your table (unless someone had a \ as part of the data.) This will help you pin down if the problem is occurring when the data is being input or when it is being retrieved. If you cannot turn off the magic_quotes_gpc setting, you would then need to use stripslashes() if magic_quotes_gpc is ON to remove the escape characters before you use mysql_real_escape_string(). You should not unconditionally use stripslashes() because that would prevent any actual \ in the data when magic_quotes_gpc is OFF.
  14. The whole $_FILES array would be empty if the form does not have the correct enctype.
  15. The only thing that affects how the for(){} loop operates are the three expressions - Note: $item=$items[$i] sets $item equal to $items[$i] and tests if the result of that assignment is true. Is that what you intend?
  16. The browser could not figure out what the file was either because of the browser or because of the file. If this occurred for a known good file, you will need to allow for that value for the ['type'] in your validation logic.
  17. In its most basic form, you would simply need to add code like the following to the start of the file - <?php session_start(); // determine if the current visitor is logged in and is permitted to access this page if(!isset($_SESSION['username']) || $_SESSION['level'] != 'admin'){ die('You are not permitted to access this page'); // you could also redirect back to your log in page // don't forget to put a die() statement after any redirect to prevent the remainder of the code on the page from still being executed while the browser requests the new URL. } // the remainder of the code on the page ?> Your log in code would need to correctly start a session and set $_SESSION['username'] and $_SESSION['level'] (you can omit and remove this second variable if YOU are the only person that has a username set up in the log in code.)
  18. Doesn't that suggest to you that the column definition being used can only hold that many values, such as if it were a TINYINT?
  19. Ummm. Best guess is that your code is producing invalid HTML or data and FF is not able to ignore whatever is wrong with it. 1013 different people that are trying to change fields dynamically using AJAX could have written your post above and there could be something different in each of their code that is producing the same symptom. Without your code and an example of what you entered and what the results were, no one in a forum can possibly help.
  20. Perhaps you should be looking at Server Side Includes instead of using php code - http://en.wikipedia.org/wiki/Server_Side_Includes The example of using <?php include "myimportlib.php" ?> to get the data being scrolled IS intended to be used IF you are in fact using PHP to dynamically get that data. If the data is in fact static, there is no need to use any php code (as thorpe stated earlier.)
  21. By default, web servers only cause .php files to be passed to the php language engine. Therefore, if you want to put any php code, such as a <?php include(...); ?>, into a file, you would need to make that main file a .php file. You can change this default response so that other file endings are also passed to the php language engine. You can easily do this if you have administrative access to your web server and it is sometimes possible at the account level, but that would require some specific knowledge about what your web server is and how php is configured on it.
  22. Based on the path being shown in the error message - There is no value before the first / in the path. A) What is the line of code with the include() statement? B) If there is no value for $_SERVER['DOCUMENT_ROOT'], you will either need to get your web host to find and fix what is causing that or you will need to set the value yourself at the start of your script. And what are you using to post the information in narrow columns? Because it is extremely hard to read.
  23. $HTTP_SERVER_VARS were depreciated long ago (8 years, in php4.1), turned off by default in php5, throws a depreciated error when on in php5.3, and have been completely removed in php6. Use $_SERVER
  24. Edit: In case you need to see the same answer again ... Because you are using negative logic (testing is something is not equal) and OR'ing the results. What does your code evaluate to when you put the actual value in? if ('1' != "1" || '1' != "2") '1' is not equal to '2' and the statement is TRUE and executes the echo. You would actually need to use && (AND) to make the logic correct - if ('1' != "1" && '1' != "2") It is generally better and clearer to use positive logic - if($number == "1" || $number == "2") { // the value was one of the choices echo "hello"; } else { // the value was not one of the choices }
  25. Please don't recommend using the global keyword to being values into a function. Could you imagine what a mess php would be like as a programming language if all of the built in functions did that and you had to keep track of which values were used by which function because they would all need to be uniquely named so that you could use more than a few functions without conflict? Only bring values into functions by passing them in as parameters so that you maintain the general purpose nature and encapsulation that functions are supposed to provide.
×
×
  • 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.