Go Back   Novahq.net Forum > Computers > Web design and Programming
FAQ Community Calendar Today's Posts Search

Web design and Programming Discuss website creation and other programming topics.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 11-27-2004, 02:44 PM
Stu is offline Stu
Resident Member

Join Date: Aug 2003
Posts: 3,319

Confused MySql help

Hey all.
At the moment i'm trying to make a script that posts news, and saves the data on a mysql db.
basically, i need to know how to use a form to submit infomation into a database. And also, a good method for creating Mysql tables without using a tool like phpMyAdmin.
Any surgestions?
- Thanks guys & gals
Reply With Quote
  #2  
Old 11-27-2004, 06:10 PM
Lakie is offline Lakie

Join Date: Mar 2002
Posts: 5,540

whatever you gave the form in the name field is what you can use,

If ($_POST['postnews'])
{
$newsbody = $_POST["newsbody"]
$newstext = $_POST["newstext"];

//add to mysql manipulate the data as needed etc etc
}

In this case the form name was postnews and the fieldnames were newsbody and newstext.

As for the table a way is to just use a mysql query

mysql_query("CREATE TABLE tablename (all column details here);
Reply With Quote
  #3  
Old 11-27-2004, 09:24 PM
JonM is offline JonM
Registered User

Join Date: Jun 2004
Posts: 2,156

if your confused totally on how to insert data from forms:


mysql_query("INSERT INTO db ('dbvalue','dbvalue','dbvalue') VALUES ('$form','$form','$form')");

or some times you'll get a error with that so u neeed to go

mysql_query("INSERT INTO db('$form','$form','$form')"); -- it skips picking the column or row or whatever it's called and what order the data will be inserted in , and instead just inserts the data into it 1 by 1 so if id was first the the first $form would go in it.
Reply With Quote
  #4  
Old 11-28-2004, 05:01 AM
Stu is offline Stu
Resident Member

Join Date: Aug 2003
Posts: 3,319

thnx guys, that helped alot
- Warm regards
Reply With Quote
  #5  
Old 11-28-2004, 05:19 AM
Lakie is offline Lakie

Join Date: Mar 2002
Posts: 5,540

Quote:
My Post above
If ($_POST['postnews'])
{
$newsbody = $_POST["newsbody"]
$newstext = $_POST["newstext"];

//add to mysql manipulate the data as needed etc etc
}
error in there, there should be a ; at the end of the $newsbody line.
Reply With Quote
  #6  
Old 11-28-2004, 05:25 AM
Stu is offline Stu
Resident Member

Join Date: Aug 2003
Posts: 3,319

Oh lol, i'm glad i didn't use exactly that, i'll show u the script as soon as it is finished
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

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

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
MySQL 5.0 is out! DevilDog#1 Web design and Programming 4 01-14-2006 07:16 PM
mysql 4.1 King Web design and Programming 6 02-06-2005 12:49 PM
MySql Help -DFO-Ironic Web design and Programming 6 08-01-2004 10:16 PM
mysql help G.I.JOE*MFA* Tech Support 1 07-20-2003 09:22 PM
MySQL Kip Kilagan Web design and Programming 3 04-05-2003 10:34 AM


All times are GMT -5. The time now is 11:30 PM.




Powered by vBulletin®