RE: [PHP-DB] Data errors in entering

2001-05-21 Thread Rubanowicz, Lisa

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:[EMAIL PROTECTED]]
Sent: Monday, May 21, 2001 3:11 PM
To: [EMAIL PROTECTED]
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):

DATE:


MONTH:


YEAR:


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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]



Re: [PHP-DB] Data errors in entering

2001-05-21 Thread biorn

The problem is in your insert statement.  You forgot the $ on your month and
year variable values.

Your statement should read:

$sql = "INSERT INTO $table_name (day,daydate,month,year,time,place,numbers,
details,reportby) VALUES
('$day',$daydate,$month,$year,'$time','$place','$numbers','$details','$reportby')";
^  ^

Another note, you do not need the quotes around your integer values for
$daydate, $month, $year.
You also should use single quotes on the other values rather than double quotes.


Shane Barry <[EMAIL PROTECTED]> said:

> 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):
>
> DATE:
> 
>
> MONTH:
> 
>
> YEAR:
> 
>
> 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: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



-- 




-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] Data errors in entering

2001-05-21 Thread Miles Thompson

You're going to hate this ... add the $ so that you have $month, $year.
Miles
PS I've done it too - you red it so many times you no longer see anything.

At 03:10 PM 5/21/01 +0100, Shane Barry wrote:
>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):
>
>DATE:
>
>
>MONTH:
>
>
>YEAR:
>
>
>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: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]