What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Skype & Technology » Tech Talk » php coding help

2 votes - 5 average   php coding help
Author: Message:
WDZ
Former Admin
*****

Avatar

Posts: 7106
Reputation: 107
– / Male / Flag
Joined: Mar 2002
RE: php coding help
quote:
Originally posted by k776
Sorry WDZ, I meant to say infomation/text, not actual files :$
Well, it shouldn't be too hard. First you might want to do some validation of the values that were submitted, though that's not as important if only trusted people can submit.

code:
if(!$_POST['name']) {
    die("You must enter a name!");
}

You could also check to make sure the length isn't too long and stuff like that. Next you should make sure the data is ready to be used in a query by applying addslashes()...

$name = addslashes($_POST['name']);

However, this step might not be needed if your server has magic quotes enabled, because that will automatically add slashes. Running the function again will result in doubled slashes, which is annoying. :dodgy:

Now to actually insert the data...

mysql_query("INSERT INTO tablename (name) VALUES ('$name')");

That's an example of inserting just one field. To insert all the fields you listed, you'd do something like this...

mysql_query("INSERT INTO tablename (catid,mplink,name,dllink,desc,rate,type,pic) VALUES ('$catid', '$mplink', '$name', '$dllink', '$desc', '$rate', '$type', '$pic')");

I don't know what all your fields are for, so I can't give a perfect example. Also, you'd have to call your mysql_connect() and mysql_select_db() before mysql_query(), of course.

Google for some tutorials... I bet there's tons of them...
09-08-2004 12:51 PM
Profile PM Web Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
php coding help - by Eljay on 09-04-2004 at 05:26 PM
RE: how to include smilies - by fluffy_lobster on 09-04-2004 at 05:59 PM
RE: php coding help - by Eljay on 09-04-2004 at 06:21 PM
RE: php coding help - by -dt- on 09-05-2004 at 05:45 AM
RE: php coding help - by k776 on 09-05-2004 at 06:09 AM
RE: php coding help - by Jammie on 09-05-2004 at 08:15 AM
RE: php coding help - by fluffy_lobster on 09-05-2004 at 04:35 PM
RE: php coding help - by k776 on 09-06-2004 at 09:18 AM
RE: php coding help - by WDZ on 09-06-2004 at 09:33 AM
RE: php coding help - by k776 on 09-08-2004 at 05:30 AM
RE: php coding help - by WDZ on 09-08-2004 at 12:51 PM
RE: php coding help - by k776 on 09-09-2004 at 12:10 AM
RE: php coding help - by WDZ on 09-09-2004 at 02:56 AM
RE: php coding help - by k776 on 09-09-2004 at 03:48 AM
RE: php coding help - by WDZ on 09-09-2004 at 04:23 AM
RE: php coding help - by k776 on 09-09-2004 at 04:51 AM
RE: php coding help - by WDZ on 09-09-2004 at 05:20 AM
RE: php coding help - by k776 on 09-09-2004 at 05:42 AM
RE: php coding help - by WDZ on 09-09-2004 at 12:38 PM
RE: php coding help - by k776 on 09-09-2004 at 08:46 PM
RE: php coding help - by fluffy_lobster on 09-10-2004 at 06:19 PM
RE: php coding help - by k776 on 09-10-2004 at 09:37 PM
RE: php coding help - by WDZ on 09-11-2004 at 03:08 AM
RE: php coding help - by Eljay on 09-11-2004 at 06:38 AM
RE: php coding help - by k776 on 09-13-2004 at 09:37 AM
RE: php coding help - by Eljay on 09-13-2004 at 04:32 PM


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On