Jump to content

PFMaBiSmAd

Staff Alumni
  • Posts

    16,734
  • Joined

  • Last visited

  • Days Won

    9

Everything posted by PFMaBiSmAd

  1. You should remember which letters have already been used and output a message if the same one is selected again or someone refreshes the page and submits the same letter again.
  2. That's because your php installation has lazy-way short open tags turned ON. This is the main reason why short open tags have been turned off by default for a while now. The php parser is not smart enough to distinguish the opening <?xml tag from a short opening php tag and the only way to output xml from php code when short open tags are enabled is to echo the opening xml tag.
  3. This topic has been moved to PHP Regex. http://www.phpfreaks.com/forums/index.php?topic=351288.0
  4. wizzle, I commend you for searching the forum to find your error message in an attempt to solve your problem. But, because your code is unique to what you are doing, the cause of your error is not necessarily the same as the last post in this thread, which itself is an add-on post to this thread with a different error and a different cause from the original post that started this thread. You always need to start your own thread for your own problems. If you want to refer to a similar thread, just post a link to it in your own thread. The original error message for the OP that started this thread is different from your error message. The error message for ADynaMic's post does match your error message, but his actual code, which he didn't post, is producing that error for a different reason than your code. I can guarantee this based on his analysis of the change he made to the query as being the cause of the problem. His error is not directly related to the change in the query that he posted. It is some kind of follow-on error later in his code. ---------------------------- Now to your actual problem. Your code is supplying a null to the mysql_num_rows() statement because the $result variable doesn't exist. The reason it doesn't exist is because your switch/case statement is not matching any of the three choices and $result has not been created at all. That would indicate that your $select variable does not contain one of the expected values. You need to troubleshoot your code to find out what is in $select and then find out why it doesn't have an expected value in it or it doesn't have any value in it (i.e. empty.) You also need to add logic in your code so that you don't attempt to use the $result variable if it doesn't contain a valid result resource as the result of executing one of your mysql_query() statements. To see what the $select variable contains, use - var_dump($select); right before the start of your switch/case statement. If it contains a value, but it is not one of the three choices, you would need to troubleshoot why your form is not supplying a valid number. If it is empty, you need to determine why $_POST["search_type"] either doesn't exist or doesn't contain anything. Since the code you posted is supposed to be processing form data, you also need to add logic to your code to test that a form was submitted at all so that your form processing code only executes when there is $_POST data from the form.
  5. Your input string contains - data=. That is not xml and makes your xml source invalid. You need to have php's error_reporting set to E_ALL and display_errors set to ON or log_errors set to ON so that all the php detected errors will be reported and displayed/logged. You would have been getting the following warnings and notices -
  6. No. The session id is propagated by the browser, by default, using a session id cookie and cookies of all kinds are specific to the domain that created the cookie. For testing, if you really want to, you can create any number of 'fake' domains on your development system. You would make entries in your HOSTS file for each domain, for example - 127.0.0.1 www.example.com and then setup a virtual host in your web server's configuration that corresponds to that fake domain. You would then access that using http://www.example.com instead of http://localhost
  7. The position of the connection link in the mysqli_query statement should have always been the first parameter, like you had in your first post in this thread. Randomly trying things in programming, isn't programming. It just wastes a huge amount of time. Programming languages are one of the most heavily documented subjects on the planet, because you need to read and understand the documentation for each statement that you are using, before you can effectively use each statement. Your current code is not setting (assigning a value) to a session variable. Play computer and step through your logic, line by line, and make sure your logic is doing what you have defined you want it to do for each possible conditional branch.
  8. It's likely that the host-name/subdomain (www. vs no www.) in the URLs are changing back and forth (between having and not having the www. on them) and the session id cookie only matches the URL variation where it was set at and when you are redirecting around, including the return URL you tell your payment gateway to use, you finally end up going between pages that all have the same host-name (or lack thereof) in the URL. If this is the case, here are some things you can do to fix the problem - 1) You should set up a .htaccess redirect to force all URL's to goto a single variation of your domain, 2) You should be constant in your code and in the return URL you give/configure your payment gateway to use to always build links/redirects with the same variation of your domain, 3) You should set the session.cookie_domain setting to be .yourdomain.com (with the leading dot . ) to get the session id cookie to match all variations of your domain.
  9. The mysqli functions require the connection link in them. Literal string data values in the query statement require single quotes around them. To troubleshoot why your query is failing, you need to use mysqli_error($connection) to get mysql/php to tell you why. Use the following for your mysqli_query statement - $return=mysqli_query($connection, $info) or die(mysqli_error($connection));
  10. Using a strict comparison (===, !==), the only thing that null is exactly equal to === is another null and anything else (true,false,number,string, empty string, array, empty array,...) compared with a null is false. A !== between two null values would be false and anything else compared !== with a null is true.
  11. Is the symptom that your session id cookie (when you look in the browser) is being deleted or is the session data in your cart being deleted? Sound's like some invalid html on a page that some browsers ignore the errors in but IE doesn't or redirects taking place or not in different browsers or a race condition in your php code (no exit; after a redirect) that doesn't show up in some browsers or browsers that request pages twice (I.E does this having something to do with the favicon file.) Posting a sub-set of your code (less database username/password credentials) that reproduces the problem would be the quickest way for anyone here to help.
  12. Php's loose (==, !=) comparison operator table indicates that an empty array is == to null (true). Therefore, a != comparison would be false. Your $not_null will either be a TRUE or a FALSE (the result of the comparison.) When you echo a FALSE value, nothing is displayed (echoing a TRUE does display a 1.) Use var_dump($not_null); to see exactly what you are getting. What exactly are you trying to test? Using empty($group_map) might be clearer. If $group_map doesn't exist or is an empty array, empty() will return TRUE.
  13. Best guess is the format of the $todaydate value doesn't exactly match the data or your data contains some non-printing/white-space characters. Your original posted code had a snippet of code that appears it was part of some logic that added a leading zero to the day, along with a printout of your query that showed the $todaydate value had a format that could be used in date comparisons. Since you haven't posted enough of your actual current code that reproduces the problem or examples of what your data is or what you saw in front of you when you displayed the data (your idea of what is a date or what is the same format might not be the same as everyone else's, including mysql/php), it's not possible to actually tell what might be going on with your code and your data.
  14. Find your master php.ini file (it's usually in your main folder where php is installed), edit those two settings, save the file, and restart your web server to get the changes to take effect. You can find the php.ini that php is using by making a php script with a phpinfo statement in it and browse to the url of the file you just made. The Loaded Configuration File value in the resulting output is the php.ini that php is using. After making the changes, check using the phpinfo script that those two settings actually got changed.
  15. Do you have php's error_reporting set to E_ALL and display_errors set to ON in your master php.ini so that php will report and display all the errors it detects?
  16. Please just read the error message, it tells you where the output is occurring at, that you must find the cause of and fix - output started at /home/name/www/www/members/dbmembers.php:5 (line 5) Something on line 5 and probably lines 1-4 of your dbmembers.php files is sending output to the browser. If you cannot determine what that output is and rearrange your logic to prevent any output from occurring before the session start statement, you would need to post your code for the dbmembers.php file.
  17. You need to initialize $surcharge to an empty array at the start of each new car - $surcharge = array();
  18. Sure - <?php // fake data for testing purposes $fake[] = array('id'=>1,'event_start'=>'2011-12-13','event_end'=>'2012-01-01'); // starts before the current year/month $fake[] = array('id'=>2,'event_start'=>'2012-01-03','event_end'=>'2012-01-15'); // entirely within the current year/month $fake[] = array('id'=>3,'event_start'=>'2012-01-25','event_end'=>'2012-02-03'); // ends after the current year/month $fake[] = array('id'=>4,'event_start'=>'2011-12-29','event_end'=>'2012-03-01'); // spans the current year/month $year = date('Y'); $month = date('m'); // end of test values $first_day = date('Y-m-d',mktime(0,0,0,$month,1,$year)); // first day of current year/month $last_day = date('Y-m-t',mktime(0,0,0,$month,1,$year)); // last day of current year/month $query = "SELECT * FROM health WHERE '$year-$month' BETWEEN EXTRACT(YEAR_MONTH FROM event_start) AND EXTRACT(YEAR_MONTH FROM event_end) ORDER BY id"; //if(!$results = mysqli_query($dbc, $query)){ if(false){ // skip the above mysqli statement for testing purposes // query failed die("Query failed: $query<br />Error: " .mysqli_error($dbc)); } else { // query worked $data = array(); // array to hold the dates/data for each date (empty if no matching data) //if(mysqli_num_rows($results)){ if(true){ // skip the above mysqli statement for testing purposes // at least one matching row //while($row = mysqli_fetch_assoc($results)){ foreach($fake as $row){ // use fake data, in place of the above mysqli statement, for testing purposes // have event_start and event_end dates. need to expand for the days during the current $year/$month $date = $row['event_start']; // get start date for loop $end = $row['event_end']; // copy of the end date unset($row['event_start']); unset($row['event_end']); // remove these two unneeded pieces of data from the $row array while($date <= $end){ // loop over the days for this row if($date >= $first_day && $date <= $last_day){ // filter dates for event only within the current year/month $data[$date][] = $row; // save the entire $row array as an array of arrays for this date (allows for multiple events on any day) } $date = date('Y-m-d',strtotime("$date + 1 day")); // produce next date } } } } //echo '<pre>',print_r($data,true),'</pre>'; // display the data array for testing... // using the data - $todaydate = $first_day; // first day of current year/month while($todaydate <= $last_day){ if(isset($data[$todaydate])){ // there is at least one event on this date echo "$todaydate-<br />"; // output date for testing... foreach($data[$todaydate] as $row){ // $row is now the original fetched data for each event on the $todaydate date echo "{$row['id']}<br />"; // display id for testing... } } else { // no even on this date } $todaydate = date('Y-m-d',strtotime("$todaydate + 1 day")); // produce next date }
  19. Yes, you should not have a select query inside of a loop and execute it 28-31 times. The best way is to execute one query that gets the data for the current year/month all at once. You would then pre-proecess the data and put it into an array where the array index are the YYYY-MM-DD date values and the array data is your $row array for that date value. Then, as you loop through the days in the calendar you are trying to display, you use your existing $todaydate value to check for any matching data and to retrieve the corresponding data from the array.
  20. It's likely that the host-name/subdomain (www. vs no www.) in the URLs are changing back and forth (between having and not having the www. on them) and the session id cookie only matches the URL variation where it was set at and when you are redirecting around, you finally end up going between pages that all have the same host-name (or lack thereof) in the URL. The people who need to log in twice arrived at the login in form either through a link or through a short-cut/bookmark that has the opposite variation of the host-name from your header() redirect to the ....download/index.php page. You can confirm this by going to your log in form using a URL that works. Then either adding the www. (if the working URL doesn't have it) or removing the www. (if the working URL has it), then trying to log in to see if it takes two tries. If this is the case, here's some things you can do to fix the problem - 1) You should set up a .htaccess redirect to force all URL's to goto a single variation of your domain, 2) You should be constant in your code to always build links/redirects with the same variation of your domain, 3) You should set the session.cookie_domain setting to be .yourdomain.com (with the leading dot . ) to get the session id cookie to match all variations of your domain.
  21. Is your upload form a simple html form or is it doing something with javascript/ajax/flash that could potentially make the form invalid or prevent the submission of any actual data under certain circumstances? I would contact your web host to see if they have imposed some upload size policy that is outside of what the php settings can affect.
  22. This topic has been moved to PHP Coding Help. http://www.phpfreaks.com/forums/index.php?topic=351118.0
  23. Since this is a php coding issue, moving thread to that forum section ...
  24. What does adding the following three lines of code, immediately after the <?php tag show - ini_set("display_startup_errors", "1"); ini_set("display_errors", "1"); error_reporting(-1); What does the phpinfo(); output show for both the master and local 'post_max_size'? Any chance your server has the Suhosin hardened php patch installed as it can mess with the external data that can be submitted? Edit: also what php version and what does the phpinfo() output show for register_globals?
×
×
  • 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.