PHP and MySQL noob - Printable Version -Shoutbox (https://shoutbox.menthix.net) +-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58) +--- Forum: Skype & Technology (/forumdisplay.php?fid=9) +---- Forum: Tech Talk (/forumdisplay.php?fid=17) +----- Thread: PHP and MySQL noob (/showthread.php?tid=37332) PHP and MySQL noob by Ezra on 01-22-2005 at 07:47 PM
I'm trying to make a webpage, that loads the info from my database, that works fine, and putting info in the database with my self made php works too. But i only want one row, so if i put new info in the database it overwrites the old info. code: But i don't undertand it , can someone help me? TIA RE: PHP and MySQL noob by RaceProUK on 01-22-2005 at 08:49 PM
INSERT is just adding a new record into the table. RE: PHP and MySQL noob by Dempsey on 01-22-2005 at 09:14 PM i think you just need to use UPDATE instead of INSERT, as INSERT makes a new record each time RE: PHP and MySQL noob by Ezra on 01-22-2005 at 09:19 PM
u mean i just use this?: code: Or am i just making a fool of myselve RE: PHP and MySQL noob by saralk on 01-22-2005 at 09:36 PM
code: basically make a table with all the data you want to store, and have a column called id, put one record in it, with the ID as 1, and then just run that script every time you want to update it RE: PHP and MySQL noob by WDZ on 01-23-2005 at 12:44 AM
quote:If there's only one row in the table, you don't need a WHERE statement in your query, because MySQL will update all the rows by default. Since there's only one row, "all" = "one." RE: PHP and MySQL noob by Ezra on 01-23-2005 at 12:59 AM
I want to post info from a form am i doing it right like this? code: EDIT: I'm using this but it gives an error, sorry i'm a real n00b , and yes i know i should read some books first, but i'm lazy ... code: RE: PHP and MySQL noob by WDZ on 01-23-2005 at 01:11 AM
code: RE: PHP and MySQL noob by Ezra on 01-23-2005 at 01:33 AM
It works, thank you very much RE: PHP and MySQL noob by WDZ on 01-23-2005 at 05:25 AM
quote:Oh, sorry... the addslashes() function should always be used on user-inputted data before it's placed in a query, just in case your copy of PHP isn't configured to add slashes automatically. I guess they are added automatically for you. What you could do is change that line of code above to... if(!get_magic_quotes_gpc()) $_POST['inhoud'] = addslashes($_POST['inhoud']); Then you won't need stripslashes. |