please

iam ask about

how can i delete and update from table ? :confused:

please i want example to delete data from table

and aother example to make update data from table

please help me :o

Recommended Answers

All 5 Replies

I use mysql... so in mysql its...
$sql = "DELETE FROM table WHERE field='value'";

or

$sql = "UPDATE table SET field='value' WHERE ...";

mysql_query($sql);

this is more of a basic SQL question then php...

I think he wants to know how to do it via php...

I think he wants to know how to do it via php...

that is how you do it. it would be

<?php

mysql_connect (mysql location, username, password) or die(mysql_error());
$tb_delete = "DELETE FROM tabl WHERE field='value'";
mysql_query($tb_delete) or die(mysql_error());

mysql_close();

that would be most of the code that you would see, or part of it.

thank you Killer_Typo


now i want to now how i can make update

thank you Killer_Typo


now i want to now how i can make update

should be around the same as what i said before, but use the UPDATE syntax. if you open up the mysql manual and do a search by going to edit, find on page. and type in the word you will most likely find all of the information you need to know about correct mysql syntax.


also i forgot to to mention that in the code that i listed above i forgot to add the line for selecting the correct databse. wich would be

$use = "USE database";

mysql_query($use) or die(mysql_error());

somthing along those lines should select the databse for the table you wish to modify (ive been writing my own custom database management tool, so ive been trying to get good with mysql syntax)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.