Welcome Guest ( Log In | Register)



 
Reply to this topicStart new topic
> Editing Information In A Mysql Database And Deleting Rows
Mystixs
post Feb 1 2007, 01:12 AM
Post #1


Member [Level 1]
****

Group: Members
Posts: 57
Joined: 23-January 07
Member No.: 37,683



I need help with a couple of things.
First, I need to know how to retrieve information from a mysql database and edit it then re add it to the database.

I also would like to know how to easily delete a mysql row.

And I want this done without going to phpMyAdmin.

Thanks for the help!
Go to the top of the page
 
+Quote Post
jlhaslip
post Feb 1 2007, 01:45 AM
Post #2


A computer once beat me at chess, but it was no match for me at kick boxing.
Group Icon

Group: [MODERATOR]
Posts: 3,880
Joined: 24-July 05
From: In Trouble Again... still?
Member No.: 9,787
Spam Patrol



It will require some server-side coding. Php is commonly used.
Here is a link to a previous topic which deals with the delete aspect.

http://www.trap17.com/forums/how-delete-ro...sql-t43451.html

Hope this helps.
Go to the top of the page
 
+Quote Post
Mystixs
post Feb 1 2007, 01:48 AM
Post #3


Member [Level 1]
****

Group: Members
Posts: 57
Joined: 23-January 07
Member No.: 37,683



Well. I did that thread and for some reason I can't understand it...

Btw, I know it uses PHP and Mysql.
Go to the top of the page
 
+Quote Post
shadowx
post Feb 1 2007, 03:33 PM
Post #4


A clever man learns from his own mistakes, a WISE man learns from those of OTHERS
*********

Group: [HOSTED]
Posts: 884
Joined: 12-April 06
From: Essex, UK
Member No.: 21,719



Hey there, for a basic example of UPDATE check this: http://www.tizag.com/mysqlTutorial/mysqlupdate.php

If you click on the "next" link then youll see an example of delete also.

i think its worth expanding on this part though:

QUOTE
// Get Sandy's record from the "example" table
$result = mysql_query("UPDATE example SET age='22' WHERE age='21'")
or die(mysql_error());


i dont like the WHERE part of this example so let me show how i would explain...

we will assume that there is a table of say usernames and passwords called "users" and a user wants to change their password. So of course they login and put the new password and click a button to change their password. the php code to edit the field "password" in the DB and change it to their new password would be like this assuming their username is "bob" and their old password was "bobspass" and their new password is "bobnew":

CODE
$result = mysql_query("UPDATE users SET password='bobnew' WHERE username='bob'")
or die(mysql_error());


simple smile.gif

the syntax for update is:
CODE
UPDATE table_name SET field_name='New_value' WHERE field_name='Old_value'


and DELETE is:
CODE
DELETE FROM table_name WHERE field_name='a_value'


If you need help with connecting to the database etc just ask and we will be glad to help. I wont post it now but if you need any more help just ask!
Go to the top of the page
 
+Quote Post
Saint_Michael
post Feb 2 2007, 02:02 AM
Post #5


$p4m 0n j00 $h4m3 m3 0nc3 $p4m 0n m3 $h4m3 m3 7\/\/1c3
*********************

Group: [HOSTED]
Posts: 6,305
Joined: 21-September 04
From: 9r33|\| 399$ 4|\|D 5P4/\/\
Member No.: 1,218
T17 GFX Crew



I know I have seen several tutorials on pixel2life about adding tables and info, can't think of the links of the top of my head but I have some others, I know posts some links about mysql db's but have to look for it later and let you know.
Go to the top of the page
 
+Quote Post
Mystixs
post Feb 2 2007, 05:09 AM
Post #6


Member [Level 1]
****

Group: Members
Posts: 57
Joined: 23-January 07
Member No.: 37,683



Well, I got the delete thing to work. I will add edit at a later time. Thanks for the help.
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. Problem On Mysql "order By"(5)
  2. Increment A Mysql Column(6)
  3. Can You Add Images Into A Mysql Database?(20)
  4. Creating Profiles In Php/mysql ?(7)
  5. Php Search Engine Script For Mysql Database(11)
  6. Some Mysql Basics(4)
  7. Getting Information From Submit Button(1)
  8. How To Insert Post Information Without A Form(1)
  9. Getting Php 5 To Work With Mysql(0)
  10. Problem With A Mysql Join(2)
  11. Can Database Column Names Start With A Number?(1)
  12. The Artists Tutorials :mysql Basic Commands(0)
  13. Connecting Php Site To Database(6)
  14. Php And Flash Image Gallery(5)
  15. [mysql]get Id Of Loged In User?(7)
  1. [mysql/php]need Som Basic Help(13)
  2. [php/mysql]id Trouble [resolved](3)
  3. Mysql Won't Update(4)
  4. Php + Mysql Question!(4)
  5. Tools Needed!(9)
  6. Best Sites For Learning Php-mysql(4)
  7. How Do I Connect To Live Database With Php Script?(6)
  8. Ms-access Database Question(3)
  9. Php And Mysql Programming(2)
  10. Best Php And Mysql Editor For Noobs(6)
  11. Html Form!(4)
  12. Mysql Error(3)
  13. Create Table - Mysql Code - Help(1)


 



- Lo-Fi Version Time is now: 25th July 2008 - 09:45 AM