The SitePoint Forums have moved.

You can now find them here.
This forum is now closed to new posts, but you can browse existing content.
You can find out more information about the move and how to open a new account (if necessary) here.
If you get stuck you can get support by emailing forums@sitepoint.com

If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

delete and update

now i have a database and a from.
i can now insert data from a form into mydatabase but till now i'm trying to update data and i can not
after that i treid to delete data and i can not reach it also
can anyone help me

I don't see any code to insert data in the database. But anyway, the syntax for the update and delete statements in MySQL can be found at the links above.

One thing: Let's assume your table has a unique autoincrement key (let's say: HotelId). When you insert new data, this key value is not important (because it's generated by MySQL (autoincrement)), but when you want to update or delete a row, you'll have to pass this key value and use it in the query. You can use a hidden field in the form to do that.
If your table has another unique key (hotel name for example), then you'll have to use this value in your query.

If you had looked at the source code of your page you would probably have noticed the html error you made.

ps using the GET method to delete something makes it awfully easy for someone to delete everything in your table - in principle you should use GET to retrieve data, and a form with a POST method to alter data.

And also imagine what would happen if I placed something like this:
<img src="http://yoursite.you/delete.php?id=45"> as an image, say, in this forum...and while being logged into your webapp, you opened this page.
Take look at explanation of what Cross Site Request Forgery is and how to avoid it.
And as SilverBulletUK already pointed out - take look at what SQL injections are and how to avoid them.

i have a syntax error in update and i can not modify it
can u help me?$qryp = "UPDATE hotels SET
Hotel_Name='$hotel_name',
Tel='$tel',
Tel2='$tel2',
Fax= '$fax',
Contact_Person='$contact_person',
E-mail='$emal',
Notes='$notes'
WHERE id=$id";

1- i made a form and i post its value in this page
2- i echoed these values in my page so it works well 3- but i have a syntax error in mysql statment and i can not modify it
can u help me?