Re: upload data to MySql
| From: | Seabird | Date: | Thu, 14 Nov 2002 21:30:04 +0000 |
| Subject: | Re: upload data to MySql | ||
| References: | 1 2 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-23358@lists.php.net to get a copy of this message | ||
Thanx, I found out I forgot to pass it to my db.
Jacco
--
http://seabird.jmtech.ca
Attitude is Everything!
But Remember, Attitudes are Contagious!
Is Yours worth Catching????
"David Robley" <robleyd@paradise.net.nz> wrote in message
news:MPG.183f2f6ec46a84169897c8@news.php.net...
> In article <20021114024607.95201.qmail@pb1.pair.com>, jacco@vliegt.nl
> says...
> > Hi everyone,
> >
> > I don't get my upload to work properly. It's a tutorial of the web, but
it
> > doesn't function (unless I made a mistake). Please help me...
> > I have a form passing on 5 fields (text for testing), name: year, make,
> > model, price, picture and submit to PHP_SELF
> >
> > <?php
> > if ($submit) {
> >
> > $db = mysql_connect("localhost","myname","mypassword");
> >
> > mysql_select_db("$test",$db);
> > //DB Test for testing...
> >
> > $sql = "INSERT INTO test (year,make,model,price,picture) VALUES
> > ('$year,$make,$model,$price,$picture')";
>
> This line looks like your first problem. Each value being inserted which
> is a text type should be separately surrounded by single quotes. So:
>
>
> ('$year','$make','$model','$price','$picture')";
>
> As a debugging aid, use
>
> echo mysql_error()
>
> after you pass the query to mysql with mysql_query() I don't see where you
> actually do that in this code snippet??
>
> > //I created these columns in the table test
> >
> >
> > echo "year: $year<br>\n";
> > echo "make: $make<br>\n";
> > echo "model: $model<br>\n";
> > echo "price: $price<br>\n";
> > echo "picture: $picture<br>\n";
> > }
> >
> > ?>
> >
> > I know I need globals on for this.
> > Thanx for the help,
>
> --
> David Robley
> Temporary Kiwi!
>
> Quod subigo farinam