Advertisement
CooLBuys1290

showName.php Code

Oct 2nd, 2023 (edited)
1,020
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.60 KB | Source Code | 0 0
  1. <?php
  2. include 'database.php';
  3. var_dump($_POST);
  4. $idSelected = $_POST['identification'];
  5. $query = $con->prepare("SELECT name FROM crud WHERE id=?"); // prepate a query
  6. $query->bind_param('i', $idSelected); // binding parameters via a safer way than via direct insertion into the query. 'i' tells mysql that it should expect an integer.
  7. $query->execute(); // actually perform the query
  8. $result = $query->get_result(); // retrieve the result so it can be used inside PHP
  9. $r = $result->fetch_array(MYSQLI_ASSOC); // bind the data from the first result row to $r
  10. echo $r['name']; // will return the price
  11. ?>
Tags: mysqli php
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement