954,206 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

How can i deledet and update from table ???????

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

astm
Newbie Poster
5 posts since Jun 2004
Reputation Points: 10
Solved Threads: 0
 

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...

BinaryMayhem
Junior Poster
176 posts since Jun 2004
Reputation Points: 15
Solved Threads: 10
 

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

Slade
Practically a Master Poster
633 posts since Mar 2004
Reputation Points: 115
Solved Threads: 7
 
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.

Killer_Typo
Master Poster
781 posts since Apr 2004
Reputation Points: 152
Solved Threads: 39
 

thank you Killer_Typo


now i want to now how i can make update

astm
Newbie Poster
5 posts since Jun 2004
Reputation Points: 10
Solved Threads: 0
 
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)

Killer_Typo
Master Poster
781 posts since Apr 2004
Reputation Points: 152
Solved Threads: 39
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You