Jump to content

Update wont Update


ecabrera

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

Archived

This topic is now archived and is closed to further replies.

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