Jump to content

Ultimatezai

New Members
  • Posts

    4
  • Joined

  • Last visited

Ultimatezai's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. print "<p style='color:red;'>Could not delete the blog entry because :<br/>' .mysqli_error($dbc)";
  2. Fatal error: Uncaught Error: Object of class mysqli could not be converted to string in C:\xampp\htdocs\php\delete_entry.php:97 Stack trace: #0 {main} thrown in C:\xampp\htdocs\ogani\delete_entry.php on line 97 <?php $dbc = mysqli_connect('localhost', 'root', ''); mysqli_select_db($dbc,'product'); if(isset($_GET['pname'])){ $query = "SELECT * FROM myproduct WHERE ProductName='{$_GET['pname']}'"; if($result = mysqli_query($dbc,$query)){ $row = mysqli_fetch_assoc($result); print '<form action ="delete_entry.php" method = "post"> <p>Are you sure you want to delete this entry?</p> <p><h3>' .$row["ProductName"]. ' </h3> </br> <input type ="hidden" name="pname" value="' .$_GET['pname'] . '"/> <input type ="submit" name="submit" value ="Delete this entry!"/></p> </form>'; }else{ print '<p style="color:red;">Could not retrieve the blog entry because :<br/> '.mysqli_error($dbc) .''; } } else if(isset($_POST['pname'])){ $query = "DELETE FROM entries WHERE ProductName= '{$_POST['pname']}'"; $result = mysqli_query($dbc,$query); if(mysqli_affected_rows($dbc) == 1){ print "<p> The blog entry has been delete.</p>"; }else{ print "<p style='color:red;'>Could not delete the blog entry because :<br/>' .mysqli_error($dbc)"; } } mysqli_close($dbc); ?>
×
×
  • 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.