ecabrera Posted October 27, 2013 Share Posted October 27, 2013 <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";?> Quote Link to comment https://forums.phpfreaks.com/topic/283333-update-wont-update/ Share on other sites More sharing options...
Solution Ch0cu3r Posted October 27, 2013 Solution Share Posted October 27, 2013 The <php should be <?php Quote Link to comment https://forums.phpfreaks.com/topic/283333-update-wont-update/#findComment-1455674 Share on other sites More sharing options...
ecabrera Posted October 27, 2013 Author Share Posted October 27, 2013 Thank you i guess this means i have to take a break since i couldnt see this Quote Link to comment https://forums.phpfreaks.com/topic/283333-update-wont-update/#findComment-1455677 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.