RE: [PHP-DB] Data errors in entering

From: Date: Mon, 21 May 2001 16:02:38 +0000
Subject: RE: [PHP-DB] Data errors in entering
Groups: php.db 
Request: Send a blank email to php-db+get-9503@lists.php.net to get a copy of this message
I am only a beginner but I always use single quotes, I am using mySQL. Such as: $sql = "INSERT INTO $table_name (day, daydate, month, year, time, place, numbers, details, reportby) VALUES ('$day', '$daydate', 'month', 'year', '$time', '$place','$numbers','$details', '$reportby')"; All the Best Lisa -----Original Message----- From: Shane Barry [mailto:boomer@redbrick.dcu.ie] Sent: Monday, May 21, 2001 3:11 PM To: php-db@lists.php.net Subject: [PHP-DB] Data errors in entering I seem to be having a problem with a php script I use to enter data into a sql database from a php frontend. The data are ints (months and years as a number). The Database is : +----------+---------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +----------+---------+------+-----+---------+-------+ | day | text | YES | | NULL | | | daydate | int(11) | YES | | NULL | | | month | int(11) | YES | | NULL | | | year | int(11) | YES | | NULL | | | time | text | YES | | NULL | | | place | text | YES | | NULL | | | numbers | text | YES | | NULL | | | details | text | YES | | NULL | | | reportby | text | YES | | NULL | | +----------+---------+------+-----+---------+-------+ The html file takes the data in as (Using the post method): <P><STRONG>DATE:</STRONG><BR> <INPUT TYPE="int" NAME="daydate" SIZE=10 MAXLENGTH=10></p> <P><STRONG>MONTH:</STRONG><BR> <INPUT TYPE="int" NAME="month" SIZE=10 MAXLENGTH=10></p> <P><STRONG>YEAR:</STRONG><BR> <INPUT TYPE="int" NAME="year" SIZE=10 MAXLENGTH=10></p> and the php script interacts with the data as: $sql = "INSERT INTO $table_name (day, daydate, month, year, time, place, numbers, details, reportby) VALUES (\"$day\", \"$daydate\", \"month\", \"year\", \"$time\", \"$place\",\"$numbers\",\"$details\", \"$reportby\") "; The Sections affected are month and year all the others including daydate which is exactly the same are working. Can someone please point out the error to me? Shane -- Webmaster Dublin & Wicklow Mountain Rescue Team www.dwmrt.ie Irish Mountain Rescue Association imra.ie.eu.org ICQ # 103528846 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net For additional commands, e-mail: php-db-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.db (#9503) next »