I am writing PHP code for a database that (for this particular file) will pull up a particular item within the database with the fields first name, last name, and prayer request. The idea is that you select the item and can edit either the first name, last name, or prayer request if there was a typo, misspelled word, etc. We do have column within database called REG_ID which allows you to choose which entry you want to change. When I click the “Approve Prayer Request Button” literally nothing happens. I think it is a problem with my mySQL statements but I have tried numerous things and cannot get it to work. I am wanting everything to be done within this file. Any suggestions would be GREATLY appreciated.
This file is named Approve Deny Prayer Request.
<?php $DB_HOST = "XXXXXX"; $DB_NAME = "XXXXXX"; $DB_PASS = "XXXXXX"; $DB_USER = "XXXXX"; $link = new mysqli($DB_HOST, $DB_USER, $DB_PASS, $DB_NAME); if($link->connect_errno > 0) { die('Connection failed [' . $db->connect_error . ']'); } $query = "SELECT * FROM Request"; $result = mysqli_query($link,$query); //<----- Added link $row = mysqli_fetch_array($result); if(isset($_POST['add'])){ $id = mysqli_real_escape_string($link,$_POST['REG_ID']); $firstname = mysqli_real_escape_string($link,$_POST['first']); $lastname = mysqli_real_escape_string($link,$_POST['last']); $phone = mysqli_real_escape_string($link,$_POST['phone']); $query2=mysqli_query($link,"UPDATE Request SET Reg_F_Name='$firstname', Reg_L_Name='$lastname',Reg_Request='$phone' WHERE id='$Reg_ID'" ); if($query2){ header("Location: fbcaltusprayerorg.ipagemysql.com"); } } // brace if(isset($_POST['add'])) ?>First Name: | "> |
Last Name: | "> |
Prayer Request: | "> |