Jump to content

PFMaBiSmAd

Staff Alumni
  • Posts

    16,734
  • Joined

  • Last visited

  • Days Won

    9

Everything posted by PFMaBiSmAd

  1. $csv_data = array($sku,$category,$subcategory,$title,$description,$price,$image,$attributes); fputcsv($file2, $csv_data);
  2. Don't build $csv_data as a string first then split it. That just doubles the work needed. Just build the array directly by putting each value into consecutive array elements.
  3. So, what values do you use in setcookie() for the PATH and DOMAIN parameters and what if anything is different between the PATH and DOMAIN of the page where the cookie is set and the code you posted? You should actually store the unique id on the server and associate it with the email address because as soon as someone looks at the cookie and the link they will notice that they can create an account on your site by simply putting the same value into their cookie and into the link when their bot script visits your site.
  4. You need to compare the old php.ini with the new 5.2.11 php.ini and account for every difference between the two. You likely have some custom settings and extensions setup in the old one. If the 5.2.11 php.ini layout is similar to your old php.ini, you can use a program like Winmerge to easily find the differences - http://winmerge.org/ I actually use this method every time I upgrade to move my existing custom php.ini settings into the new php.ini Edit: Caution, if register_globals is one of the settings that you currently have turned ON and your code needs it to be ON in order to work, please be advised that register_globals have been completely removed in php6 and you will need to correct your code at some point so that it is not dependent on register_globals.
  5. Cache what part of it, for how long, and for what purpose? If you have hundreds of entries that are dynamically being added/deleted, you would be better off executing a query when needed.
  6. A) If you were to post the part of the actual mysql error message that comes after the single-quote in the right syntax to use near ', someone could directly help you because that is point in the query where something that was found that could not be figured out, B) All string data must be escaped to prevent any possible special SQL characters in the data from breaking the syntax of the query, use the mysql_real_escape_string() function on each piece of string data, and C) Each piece of string data must be enclosed in single-quotes so that it is treated as a string instead of an identifier or a reserved keyword.
  7. The actual issue in the thread is not how to get the list of column names (there are probably ten different ways, four of which have been posted so far...) but in storing those names in a class variable. The original method did not work because you cannot use a function value or a variable as the default value when a class variable is declared. Whatever method is used to get the column names, must then assign the results to the class variable using php code.
  8. A cookie that the web server sends to the browser can normally be read by any javascript on a page that matches that cookie. session.cookie_httponly causes that cookie to be flagged so that javascropt cannot read that cookie.
  9. The default value for a class variable can only be a literal value (including an empty array), not a variable. You need to assign a value to $db_fields by using some php code at the point you have called the class_attributes() function. (Edit: or see the code neil.johnson just posted.)
  10. All of the php functions have a very specific list of parameters that they accept. These are documented in the php programming manual that is available in several formats on php.net. In order to use any php function effectively, you must make use of the documentation for that function. The mail() function does not accept a generic list of the items you want to place in the message body. See this link for what the mail() function requires and actual examples - http://www.php.net/manual/en/function.mail.php
  11. If the $_POST array is empty (have you checked exactly what you are getting using a print_r() statement?), you are likely exceeding the post_max_size setting, especially if you are uploading file(s) (your form tag implies that with the enctype="multipart/form-data" tag.) If so, either the post_max_size setting is too small for the expected amount of data or someone attempted to set the post_max_size setting and used an invalid syntax and actually resulted in a very small value instead of the expected value. Exactly what does a phpinfo(); statement show for the post_max_size setting?
  12. You are likely getting a fatal runtime error because the mysql extension is not enabled. Before you go any further trying to use php on your development system, please permanently set error_reporting to E_ALL and display_errors to ON in your php.ini so that php will help you by displaying all the errors it detects. Stop and start your web server to get any change made to php.ini to take effect and use a phpinfo() statement to confirm that the settings were actually changed in case the php.ini that you are changing is not the one that php is using. You will save a ton of time leaning php, developing php code, and debugging php code by having those two settings as indicated.
  13. I'm guessing the $_SESSION variable was from one of the other threads using the xml_parser_create(). The reason for it in that code was because the start() and char() callback functions are completely separate (unless you make that a class) and the easiest way of sharing information between the two functions was to use a $_SESSION variable, which is a global variable. For the code you just posted, you can use any array variable you choose to make.
  14. Inside of the function char(), the variable $element_name does not exist. Please develop and debug php code on a system with error_reporting set to E_ALL and display_errors set to ON so that php will help you.
  15. An update query that executes without any errors returns a TRUE value. Your existing code is testing that. You should actually be testing the value returned by mysql_affected_rows to determine if the update actually changed a row(s). Your update query is not updating any row because the WHERE clause is false. Where in PROCESS.PHP are you setting $id to a value so that the WHERE clause would have a value to match with the id column?
  16. $_SESSION[$tagname] = "WHATEVER" ; Variables are not parsed when enclosed in single-quotes
  17. Add the following two lines of code immediately after your first opening <?php tag on the main page - ini_set("display_errors", "1"); error_reporting(E_ALL);
  18. If you want a time displayed in the browser that changes colors in real time as the visitor is displaying a web page, you would need to use javascript. There are various javascript clock scripts posted all over the Internet. It would only take a small amount of logic to test the time value and alter the color. If you want the server's time to be used as the reference instead of the visitor's, you would need to output the server's time as the starting value for the javascript to use. Edit: For example - http://www.dynamicdrive.com/dynamicindex6/localtime.htm
  19. The first two characters of the Crypt password is a random salt, so both the OP's and your value could be correct for the same password. The two character salt from the hashed value is used when the entered value is hashed and will result in the same hash value if the password is the same as the original. Edit: Tested - <?php $user_input = 'test'; $hash = 'VKDgrEqD7TJBM'; if (crypt($user_input, $hash) == $hash) { echo "Password $hash verified!<br />"; } $hash = '6m1Ebu8dvl8Wg'; if (crypt($user_input, $hash) == $hash) { echo "Password $hash verified!<br />"; } ?>
  20. For debugging, you need both of the following lines - ini_set("display_errors", "1"); error_reporting(E_ALL); However, to help show a fatal parse error, those two settings need to be made in the master php.ini.
  21. There is also a missing $ in front of the errors[] array name. Edit to your edit: never mind, he got it.
  22. If something changed on your server that cause it to stop working, trying to get someone to download it to test it won't solve anything. You must troubleshoot what it is doing on your server. Define: "no longer working" What exactly is it doing? A blank page? A php error message? The form just redisplays when it is submitted? Data is not inserted/sent when the form is submitted? Without a description of the symptoms on your server, no one can help you with what the problem is.
  23. It's probably what the text is, not how much of it. ALL string data that is put into a query statement must be escaped to prevent SQL special characters from breaking the syntax of the query and to help prevent sql injection. You need to use mysql_real_escape_string on any string data put into a query.
  24. To allow you to uncheck an option, you need two things - 1) You need to display and propagate the current 'checked' value for each checkbox in the form, and 2) On each form submission, you need to loop through a list of the available checkboxes and for any that are not set, unset whatever data you are storing that indicates they are checked. Making a list someplace (database, array...) of the list of available checkboxes will also allow you to dynamically generate the checkboxes on the form so that you don't need to actually type a bunch of lines of HTML that you must edit every time you add, change, or remove a choice.
  25. Edit: Repeats some of what cags posted above... The problem is not necessarily in your function definition, but in how you are calling it - search_field($startFrom, $recordperPage, $searchCat, $searchField); echo search_field($dbResult); That code calls search_field() twice. The first time you provide all four parameters and guess what, that call is probably successful and does not produce an error. However, the funciton returns the value from the mysql_query(), but the call to the function does not assign that value to anything, so it won't be available for any purpose. The second call to search_field() only contains one of the required parameters AND that parameter both does not exist (because the first call to the function did not assign the returned value to anything) and that value is not of the type expected for the $startFrom parameter. Even if you had assigned what the first call to the function returned you could not call your function a second time because you cannot take the result of one mysql_query, which is a result resource when the query works, and put that directly into another query. You must fetch something from a result resource for it to be usable.
×
×
  • 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.