Jump to content

benanamen

Members
  • Posts

    2,134
  • Joined

  • Last visited

  • Days Won

    42

Everything posted by benanamen

  1. The last part could use some cleanup. if (mysqli_num_rows($result)) { return $result; } return false;
  2. OP, What is the point of adding another layer (Javascript) just to get a random value? Why not just generate in Php? And rather than tell us about your attempted solution to the real problem, how about tell us what the real problem is.
  3. For those of you that have not gotten the word, GitHub now offers FREE repository’s as of today.
  4. You could save yourself the trouble and just hire me. My posts on this forum and other coding forums speak for themselves as to my level of expertise.
  5. What makes you think ID's are in the POST array? The checkbox array is vehicle and the Select is missing the name attribute so nothing from that will be in the POST array.
  6. What you are talking about is called a Chained Select. Look it up.
  7. There are actually several common styles that have names. I personally prefer Whitesmith. Pick one and stick with it. http://www.terminally-incoherent.com/blog/2009/04/10/the-only-correct-indent-style/
  8. You have several problems. For one, the from is not the email in the form, it is the server sending the email. You have variables for nothing and the code is vulnerable to a header injection and you should be using POST, not REQUEST.
  9. For starters, your logic is off. Where does the data for $lender_list come from? A database?
  10. Beat me to it. Continuing the cycle of obsolete code and bad practices does not help anyone. A much better response would be to post an example up to current coding standards.
  11. Que the same old story... Your code is obsolete and has been completely removed from Php. You need to use PDO. https://phpdelusions.net/pdo
  12. That is the WORST way to ask for help. You have over 7 thousand posts and don't know how make a proper request for help? WHAT isn't working? What is the error message you get? What is the result? Is the missing brace actually in your code and you didn't post it here?
  13. No need to escape, just use single quotes on the elements.
  14. Where is the data coming from? A database?
  15. I smell an XY problem. OP, where does this array data come from? A database? How about showing the code how you come up with this array.
  16. Add 60 days to date <?php $date = new DateTime('2016-09-01'); $date->add(new DateInterval('P60D')); echo $date->format('Y-m-d'); ?>
  17. NO!, You always select the specific column names you want. DO NOT SELECT * Modify this to use the results of your query <!DOCTYPE html> <html> <head> <title></title> </head> <body> <form action="<?= $_SERVER['SCRIPT_NAME'] ?>" method="post"> <select name="sort_by"> <option value="">Select Option</option> <?php $array = array('id' => 'ID', 'name' => 'Name', 'amt' => 'Amount', 'status_filter' => 'Status'); foreach ($array as $key => $value) { $selected = isset($_POST['sort_by']) && $_POST['sort_by'] == $key ? 'selected' : ''; echo "<option value='$key' $selected>$value</option>\n"; } ?> </select> <input name="submit" type="submit" value="Submit"> </form> </body> </html>
  18. You are not going to get any help until you make a coherent post that includes a question
  19. Email me. See my Profile. Site wont allow you to get PM's yet.
  20. Forget about ajax. Lookup Mysql CRUD tutorials. You need to learn basic form html first.
  21. Yes. The form values will be available in the POST array. e.g $_POST['first_name']
  22. Your query is not valid. More importantly you are using obsolete mysql code that has been completely removed from Php. You need to use PDO. https://phpdelusions.net/pdo
  23. Forget about making a function, just learn how to use PDO. Start with a basic select. * In practice, you will not be using a variable for the table name. This is a really basic example. <?php $hostdb = 'localhost'; $dbname = 'your_DB'; $username = 'root'; $password = ''; $table = 'YOURTABLE'; $pdo = new PDO("mysql:host=$hostdb;dbname=$dbname", $username, $password); $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $sql = "SELECT * FROM $table"; $stmt = $pdo->prepare($sql); $stmt->execute(); $result = $stmt->fetchAll(); echo '<pre>'; print_r($result); echo '</pre>'; ?>
  24. Yeah, but you might as well start using PDO now. Study the link I posted.
×
×
  • 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.