Jump to content

mac_gyver

Staff Alumni
  • Posts

    5,450
  • Joined

  • Days Won

    175

Everything posted by mac_gyver

  1. your SELECT query for building the form is not using the same database as your query in the form processing code.
  2. when you were importing the data, did you trim the values, because the last field in each line probably has a new-line character on it.
  3. should produce your existing output (you had an extra , at the end of your existing output that was not valid) - addresses = [ <?php echo '"'; echo implode('","',$addressList); echo '"'; ?> ];
  4. i'll bet if you show where this data is actually coming from (query/xml...) and what your code is now, someone could show you a solution that would work for the actual data.
  5. you should actually be using a virtual host setup on your localhost system so that there isn't any difference in the path (you can find how to do this common task by using google.)
  6. the direct answer to your question is that you DON'T use an incrementing series of variable names. you use an array where the index is what increments.
  7. so, then my question becomes - how do you know what group the current visitor is in? you would need to use that information in the query, wouldn't you? your query contains NOTHING that ties it to the current visitor, therefore it cannot work and needs to contain something that contains the group membership of the current visitor.
  8. slightly off topic, but you need to limit the $page value so that it is between 1 and $total_pages (inclusive) so that someone cannot produce query errors by feeding in a zero or a negative number or feeding in a value greater than the number of pages and wasting time running a query that won't return any rows. the code to produce $total_pages needs to come before the code producing $page and then you need to add a little logic to limit the value in $page.
  9. you need to use htmlentities() on any "content" that you output that may contain characters that have meaning in the html/javascript context they are being output in.
  10. did you BOTHER to try it on your localhost server?
  11. $_SERVER['DOCUMENT_ROOT'] is the file system (disk) path to your document root folder. it is NOT used in html links/href statements on a web page. you must use a URL in links/href statements. you can use a domain relative URL - href="/css/style.css" (the leading slash refers to the root of the domain of the current page.) or you can use an absolute URL - href="http://<?php echo $_SERVER['HTTP_HOST']; ?>/css/style.css"
  12. you need to build the sql WHERE whatever conditions you have in a php variable so that you can use that WHERE condition in both queries. right now $keywords is an array, it's not a complete and valid sql conditional statement. if you want to find row(s) with ANY of the keywords in the title, you need to form a query using OR logic. if you want to find row(s) with ALL the keywords in the title, you need to form a query using AND logic. for example, if you enter two keywords in the search and want to match either keyword, your queries would need to look like - SELECT COUNT(*) FROM your_table WHERE title LIKE '%keyword1%' OR title LIKE '%keyword2%' SELECT * FROM your_table WHERE title LIKE '%keyword1%' OR title LIKE '%keyword2%' ORDER BY title ASC LIMIT $start_from, $rows_per_page correctly building the WHERE condition (in bold) is what your immediate task should be.
  13. how do you know who the current visitor is in your code? you would need to use that information in the query, wouldn't you?
  14. that datepicker always required an id=' ... ' to work.
  15. you have too much code, to write, test, reenter, change, add items to, reuse for different things... by defining an array to hold your data, you can write/test generic code that you can reuse for different things simply by changing the data definition - <?php $options[1] = "Amulet"; $options[2] = "Head Gear"; $options[3] = "Epaulets"; $options[4] = "Shield"; $options[5] = "Chest Gear"; $options[6] = "Weapon"; $options[7] = "Ring"; $options[8] = "Boots"; $options[9] = "Gloves"; $options[10] = "Backpack"; ?> <select size="1" name="slot"> <option value="">Pick One</option> <?php $item_slot = 2; // test value foreach($options as $value=>$legend){ $selected = $item_slot == $value ? " selected='selected'": ''; echo "<option value='$value'$selected>$legend</option>\n"; } ?> </select>
  16. you are not passing the $db instance of the pdo class into the function (like you are doing in the other functions that work), so of course there will be a not an object error.
  17. the code is using shell_exec to run the aspell spell checker and for a scheduler.
  18. as a continuation of the above reply - it would take profiling the code to get a list of the functions it does use, incorporating that list into the installation script, then comparing it with the disabled functions. i doubt there are many installation scripts with that much detail in them and in fact i doubt the author of this script even has a list of functions the code does use. here's one way you could find if the code is using any of those disabled functions. using a programming editor that searches all the files within a project/folder, search for each function name in turn to see if it is used in the code.
  19. does the installation stop or is there just a warning that some disabled functions were found and some features may not work? except for perhaps parse_ini_file, a safe/securely written CMS would have no business using any of those other functions.
  20. $item_id = $_POST['$item_id']; should be $item_id = $_POST['item_id']; are you even trying to debug these errors?
  21. how do you know that? what is it doing and what do you expect it to do?
  22. you need to echo out $sql so that you can see what it actually is at the point where the error is being reported. i'll guess the value in $_POST['facility_provider_number'] is empty, resulting in sql syntax of 'some value',,'some value'
  23. that's because you are using short opening php tag <? and your .php code is not running. use a full opening php tag <?php
  24. i'm not sure what previous time you are referring to, but for the line of code in this thread, DavidAM told you in your previous thread that one equal sign means that you are making an ASSIGNMENT, not a comparison - an argument can be made that you need === (three equal signs, a value and type match) for this line of code, since your image uploader script isn't testing if the $_FILES array is even set/not-empty. when $_FILES is empty due to an error or an upload form has not been submitted (your code isn't testing if any form was submitted), an empty $_FILES array will match a zero using two == signs. using three === (a value and type check), will only be successful if the $_FILES array is not empty and the ['error'] is a zero value. FYI, why you need to learn the meaning of the code - one = sign is an assignment operator i.e $var = some_value;. when used in a conditional test - if($var = some_value) ... while($var = some_value) the assignment is made and the value that was assigned is used in the conditional test. two == signs is an equal value test (the types can be different i.e null/empty is == to a 0.) three === signs is an exact value test (the value and types must be the same i.e. null/empty is not === 0.)
  25. you must bind a variable to each field that is selected. by using SELECT *, no one knows just by looking at the query how many fields there actually are and there are apparently more than the 5 fields that were listed. you need to SELECT the actual fields that you want in the query so that you will have the information in front of you to bind all the selected fields.
×
×
  • 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.