13 Replies - 8434 Views - Last Post: 08 January 2009 - 02:18 PM Rate Topic: -----

#1 _Umar   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 43
  • Joined: 24-December 08

How to edit n delete database records through PHP(In my computer not o

Posted 08 January 2009 - 07:03 AM

i made a registration from & i want to enable the admin to edit or delete, so can anyone help me out with it..plz

n u'll hav 2 enable short tags to make da program work properly
Is This A Good Question/Topic? 0
  • +

Replies To: How to edit n delete database records through PHP(In my computer not o

#2 Kirth   User is offline

  • D.I.C Head

Reputation: 9
  • View blog
  • Posts: 157
  • Joined: 09-July 08

Re: How to edit n delete database records through PHP(In my computer not o

Posted 08 January 2009 - 09:09 AM

Please post the code here using either [ Code = PHP ] CODEHERE [ / code ] (Note that there're no spaces between those) or the CodeBox BBCODE.

Quote

"Attached File assignment.zip ( 3.93k ) Number of downloads: 0"


Here at D.I.C. we will not code any homework, schoolwork, *work for you. However, we will help you with doing that on your own.
Was This Post Helpful? 0
  • +
  • -

#3 _Umar   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 43
  • Joined: 24-December 08

Re: How to edit n delete database records through PHP(In my computer not o

Posted 08 January 2009 - 09:16 AM

a bit more details:
I want to enable the user to edit and delete records from database(database is in my computer [localhost] ), n i made the functions to do that but i dont really know how to make them works. like when a user clicks on a a EDIT link in front of record number '2', how to tell the computer to fetch the record # 2 data to edit it..
I also need help with deleting a record from database..
i can retrieve the data to show it in list but dont know how to edit or delete it..So, please help.
i hav attached the pages i have made wit da database file in it.
Was This Post Helpful? 0
  • +
  • -

#4 _Umar   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 43
  • Joined: 24-December 08

Re: How to edit n delete database records through PHP(In my computer not o

Posted 08 January 2009 - 09:38 AM

View PostKirth, on 8 Jan, 2009 - 08:09 AM, said:

Please post the code here using either [ Code = PHP ] CODEHERE [ / code ] (Note that there're no spaces between those) or the CodeBox BBCODE.

Quote

"Attached File assignment.zip ( 3.93k ) Number of downloads: 0"


Here at D.I.C. we will not code any homework, schoolwork, *work for you. However, we will help you with doing that on your own.


yea i would love 2 do that, but here da problem, i made separate pages for everything. e.g
main Form page
main action page
records displaying page
Connection to database page
class n functions page.

So i cant really put da code here, thats y attached the files so that people can have a look if dey want to see the coding.
n yes i do know the rules if DIC, that's why i did works on it, went as far as i can go n den came here for help, im not askin u 2 make me one, i'm askin u to guide me by looking at what i have already made,

if u want more details or anything , just tell me i'll b happy to do that for you(if possible & worth it).

This post has been edited by _Umar: 08 January 2009 - 09:40 AM

Was This Post Helpful? 0
  • +
  • -

#5 CTphpnwb   User is online

  • D.I.C Lover
  • member icon

Reputation: 3837
  • View blog
  • Posts: 13,994
  • Joined: 08-August 08

Re: How to edit n delete database records through PHP(In my computer not o

Posted 08 January 2009 - 11:28 AM

View Post_Umar, on 8 Jan, 2009 - 08:38 AM, said:

if u want more details or anything , just tell me i'll b happy to do that for you(if possible & worth it).

You are the one asking the question. If you really want help, then you should be providing all necessary information in a format that is easily read. That means that in addition to doing your best to narrow down the problem and presenting the relevant code, you should use "I" and not "i", "here is the problem" and not "here da problem", "then" and not "den", etc.

If you know the rules of DIC, then why doesn't this:
"n yes i do know the rules if DIC..."
read like this?
And yes I do know the rules of DIC...



Your original post convinced me that you weren't serious about solving the problem so I haven't bothered to look at it. I'm sure that I'm not alone.
Was This Post Helpful? 0
  • +
  • -

#6 akozlik   User is offline

  • D.I.C Addict
  • member icon

Reputation: 92
  • View blog
  • Posts: 798
  • Joined: 25-February 08

Re: How to edit n delete database records through PHP(In my computer not o

Posted 08 January 2009 - 12:11 PM

Posted Image

Officer CTphpnwb on duty
Was This Post Helpful? 0
  • +
  • -

#7 CTphpnwb   User is online

  • D.I.C Lover
  • member icon

Reputation: 3837
  • View blog
  • Posts: 13,994
  • Joined: 08-August 08

Re: How to edit n delete database records through PHP(In my computer not o

Posted 08 January 2009 - 12:29 PM

Und you vill obey, or be sent off to the Russian front! B)

Seriously though, if you make a request for help that is difficult to read and contains extraneous information, why would you think anyone is going to respond with free help?
Was This Post Helpful? 0
  • +
  • -

#8 _Umar   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 43
  • Joined: 24-December 08

Re: How to edit n delete database records through PHP(In my computer not o

Posted 08 January 2009 - 12:32 PM

Alright, so about the 1st post yeah, i wrote it all wrong but then i gave the full information, & what do u mean by

Quote

doing your best to narrow down the problem
...huh..listen
I have read many post where experts told people that "they wont do you work, u have to do it & we can help u with any prob"

but at no place I read that" Hey i'm sorry you wrote 'i' not 'I' that's why we will not help you", I mean yeah ok I no that i am suppose to Use proper English. Correct grammar and spelling, but com'on man if u dont want to help just say it, whats with all dis pointing stuff n all, n if u had so much prob then y did u even bothered writing that post, should have left it.
Was This Post Helpful? 0
  • +
  • -

#9 akozlik   User is offline

  • D.I.C Addict
  • member icon

Reputation: 92
  • View blog
  • Posts: 798
  • Joined: 25-February 08

Re: How to edit n delete database records through PHP(In my computer not o

Posted 08 January 2009 - 12:35 PM

I think skyhawk needs to make a Grammar Police badge.

The point behind the whole grammar thing is to show how important it is to have good communication skills. This is especially true in the technical industry, because it's hard enough trying to describe a problem and its solution. When you add poor grammar to the mix, you're not going to get any help. Not only that but if u r talking lik dis, no1 will take u srsly.

This post has been edited by akozlik: 08 January 2009 - 12:36 PM

Was This Post Helpful? 0
  • +
  • -

#10 CTphpnwb   User is online

  • D.I.C Lover
  • member icon

Reputation: 3837
  • View blog
  • Posts: 13,994
  • Joined: 08-August 08

Re: How to edit n delete database records through PHP(In my computer not o

Posted 08 January 2009 - 12:44 PM

If you make a mistake or two, that's one thing. When you make lots of mistakes repeatedly, that's another thing entirely. Even your explanation is an assault on the eyes!

"they wont do you work, u have to do it & we can help u with any prob"
"They won't do your work. You have to do it and then we can help you with any problems."

Any one of these things is no problem, but you have multiple errors in the tiny span of 18 words! It's distracting to the reader. What's more, with such poor attention to detail in your writing, there's little doubt that it carries over to your code. That means even more work trying to fix it. If I were getting paid to do it, I'd want a raise! Since I'm not getting paid to do it, I'm not going to make that kind of effort.
Was This Post Helpful? 0
  • +
  • -

#11 akozlik   User is offline

  • D.I.C Addict
  • member icon

Reputation: 92
  • View blog
  • Posts: 798
  • Joined: 25-February 08

Re: How to edit n delete database records through PHP(In my computer not o

Posted 08 January 2009 - 12:47 PM

The whole key is readability. We must be able to read your questions and posts and understand what you're saying. Nobody on this site is getting paid to help people, so if you're not posting quality questions, you're not going to get quality answers.

Also, I suggest you read the "How to get better help on DIC" article in my signature.
Was This Post Helpful? 0
  • +
  • -

#12 _Umar   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 43
  • Joined: 24-December 08

Re: How to edit n delete database records through PHP(In my computer not o

Posted 08 January 2009 - 01:15 PM

Yeah now these are advise with logic. Now i agree with you people. Your right, but the way CTphpnwb said that, that's not cool man, I mean if your having so much problem reading it just don't Read it, leave it why bother to criticise, ...anyways thanks guys for all this, I will try to avoid it in future. :^:
And go on the page 2, I wrote all the details there.Thanks...!

This post has been edited by _Umar: 08 January 2009 - 02:24 PM

Was This Post Helpful? 0
  • +
  • -

#13 _Umar   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 43
  • Joined: 24-December 08

Re: How to edit n delete database records through PHP(In my computer not o

Posted 08 January 2009 - 02:12 PM

OK so here's my problem:
I made a registration form which takes input from the user, That information is saved in the database I made, I can Retrieve and display all the records currently saved in the database, Now there are two links in front of each record on the record display page Edit and Remove From Database, which enables the user to delete or edit any record from the list, Now here the problem. I can't figure out a ways to edit or delete a record on user's selection.
e.g these are the records saved in my database:

name_1 Edit Remove From Database
name_2 Edit Remove From Database
name_3 Edit Remove From Database
name_4 Edit Remove From Database

Now i want to know that if the user clicks on name_2 Edit or Remove From Database link, how can I tell the computer to go n fetch name_2 saved records from database to display them for editing.
In case of deleting, I want it to just ask for confirmation and delete the record from database. [info:I am making this website locally on my computer(Localhost) not online]
So, If anyone can direct me to a tutorial or an example, I will be great full to him.Thanks. :)
Was This Post Helpful? 0
  • +
  • -

#14 akozlik   User is offline

  • D.I.C Addict
  • member icon

Reputation: 92
  • View blog
  • Posts: 798
  • Joined: 25-February 08

Re: How to edit n delete database records through PHP(In my computer not o

Posted 08 January 2009 - 02:18 PM

You need to append the id of the item you want to delete to the link.

Sample:

<a href="edit.php?id=324">Edit</a>



Then on your edit.php page you would have something like

<?php
$id = $_GET['id'];
$id = mysql_real_escape_string($id);

$sql = "select * from table where id = '$id'";
$result = mysql_query($sql);

$row = mysql_fetch_assoc($result);

// Do whatever you want to the data.  I just print it out
print_r($row);

?>


Was This Post Helpful? 1
  • +
  • -

Page 1 of 1