1. Check the manual on use of $_POST and notch down your error reporting
level. As these vars have not been defined PHP is throwing an error.
2. While you are at it, and assuming that your variables are all received
correctly, why not simplify your sql?
insert into test_scores set field_one =
gt; To: PHP Lists
> Subject: [PHP-DB] Undefined Index error when trying to insert
> data from
> a form into a db
>
>
> Hello to all:
>
> I am getting the following error message when trying to
> insert data from
> an html form into a MYSQL database that I recently
Hello to all:
I am getting the following error message when trying to insert data from
an html form into a MYSQL database that I recently created. Can someone
take a look at the errors and corresponding code and suggest some
alternatives?
Thank you very much in advance for your assistance.
R
Message-
> From: Fred Wright [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, January 15, 2003 6:57 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] Undefined index and variables
>
>
> Hi to all
> Being new to PHP I am naturally experiencing some minor problems.
>
>
Hi to all
Being new to PHP I am naturally experiencing some minor problems.
I have a form which processes Ref and Chassis data, when I load Add.php
which does work but on loading get errors
Notice: Undefined index: Ref in C:\Xitami\webpages\add.php on line 22
Notice: Undefined index: Chassis in C
Your best bet is to do some isset() calls:
eg
if(isset($row['imageurl']))
{
$image=$row['imageurl'];
}
else
{
/*maybe report the problems or handle it like this...*/
$image=$default_image_url;
/*where you have already set up $default_image_url to point somewhere
sensible*/
}
Cheers
--
Phil
t; Oracle, PHP, e-Commerce etc.
> Funcom Oslo AS
> -Original Message-
> From: Petra [mailto:[EMAIL PROTECTED]]
> Sent: 1. mai 2001 03:29
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] undefined index
>
>
>
> hi to all
>
> I try to get data listed out of m
: [EMAIL PROTECTED]
Subject: [PHP-DB] undefined index
hi to all
I try to get data listed out of my database with the statement
...
while ($row = mysql_fetch_array($sql)) {
$image = $row["imageurl"];
$id = $row["productID"];
$name = $row["cdescription"];
...
If i hav
hi to all
I try to get data listed out of my database with the statement
...
while ($row = mysql_fetch_array($sql)) {
$image = $row["imageurl"];
$id = $row["productID"];
$name = $row["cdescription"];
...
If i havent got anything in that field in my database I get the error
message in my brows