Jump to content

PFMaBiSmAd

Staff Alumni
  • Posts

    16,734
  • Joined

  • Last visited

  • Days Won

    9

Everything posted by PFMaBiSmAd

  1. Actually, I found the problem through trying your code - ^^^ That's not the name of the error message array you are setting values into. You should be developing and debugging your code on a system with error_reporting set to E_ALL and display_errors set to ON so that php will help you by reporting and displaying all the errors it detects. You will save a TON of time.
  2. What is the 'view source' of the page in your browser after you submit the form?
  3. Without the 'view source' in your bowser of your form page (no one asked for the raw .php file), I'm going to guess that some of your database data contains htmlentities that is breaking the HTML of your page. All data and content (that is not specifically HTML tags) should be passed through the htmlentities function with the second parameter set to ENT_QUOTES so that the data and content does not break the HTML on your page. Edit: If the first code you did post is the 'view source' in your browser, that would mean that php is not installed and running on your server or you browsed directly to the .php file through the file system, instead of entering the URL of the file in your browser's address bar.
  4. You should not be using the bbcode tags anyway, since they add new lines after every tab/white-space and makes copying code to help someone ridiculous (there's a reason there is not a fourm/post menu button for the bbcode tags.) Just use the (# menu button) bbcode tags.
  5. What does a 'view source' in your browser of the form page show and what does a 'view source' in your browser of the blank page show? The short answer to all this is - we only see the information you supply in your posts. Without all the actual code necessary to reproduce the problem, we cannot really help.
  6. show is a reserved mysql keyword. You either need to rename your column or you must enclose `show` in back-ticks every time you use it as a column name in your queries.
  7. <style type="text/css"> <?php include_admin_css('styles.css'); ?> </style> ^^^ If that doesn't work, you will need to be specific about what it actually outputs into the 'view source' of the page in the browser and/or what it does do vs what you expect. Is the actual path/filename that is produced by - ADMIN_TEMP.DS.$name.DS.'css'.DS.$css what you expect and it exists?
  8. First problem - Using echo include(... ...); will echo a true/false value (1/null) (or a value you return inside the included file) followed by any output that the included file produces. Using echo in front of the include() statement does not echo the content that is being included. Remove the echo (you are likely getting a '1' echoed in the content.) Second problem - BUT ITS ALL THE SAME. No it's not. <?php include_admin_layout('header.php'); ?> <--- that includes the header.php file into the calling script and outputs anything that the header.php file produces. <link type="text/css" rel="stylesheet" href="some_URL_of_a_css_file" media="screen,projection,tv"/> <--- that expects a URL to an external css file, not the actual css. If you instead used inline css, what you are trying would work.
  9. <?php if($_FILES['your_file_field_name_here']['name'] == 'abc.csv'){ // name is abc.csv } else { // name is something else }
  10. Due to mysql's query cache, any timing differences seen between repeatedly executing two different queries are in the time taken to send the query statement from php to the mysql server and the parsing of the query statement on the mysql server, because after the first time each of the two different queries is executed, the result set for each specific query statement is held in the query cache. The only thing you can determine from this is that a shorter query statement takes less time to send and to parse. You would need either disable the query cache or cause a change to the table data between each query so that the cache is flushed to actually see any timing difference due to the query being used.
  11. Use the following in your query statement - ORDER BY start_position
  12. The $database variable is not an object. You would need to troubleshoot why include("database.php"); either isn't including the file or why the database.php code isn't being seen as php code or isn't creating an instance of the database class in the $database variable.
  13. You have two name="..." attributes in the <input > field, making the HTML invalid. You also don't have a <form ...> tag, unless you deleted that from the post. Different browsers handle HTML errors differently.
  14. Your form is probably not submitting what you think it is. What does the following (added immediately after the <?php tag) show - echo '<pre>',print_r($_POST,true),'</pre>';
  15. The error is caused by the output on line 480 (and 479.)
  16. Assuming that you can read the whole file into memory (what your code is doing now with the file() statement), the following will match the address portion of each line - <?php // 403089 RESIDENTIAL Residential 385000 7610 N Lakeshore Dr. Harbor Springs S 3 2 0 None ... $file = 'listingsTest.txt'; $string = file_get_contents($file); $pattern = "/\d+\s+\w+\s+\w+\s+\d+\s+(.*?)\s+S\s+\d{1}\s+\d{1}\s+\d{1}"; preg_match_all($pattern,$string,$matches); echo '<pre>',print_r($matches[1],true),'</pre>'; ?>
  17. A couple of questions - 1) Are there always 4 fields (i.e. 403089 RESIDENTIAL Residential 385000) before the start of the address? 2) Is the 'S x y z' pattern at the end of the address always an S followed by 3 numbers? 3) How about addresses that contain an 'S' for South (i.e. 7610 S Lakeshore Dr. Harbor Springs)? With those answers, someone can probably come up with a preg_match that will get the address using one statement.
  18. Nope. The php code is executed on the web server when the page is requested. Only the output from the php code would exist inside the javascript when the javascript is executed in the browser. What exact problem are you trying to solve?
  19. Please read the first three sections of the php.net upload handling documentation - http://us.php.net/manual/en/features.file-upload.php
  20. WHERE EXTRACT(YEAR_MONTH FROM reviewdate) = EXTRACT(YEAR_MONTH FROM CURDATE())
  21. Any time you have a set of related data that is processed identically and only differs in the name or value, you should let the computer do the work for you by using an array/loop to both produce the form and process the data.
  22. No, connections stay open unless your code does something to the connection or something to the variable holding the link resource. Also, in your grab_expiration_date() function, by making a new connection each time the function is called and closing that connection, you are wasting a lot of time reestablishing the remote connection each time the function is called. To get around this you can either - A) Make the remote connection in your main code and pass it into the grab_expiration_date() function as a call time parameter or B) Use a static variable inside the function to hold the connection link and add logic to reuse that connection instead of calling mysql_connect() each time the function code runs. You would also need to remove the mysql_close() statement inside the grab_expiration_date() function.
  23. If you post the actual code that fails and corresponds to the error message, someone can help with the problem.
  24. Your code also contains a reference to a $link variable. Does that exist? You should be developing and debugging your code with error_reporting set to E_ALL (or to a -1) and display_errors set to ON so that php will help you by reporting and displaying all the errors it detects. Add the following two lines of code immediately after your first opening <?php tag on the page - ini_set("display_errors", "1"); error_reporting(-1);
  25. Slightly off topic (isn't likely to be causing the error), but the 4th parameter of mysql_connect() is not the database name.
×
×
  • 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.