Jump to content

PFMaBiSmAd

Staff Alumni
  • Posts

    16,734
  • Joined

  • Last visited

  • Days Won

    9

Everything posted by PFMaBiSmAd

  1. You are using an image for your submit button. Browsers that follow the w3.org specification (apparently - Chrome, IE, Opera) submit the coordinates where the image was clicked. Other browsers that do their own thing outside of the w3.org specification submit the value = attribute. You can either test for the x or y coordinate, which works in all browsers (see this link - http://us2.php.net/manual/en/faq.html.php#faq.html.form-image ) or you can add a hidden field to your form that submits a specific name/value pair that you can test in your form processing code.
  2. Something tells me that your earlier 'white screen' thread and this one are for the same code and same problem, but this one differs in that you turned on error_reporting/display_errors so that you could see the error that was occurring at the msyql_query statement.
  3. There is not a pattern. The order that you get the file names is the order that the file names are stored in the disk directory. The order is generally in the order that the files were created, but things like disk optimizers can re-order the disk directory. Also, doing things like displaying a folder of files in a particular order and then copying (FTP'ing) them to another folder, will place the files in that order in the new folder. Adding a file to an existing folder can place it at any point in the directory, because empty directory entries get reused. You must specifically order the file names after you read them if you want them in any particular order. Whatever your reluctance is to read the file names into an array and sort them, get over it. Note: by default glob returns files alphabetically sorted.
  4. phpmyadmin is a popular database management script that is written in php and is installed on web servers to allow you to manage your mysql databases. mysql is a database server. You are likely trying to connect to a mysql database server in your php script. White pages can be caused by errors and the errors don't show up because php's error_reporting/display_errors/log_errors settings are not set appropriately, by using short open tags on servers that don't support them, or by code that simply does not output anything to the browser because it did not receive the input that it expected (plus about 3-4 less common reasons.) What have you done to investigate what your code and data are doing on the page that doesn't work? Your other pages that do work are irrelevant, because it is something specifically that you are doing on the page the doesn't work that is causing the problem. When you do a 'view source' of the white page, what do you get? Do you have php's error_reporting set to E_ALL (or even better a -1) and display_errors set to ON in your master php.ini on your development system and you have confirmed that they are properly set by using a phpinfo statement and you are also not modifying the values in a local php.ini, in a .htaccess file, or in your script so that all php detected errors will be reported and displayed? Are you sure your code is doing anything? Have you tried to echo something so that you know your code is taking the execution path you think it is? Lastly, we cannot help you with anything your code for a page is doing without seeing all the code that makes up that page (less any database credentials.)
  5. Since the code you posted won't execute the UPDATE query when you leave any of the textarea's empty, either the <br> in the database table is there from your original INSERT query or you have some code you haven't posted, such as a WYSIWYG javascript editor on the page.
  6. You have far too many query statements, mysql_query statements, variables, and variable names that don't hint at their purpose floating around. For the most straightforward code, you need to form query statements that do two things for each page request - 1) A query statement with/with-out the WHERE clause that will be used to find the total number of matching rows. 2) The query statement from step #1 with the addition of a LIMIT clause on the end to get the actual rows for the requested page number. See this pseudo code - <?php if(isset($_GET['category'])) { $cat = mysql_real_escape_string($_GET['category']); $base_query = "SELECT guns_id,guns_brand,guns_model,guns_img,guns_price FROM tbl_guns WHERE guns_cat = '".$cat."' ORDER BY guns_id DESC"; }else{ $base_query = "SELECT guns_id,guns_brand,guns_model,guns_img,guns_price FROM tbl_guns ORDER BY guns_id DESC"; } // execute the base query to get the number of rows $result = mysql_query($base_query); $total = mysql_num_rows($result); //... code to calculate the number of pages and the offset based on the requested page number ... // execute the query to get the result set for the requested page $query = "$base_query LIMIT $offset,$rowsperpage"; $result = mysql_query($query); // loop over the result set and output the data while($row = mysql_fetch_array($result)){ ... your code inside the loop ... }
  7. Without an example showing what you are inputting as data and what you are getting as output (shows where and what the problem is), there's not much help anyone can give.
  8. The class you found expects an instance of a mysqli database object, not an instance of a PDO class. They are not directly interchangeable. Whomever altered the code with the new PDO() logic, needs to put it back to the original new mysqli() logic or rewrite and test all the database statements to use PDO.
  9. If the site requires you to be logged in using your username/password, you would need to first post your username/password to the login processing page to start a session and get a session cookie value that matches that session id. Then the page you are posting to should consider you to be logged in.
  10. You should have php's error_reporting set to E_ALL (or even better a -1) and display_errors set to ON in your master php.ini on your xampp development system so that all the php detected errors will be reported and displayed. As long as you are not using any server specific language extensions or system calls, there will be no difference when you run your php script between servers that have the same php.ini configuration and installed extensions. It's highly unlikely your code is working the way you think it is on your xampp system without a mysql connection. You either do have a connection or your code isn't actually using the output from the mysql_real_escape_string statements. Posting your code (less any database credentials) would be the quickest way of both determining what it is doing or not doing both on your development system and the live server.
  11. You would need to post enough of your ACTUAL code that demonstrates/reproduces the problem.
  12. If you read the side-bar on the php/Windows download page, you will find that http://www.apachelounge.com complies Apache using the latest compiler, which can be used with the latest php versions.
  13. Don't use urlencode on the value you put into the getimagesize() statement. Like its name indicates, urlencode is used in URLs. The value you output on your page in the <img src="..."> tag is a URL, the value you use in getimagesize() is a file system path.
  14. The actual syntax would be - $_POST['cache'][$i]
  15. There's another thread for this problem where all the same things were suggested.
  16. Here is greatly simplified php code (one query, arrays) that does what you are trying to do - <?php include('db.php'); session_start(); mysql_select_db($database_db, $db); // query for all the data and get a count of the data $query = "SELECT * FROM cacheInfo"; $result = mysql_query($query, $db) or die(mysql_error()); $totalRows_rs_cacheNum = mysql_num_rows($result); // used to generate form fields // form processing if(isset($_POST['nextbtn'])){ $cache = array_map('trim',$_POST['cache']); // trim the 'cache' data // get array with cacheCodes $dataset = array(); while($row = mysql_fetch_assoc($result)){ $dataset[$row['cacheInfoID']] = $row['cacheCode']; } $diff = array_diff_assoc($cache,$dataset); // compare arrays, entry by entry if(empty($diff)){ // all entries matched echo "Result:pass"; // do whatever you want here when all entries matched... } else { // at least one entry did not match echo "Result:fail"; // do whatever you want here when all entries did not match ... } } ?> The form field change to use an array name - <input name='cache[$i]' type='text' />
  17. If you are just trying to test if all the entries match the data from the database, you would fetch all the rows from the database into an array and get all the form data into an array (you can do that directly by using an array name for the form field.) Then you can simply use array_diff to find if there are any differences in the two arrays. Edit: must each numbered entry (1,2,3,...) match the corresponding cacheInfoID (1,2,3...)? If so, you would probably need to loop and set a flag indicating a non-match and break out of the loop at the first non-match. Edit2: array_diff_assoc will check if the values at each corresponding index are the same.
  18. Crashes like this are * generally * due to mismatched versions of php files or files built with different compliers or using non-thread safe versions of files in a web server environment that needs thread safe code. What's your php version and did the php_ldap.dll file come from the same distribution as the core php binary files?
  19. I bet you are getting the last data? ^^^ That line of code overwrites the $inaque variable on each iteration of the loop. You only end up with the last set of data after the end of the loop. If your goal (which you haven't actually shown) is to build an array of arrays, you would use - $inaque[] = array($dir=>$company);
  20. I can just about bet that the code is expecting an actual php array variable with specific key/value pairs. Not the print-out/print_r/var_dump/var_export (which was already suggested in your previous thread on this) of an array and not a string that looks like an array. What is this code you are trying to supply data to?
  21. Is the spelling and capitalization of your actual database name 'test'? Mac file systems are case-sensitive and unfortunately, mysql database and table names are not decoupled from the underlying operating system and are case-sensitive on such operating systems.
  22. You can use mysql_error in the or die() logic to get mysql/php to tell you why the mysql_select_db statement is failing. What database management tool are you using to setup the databases/tables/users? You should also have php's error_reporting set to E_ALL and display_errors set to ON in your master php.ini on your development system so that ll the php detected errors will be reported and displayed.
  23. You can create a test page on your server that submits the expected post/get data to the script you are trying to test so that you can get it working independent of the paypal process (which will also demonstrate that you shouldn't rely solely on the visitor being returned to your site to consider the payment valid and complete) or you can also use the paypal sandbox instead of the 'live' paypal processing. You should should also have php's error_reporting set to E_ALL so that all the php detected errors will be reported. Is there some reason you haven't posted all the code on the page (less any sensitive information in it), particularly the code that is setting the $slide array and any code from where the $slide array is being set up to the code you have posted, since something in that code could be clearing those values?
  24. Do you want to prevent http requests to the files or what? What exact problem are you trying to solve?
  25. Since mysql_real_escape_string and htmlentities won't stop the type of sql injection that occurred in your case, the answer would be that casting the id value to an integer will be a lot safer.
×
×
  • 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.