LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 07-16-2003, 01:50 PM   #1
gruger
Member
 
Registered: May 2003
Location: Belgium
Distribution: RedHat 8.0
Posts: 51

Rep: Reputation: 15
Question Problem with inserting Data by FORM in MYSQL


Hi all ,

I'm back with another Q.

First going to explain my problem a bit.

I am making a website for a company , nothing fancy , the company just wanted a frameset , standard html page's and some buttons . No problem until they came up wirh another page that needs an update every week

So I was thinking to do it by PHP and a mysql server.

I do this with a standard form that parses the data to a PHP script and that puts the data in Mysql .

Everything seem to run fine , I am NOT getting an error but .... When I enter data into the form and submit it to the PHP script it says to me
"data insert OK , next please " so everything is fine , I think !?!

When I do a look-up into the database no data seems to be inserted , however , there is a new record added to the table ??? I think the data is not getting parsed out of the form into the PHP , so the PHP can't submit the data into the database .

Here is the code from the FORM and from the script .

FORM
---------------
<HTML>
<HEAD><TITLE>INSERT Data via PHP</TITLE></HEAD><BODY>
<FORM action="insert.php" method="get">
<center>
<b>
Promoties :
</b>
<br>
<br>
<input type="text" size="20" name="promo">
<br>
<br>
<br>
<b>
Datum:
</b>
<br>
<br>
<input type="text" name="datum">
<BR>
<br>
<br>
<input type="submit" value="Submit to insert.php">
</center>
</FORM>
</BODY>
</HTML>



PHP SCRIPT
---------------

<HTML>
<HEAD>
<TITLE>INSERT Data via PHP</TITLE>
</HEAD>
<BODY>
<?PHP

#MAKE CONNECTION
$connection=mysql_connect("localhost","root")
or die
('Kan geen verbinding maken met de database server');

#SELECT DATABASE
$db = mysql_select_db('bac', $connection)
or die
("Kan database niet vinden.");

#MYSQL INSERT STATEMENT
$sql = "INSERT INTO
promoties(promo,datum)
VALUES
('$promo','$datum');";

#MYSQL QUERY
$sql_result = mysql_query($sql,$connection)
or die
('Kan data niet inbrengen in de server , contacteer de beheerder');

#PUBLISH OK MESSAGE
echo('Data insert OK , next please ');

#CLOSE CONNECTION
mysql_close($connection);

?>
</BODY>
</HTML>

If someone can help me with this problem I would really appreciate that ...

Using
distro RH 8.0
kernel 2.4.18-14



And sorry about the typo's

Last edited by gruger; 07-16-2003 at 02:02 PM.
 
  


Reply


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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
segmentation fault when insert data into mysql torontosmallbird Other *NIX 1 08-07-2005 08:13 AM
Script to get form data..in bash? jrfly Linux - General 1 06-29-2005 11:04 AM
problem to insert data os2 Programming 1 11-25-2004 11:44 AM
Insert data into a textfile template! joda Programming 3 03-08-2004 10:45 AM
After insert data, Database is empty ivankong Linux - Software 2 06-16-2003 08:35 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 05:28 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration