473,386 Members | 1,823 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

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

Show.php--This is for showing movie names available in database

<?php
include "auth.php";
$query="SELECT movie_id,movie_name FROM moviesite";
$result=mysql_query($query,$link) or die("Can't execute
query" .mysql_error());
while($row=mysql_fetch_array($result))
{
$movie_id=$row['movie_id'];
$movie_name=$row['movie_name'];
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; ?>
">[DELETE]</a>
<?php
echo " <br/" ;
}

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

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

echo "Added to the database";
mysql_close($link);
?>
<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.

<?php
include "auth.php";

if($_REQUEST['action']==delete)
{
$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.
Baldaris

Oct 20 '08 #1
0 1366

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: pugnatio2 | last post by:
Hi, I'm a Zope newbie but an experienced Python programmer. Could someone suggest a general approach for the two parts below? 1) I'd like to build a system that stores XML documents in the...
3
by: Oren | last post by:
Hi, I have an Access application with linked tables via ODBC to MSSQL server 2000. Having a weird problem, probably something i've done while not being aware of (kinda newbie). the last 20...
87
by: Sony Music CDs install Malware | last post by:
Whether you are a web surfer or a C++ developer, if you use Windows be cautioned about SONY music CDs. They contain 'viewer' type software that is actually a trojan horse for a "rootkit". The...
1
by: Newbie | last post by:
in c# asp.net, how do i delete a file given the directory path and filename?
5
by: Meshuggah | last post by:
Hey All, Could somebody please tell me how to delete all files inside a folder using Visual Basic .NET 2003? (I know this may be basic, but forgive me, im newbie) Thanks in advance, ...
4
by: helenwheelss | last post by:
Access 2003, using a bound form. I'm seeing rather annoying behaviour when editing data in a control with a default value. It only happens when the form is on a new record. A specific...
1
by: =?Utf-8?B?TWFyZWs=?= | last post by:
Hi Sorry for the newbie question, but is it possible to stop the publish operation from Visual Studio 2005 deleting files in a specific folder on the web server? I have an uploads folder on the...
2
by: MartinRinehart | last post by:
I'm writing Python for the first time, today. Surprised to see that it doesn't check timestamps and recompile as needed. How do you get around this? Manually deleting the .pyc doesn't seem to...
13
by: Baldaris | last post by:
Show.php--This is for showing movie names available in database <?php include "auth.php"; $query="SELECT movie_id,movie_name FROM moviesite"; $result=mysql_query($query,$link) or die("Can't...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.