Jump to content

mac_gyver

Staff Alumni
  • Content Count

    4,548
  • Joined

  • Days Won

    125

mac_gyver last won the day on May 6

mac_gyver had the most liked content!

Community Reputation

495 Excellent

About mac_gyver

  • Rank
    Staff Alumni

Profile Information

  • Gender
    Not Telling

Recent Profile Visitors

148,941 profile views
  1. how about doing the two tasks that were defined in your previous thread for this problem? producing navigation using all the rows of data and using the get input to query for the matching (one) row of data.
  2. start by getting php and the database to help you. do you have php's error_reporting set to E_ALL and display_errors set to ON, preferably in the php.ini on your system, so that php will help you by reporting and displaying all the errors it detects? do you have error handling for all the database statements that can fail - connection, query, prepare, and execute, so that you will know if and why they are failing? the easiest way of adding error handling for database statements, WITHOUT adding logic at each one, is to use exceptions for database statement errors and in most cases let
  3. a. any substitution or processing of output, should occur when you output the data, not when you store the data. b. if you have a need to store data containing sql special characters, quotes in this case, you would apply any escape_string() function or even better yet, simply use a prepared query, right before executing the query, not prior to content being added to the data that contains quotes.
  4. the sql query you are showing and the output you are (trying) to produce from that query make no sense. if this was working, you are querying for the row of data WHERE the id column matches the $_GET['id'] value and looping to produce a (one) link with ?id=$row['id'] in it, i.e. a link containing the same id that was in $_GET['id']. you need to step back and come up with a stateable definition of what your code needs to do. you are doing two things, 1) producing navigation links, and 2) when a link has been clicked, you are displaying the content that corresponds to the id in the clicked
  5. that's not the FromData object, as was mentioned, and the jquery .serialize() method doesn't include the file data.
  6. in order to upload a file using ajax, you need to use the FormData() object (current, best method) - https://developer.mozilla.org/en-US/docs/Web/API/FormData
  7. since a button of type = 'button' doesn't do anything by itself and you are outputting json encoded data back to the browser, what is the javascript/ajax code that's trying to upload the file?
  8. see the usort() function - https://www.php.net/manual/en/function.usort.php
  9. all you have done is replace the single $row = $query->fetch_assoc(); statement with one inside of a while(){} loop. how is that going to make this work? rather than starting new threads for the same problem, read the reply, on how to correct this, that you have already gotten in the first thread.
  10. just fetch all the rows of data into an appropriately named php array variable, then use the contents of that variable in your html document. if the variable is empty, no rows of data were matched. to display the number of rows of data, use php's count() function. to get a copy of the common values for displaying the one-time heading, just reference the zero'th row. to loop over the data, use a foreach(){} loop.
  11. database connections are resources. all resources on a web page are destroyed by php when the php script ends, i.e. you cannot pass a database connection in a session variable. you must make a new database connection on any page that needs one. as to the http 500 error, you have a php syntax error in the code on that page. find the php.ini that php is using and set error_reporting to E_ALL and display_errors to ON, so that php will help you by reporting and displaying ALL the errors it detects.
  12. your posted code has one technical issue, in that it only stores the last validation error in the $error variable, so, if there are multiple validation errors, you would only see the last error message. using an array to hold the error messages will solve this, and using the field name as the array index will let you test for and display the messages adjacent to the fields they belong with. i recommend displaying any error above or next to the field, rather than below it, in case the field is at the bottom of the screen and anything below it might not get seen. does your posted code oper
  13. external data can be anything and can come from anywhere. you must validate data on the server before using it. your form processing code should - detect that a post method form was submitted. trim, than validate all inputs, storing validation errors in an array, using the field name as the array index. if there are no errors (the errors array is empty), use the submitted data.
  14. a phone number, despite being called a number, isn't an integer. it is a formatted string consisting of 3 or 4 fields, depending on which country you live in and if you are including the country code with international numbers. the signed integer you are using (int(12) isn't even valid) can only hold a value up to 2147483647 (214 748 3647) which can only store some US phone numbers up to area-code 214. use a string data type and format the value into a common format before using it. once you define the column with a usable data type and as a unique index, just attempt to insert the
  15. when you exceed the post_max_size setting, both the $_POST and $_FILES arrays are empty, so, logic trying to use those values won't have anything to test. your post method form processing code should first test if a post method form was submitted. you can then compare the content-length (see $_SERVER['CONTENT_LENGTH']) value (which is in bytes) with the post_max_size (see ini_get('post_max_size') ) setting (which used to be in whatever units the setting is in - bytes or K, M, G short-notation, which may now be (unconfirmed) always in bytes due to the addition of the new Warning message f
×
×
  • 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.