Jump to content

Update wont Update


Go to solution Solved by Ch0cu3r,

Recommended Posts

<php

if($_GET['del']){

require "scripts/db.php";

$deleteid = $_GET['del'];

$del = "UPDATE `playlist` SET `delete`='1' WHERE `id`='$deleteid' AND `userid`='$user'";
$deleted = mysqli_query($db,$del);

$msg = "Video Deleted";

}


?>

ok the code above should update but it doesnt i dont know whats wrong When i run the sql on phpmyadmin it works but when i try it online it doesnt.

 

here is the whole script

<?php 
OB_START();
require "header.php"
 ?>
<?php if($user){ ?>

Welcome <?php echo $user; ?>

<a href="logout.php">Logout</a>
<br><br>
<a href="createp.php">Create a Playlist</a>
<br><br>
Delete a Playlist
<br><br>
<a href="editp.php">Edit a Playlist</a>

<div id="CreateHome">
<center>
<?php echo $msg; ?>
<h3>Delete a Playlist</h3>


<php

if($_GET['del']){

require "scripts/db.php";

echo $deleteid = $_GET['del'];

$del = "UPDATE `playlist` SET `delete`='1' WHERE `id`='$deleteid' AND `userid`='$user'";
$deleted = mysqli_query($db,$del);

msg = "Video Deleted";

}


?>

<?php

require "scripts/db.php";

//getting the users id 
$get = "SELECT * FROM `users` WHERE `username`='$user'";
$getit = mysqli_query($db,$get);
$rows = mysqli_fetch_assoc($getit);
$userid = $rows['id'];

//using the id we got and selecting all his playlists
$getplay = "SELECT * FROM `playlist` WHERE `userid` = '$userid'";
$getplayquery = mysqli_query($db,$getplay);
while($row = mysqli_fetch_assoc($getplayquery)){

$pid = $row['id'];
$playlistname = $row['name'];

echo "$playlistname <a href='deletep.php?del=$pid'>Yes</a><br>";

}

?>
</center>
</div>

<?php
}else{
header("LOCATION: http://mysite.com/");
}
?>
<?php require "footer.php";?>
Link to comment
https://forums.phpfreaks.com/topic/283333-update-wont-update/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.