By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,304 Members | 1,242 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,304 IT Pros & Developers. It's quick & easy.

********Caution Newbie********editing and deleting from mysqldatabase

P: n/a
Show.php--This is for showing movie names available in database

include "auth.php";
$query="SELECT movie_id,movie_name FROM moviesite";
$result=mysql_query($query,$link) or die("Can't execute
query" .mysql_error());
echo $movie_id;
echo $movie_name;
<a href="update.php?action=edit&id=<?php echo $movie_id; ?>
">[UPDATE]</a ---I am not sure... What can i do to update and
delete record's from database -- User chooses which record to update
and delete
<a href="delete.php?action=delete&id=<?php echo $movie_id; ?>
echo " <br/" ;

<a href="add.php">[ADD]</a>
Add.php ---This is for adding movie names
include "auth.php";

$query="INSERT INTO moviesite (movie_id , movie_name) VALUES (' $id
' , ' $movie_name' ) " ;
if (!$sql)
die("Can not execute querey" .mysql_error());

echo "Added to the database";
<a href="show.php">Index</a>

Now this is the script which i am struggling with delete and update.
Now as far as i can understand i have to pass Movie_id to the
delete.php page and then use this variable to delete it..
But with this script when i execute it my entire list get's deleted.

include "auth.php";

$query="DELETE FROM moviesite where movie_id=' $movie_id ' LIMIT 1";
$sql=mysql_query($query) or die("Can not delete" .mysql_error());
<a href="show.php">Movie</a>

let me know what i am doing wrong ...and what exact querey will be
like..Atleast the concept.
Thank's and advance.

Oct 20 '08 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.