LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 09-19-2003, 07:45 PM   #1
sandoz
Member
 
Registered: Aug 2002
Distribution: Ubuntu 7.04
Posts: 36

Rep: Reputation: 15
Blank entries inserted into mysql database


Hi there,

I am getting blank entries in my database from my form, instead of the data entered. The same script works fine on another server, but not on the one i built.

The only data making it into the database is the date NOW(). No error is returned. I just end up with a blank entry (row is added).

I can add entries to the db from shell prompt fine. And can retrieve the entries with php from my browser.

I cannot figure out why my inserts are blank!

Suggestions / tips / fixes welcome.

Thanks,
Karl
 
Old 09-19-2003, 08:29 PM   #2
guild
Member
 
Registered: Aug 2003
Location: United States
Distribution: Auditor Linux
Posts: 64

Rep: Reputation: 15
seems we need a bit more information. for example, perhaps a snipet of the code that you are using from the form to insert the data.
 
Old 09-20-2003, 06:09 AM   #3
sandoz
Member
 
Registered: Aug 2002
Distribution: Ubuntu 7.04
Posts: 36

Original Poster
Rep: Reputation: 15
Form is :
<form action="blackboardpost.php" method="post" enctype="multipart/form-data">
<font size="3"><b>Add Post</b></font></td></tr>
<tr><td>Title:</td><td><input type="text" name="name"></td></tr>
<tr><td>Message:</td><td> <textarea type="text" name="msg" cols="30" rows="10"></textarea></td></tr>
<tr><td colspan=2 align="center"><input type="Submit" value="SUBMIT">
</form>

Insert is :
$query = "INSERT INTO blackboard (date, name, msg) VALUES (NOW(), '$name', '$msg')";
mysql_query($query);
 
Old 09-21-2003, 04:17 AM   #4
then
Member
 
Registered: Oct 2002
Location: FDR India
Distribution: RH9, Knoppix, MEPIS
Posts: 65

Rep: Reputation: 15
Hi

Assuming GLOBAL_VARIABLES=ON in your php.ini, could you try the following INSERT -

"INSERT INTO blackboard (date, name, msg) VALUES (NOW(),".$name.",". $msg.")";

regards
theN
ps: if GLOBAL_VARIABLES=off you could try $_POST[name] etc
 
Old 09-22-2003, 03:51 AM   #5
sandoz
Member
 
Registered: Aug 2002
Distribution: Ubuntu 7.04
Posts: 36

Original Poster
Rep: Reputation: 15
Nice one then.

register_globals is 'off' on my build but 'on' on my webhost. So $_POST works on my server.

Now i have to figure out what they are and how to turn them 'on'.

Many thanks.
 
  


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
Error when blank data CD is inserted Quercus ruber Linux - Hardware 4 03-08-2005 03:56 AM
rpm database missing entries? dtashima Red Hat 0 10-29-2004 08:18 AM
Writing an app that uses a mysql database without installing mysql server? QtCoder Programming 4 08-09-2004 02:43 PM
MYSQL help - mysql database missing eloviyandhi Linux - Software 1 03-20-2004 09:20 PM
Mysql database from cd JHuizingh Linux - Software 0 02-22-2003 02:08 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:46 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
Open Source Consulting | Domain Registration