Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Updating MYSQL fields
Old 05-02-2010, 05:22 PM Updating MYSQL fields
Experienced Talker

Posts: 43
Trades: 0
Ok i really need help with this cause i'm loosing my mind.
Im not a coder and i hate php but i need it on a little project.

Its got a real simple database, just 1 table with 3 fields (id,date,title).
And i need a simple php form/script so it can be updated, i searched for tutorials but there all way to complicated with user id's etc.
I dont need that, i just need a simple form that will update the fields.
I know how to connect to a database and how to print fields form a database with php, i just have no clue how i can update it with php.

So is there anyone who knows a tutorial or has a snippet that looks something like that?

Thnx in advance!
TheSir is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 05-02-2010, 05:32 PM Re: Updating MYSQL fields
Novice Talker

Posts: 9
Name: Jake
Trades: 0
Not sure what exactly do you mean but I think you're looking for this: http://w3schools.com/php/php_mysql_update.asp
ExPoint is offline
Reply With Quote
View Public Profile
 
Old 05-02-2010, 07:14 PM Re: Updating MYSQL fields
Experienced Talker

Posts: 43
Trades: 0
Well let me explain, its pretty simple.
I have a small database called 'news' with one table called 'ticker'.
In the table 'ticker' i have 3 fields ( id, date (VARCHAR so its just plain text) and title) en 3 rows.

My table looks like:
id date (VARCHAR) title (VARCHAR)
1 11/11/1111 test test 1
2 12/28/2010 test test 2
3 25/11/2010 test test 3

I know how to read/print it with php and that works just as i want it.
I just need to know how i can update it with a php/html form, for example i want to change 'test test 3' in 'hello world' or what ever with a php/html form.

I looked at several tutorials but most are not what i am looking for, to complicated with user id's and login sessions etc, i dont need all that.
I found one that is looking something what i need but that one doesn't work for me: http://www.freewebmasterhelp.com/tutorials/phpmysql/7
At least i cant get it to work.
TheSir is offline
Reply With Quote
View Public Profile
 
Old 05-03-2010, 10:55 AM Re: Updating MYSQL fields
Novice Talker

Posts: 9
Name: Jake
Trades: 0
Have a look at this page: http://www.codingforums.com/showthread.php?t=83422

I'm still learning PHP too but I'm sure I or someone else can help you when you get any errors in your script. Try to build something up so we can correct your code errors.
ExPoint is offline
Reply With Quote
View Public Profile
 
Old 05-03-2010, 11:56 AM Re: Updating MYSQL fields
lynxus's Avatar
Awesomeo-Maximo

Posts: 1,618
Location: UK
Trades: 1
Simply get your data from the html form
$title = $_POST['title'];
$oldtitle = "test test 2";

Then use a normal mysql_update.

IE:
UPDATE ticker SET title = '$title' where title = '$oldtitle' LIMIT 1


tizag.com have some great tutorials to do this ( shouldnt take long to worth through them )
__________________

Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE


lynxus is offline
Reply With Quote
View Public Profile Visit lynxus's homepage!
 
Old 05-04-2010, 08:13 AM Re: Updating MYSQL fields
Experienced Talker

Posts: 43
Trades: 0
Thanks guys, that was just what i was searching for.

"UPDATE ticker SET title = '$title' where title = '$oldtitle' LIMIT 1"

That works like a charm, i gave me the little push i needed to resolve my problem.
Thanks again and this thread can be closed, my problem is solved.
TheSir is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Updating MYSQL fields
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.93896 seconds with 12 queries