Jump to content

PFMaBiSmAd

Staff Alumni
  • Posts

    16,734
  • Joined

  • Last visited

  • Days Won

    9

Everything posted by PFMaBiSmAd

  1. You already have a thread for this same problem, where one of the forum's Gurus answered with the most likely cause and the fix for the problem.
  2. I'm going to guess you are NOT going to fix your data structure. The code necessary to dynamically build the query is a straightforward programming exercise (tested to the point of producing the query string) - <?php // function to 'increment' the month w/year rollover function next_table($current_table){ $yr = substr($current_table, 0, 4); $mo = (int)substr($current_table, 4,2); // month w/o leading zero $mo++; if($mo > 12){ $mo = 1; $yr++; } return $yr . str_pad($mo, 2, '0', STR_PAD_LEFT); } // The following example is inclusive of the start and end dates (due to the BETWEEN ... AND ... syntax). If you want to exclude either or both the start/end date, the code must be modified. $start = '2009-01-01'; $end = '2010-06-01'; if($start >= $end){ echo 'Date range error, the starting date is not less-than the ending date.'; } else { list($start_year,$start_month,$start_day) = explode('-',$start); list($end_year,$end_month,$end_day) = explode('-',$end); $current_table = $start_year . $start_month; // initialize before loop (yyyymm) $end_table = $end_year . $end_month; // end condition $query = "SELECT * FROM report{$current_table} WHERE date BETWEEN {$start} AND {$end}"; // base query $current_table = next_table($current_table); // get the next table while($current_table <= $end_table){ $query .= "\n UNION SELECT * FROM report{$current_table} WHERE date BETWEEN {$start} AND {$end}"; // append union query $current_table = next_table($current_table); // get the next table } echo "<pre>$query</pre>"; } // version that excludes the end date // If the end date is the first day of a month, this query will include that year/month table but won't match any data in that table. // This allows that table to be included in the query in case the date is not the first day of the month w/o needing any extra logic. $start = '2010-01-01'; $end = '2011-01-01'; if($start >= $end){ echo 'Date range error, the starting date is not less-than the ending date.'; } else { list($start_year,$start_month,$start_day) = explode('-',$start); list($end_year,$end_month,$end_day) = explode('-',$end); $current_table = $start_year . $start_month; // initialize before loop (yyyymm) $end_table = $end_year . $end_month; // end condition $query = "SELECT * FROM report{$current_table} WHERE date >= {$start} AND date < {$end}"; $current_table = next_table($current_table); // get the next table while($current_table <= $end_table){ $query .= "\n UNION SELECT * FROM report{$current_table} WHERE date >= {$start} AND date < {$end}"; $current_table = next_table($current_table); // get the next table } echo "<pre>$query</pre>"; } ?>
  3. You are probably exceeding the post_max_size setting, in which case the $_FILES array is empty and $_FILES['uploaded'] won't exist - http://us3.php.net/manual/en/ini.core.php#ini.post-max-size You must always validate data that comes from a visitor. In the case of an uploaded file you must test if $_FILES is not empty before attempting to process any of the uploaded file information. You must also test $_FILES['uploaded']['error'] to check for other errors that can occur (such as exceeding the upload_max_filesize) - http://us3.php.net/manual/en/features.file-upload.errors.php
  4. As you just discovered, storing same type data across more than one table makes for extremely inefficient and overly complicated coding. Is there some reason you don't have a single table? You could then simply query for the range of dates you want. SELECT your_columns FROM your_table WHERE date BETWEEN some_start_date AND some_end_date
  5. $query = "SELECT seller, COUNT(seller) FROM adverts WHERE seller = '{$_SESSION['SESS_LOGON_NAME']}'";
  6. You are apparently using mysql_. If you echo mysql_error(); on the next line after where you are executing the query, it will tell you why the query failed.
  7. Phone numbers, despite being called numbers are actually formatted strings of numeric digits and separator characters. I also hope your field type in your table is not numeric because only the first three characters before the first - will be stored in a numeric field. You need to surround your phone numbers in single-quotes so that they will be treated as a string instead of a mathematical expression.
  8. What does a phpinfo(); statement show for those settings and what is your code for both the form and the form processing code? Edit: And while it is not related to your upload size problem, the page at the URL you posted contains 56 markup errors - http://validator.w3.org/check?uri=http%3A%2F%2Fcustomcufflinks.co.uk%2Fproduct-list%2F97_Create-your-Own-Rectangle-Cufflinks.html&charset=%28detect+automatically%29&doctype=Inline&group=0&ss=1
  9. Some reason you started a new thread for this same problem instead of sticking with your existing thread - http://www.phpfreaks.com/forums/index.php/topic,301775.0.html
  10. This problem was continued in a different thread.
  11. And since this problem concerns the DOM in the browser, how it is processed, and php has nothing to do with the problem, moving thread to the javascript forum section...
  12. Now that you have bothered to show what you are doing and what your code really is (you could have solved this 2 days a go in your original thread on this problem), here are a couple of solutions - http://www.webdeveloper.com/forum/archive/index.php/t-136026.html Your str_replace() is not doing anything because the strings you are searching for don't exist (and if they did, outputting < and > would break the HTML) - <?php $sumz= "car1>>car2"; $textareatext = $sumz; echo "<div style='display:none;' id='1'>". htmlentities($textareatext) ."</div>"; echo "<table><tr><td onmouseover='Test(1);'>test </td></tr></table>"; echo "<br /><br /><textarea name='reply' id='reply' style='color: #000000; overflow: hidden; font-size:15px; height:52px; width:500px; text-align: left' readonly='readonly' >test</textarea>"; ?> <script type="text/javascript"> function get_ents(str){ var temp=document.createElement("pre"); temp.innerHTML=str; return temp.firstChild.nodeValue; } function Test(number) { var newtext = document.getElementById(number).innerHTML; document.getElementById('reply').value = get_ents(newtext); } </script>
  13. Most of the quotes in your HTML markup are smart-quotes/curly-quotes (i.e. ” and “) Your HTML markup should only contain straight quotes " or '
  14. ^^^ you need to turn that setting ON.
  15. A) What problem or error are you getting with your code that you need help with or what specific programming question do you have? B) We don't do homework, we help with specific coding problems, errors, or questions you have. C) We don't write code based on lists of requirements. There is a freelancing forum section if you want someone to do this for you.
  16. A leading / on a file system path refers to the root of the current hard disk. I suspect that you want - "users/$directory" or that you want to form an absolute file system path made up of your document root path followed by /users/$directory
  17. ->store_result() will always return a BOOL (true or false.) All ->store_result() does is buffer all the rows. You must use $ug_stmt->fetch() to fetch those rows or use $ug_stmt->result_metadata(); to return a result object so that you can use the result object to access the result set.
  18. The way that you display the data you retrieve with your query is up to your 'presentation' logic and this is not a mysql question. So, moving this thread to the php programming help forum section ...
  19. I'm not sure, but I think you are missing how the client (browser) and web server (and any server side scripting language, like php) interact. When you are 'viewing' a web page, the only thing you see and interact with in the browser is what the server has already sent to the browser. The web server and any php server-side script on a page has normally finished executing (unless your page takes a long time to generate on the server) by the time you see anything in the browser. You are not directly interacting with the web server and any php script you have on a page. The web server/php is not specifically sitting there waiting for a response from the browser due to a page that was just output. The web server has gone on to service other http requests and in fact it does not know or care about any http request before or after the current one. When you finally click on a link or submit a form in the browser, the browser makes a HTTP request to the web server and the web server does its' best to service that unique http request.
  20. You have got to be kidding. The header redirect statement header(....); is a line of php code. If you put it outside of the <?php ?> tags, it is no longer php code, it is a line of HTML content that is output to and rendered by the browser as some text on your page.
  21. Use the DEFAULT keyword -
  22. You can turn on the short_open_tag setting in the master php.ini or in a local php,ini (if php is running as a CGI application and a local php.ini is supported.)
  23. No it doesn't. The only way it will do what you state is if the data has htmlentities() applied twice.
  24. You would need to use - mysql_data_seek Edit: Actually, since you are just processing the same data the same way each pass through the outer loop, it would be better if you formed the content in a variable and then just echo the contents of that variable anywhere you need it. No need to loop through the result set each time. If you were processing the data differently each time you accessed it, then reusing the result resource would make sense.
  25. http://us.php.net/manual/en/book.simplexml.php#95922 Should (untested) work - echo $advertisers->advertisers->advertiser[0]->{'advertiser-id'};
×
×
  • 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.