Re: MySQL

by "Rossi Designs" <webmaster(at)rossidesigns.net>

 Date:  Sun, 14 May 2000 17:29:06 -0400
 To:  "Sue Bailey" <sue(at)bartandsue.co.uk>,
<hwg-languages(at)hwg.org>
 References:  barnum
  todo: View Thread, Original
I usually like to store my query in a variable first becuase I feel it makes
my code more readable. For instance:

$query = "INSERT INTO foobah (
                item_number,
                designer,
                type,
                price,
                rrp,
                short_desc,
                long_desc,
                sizes,
                pic_one,
                pic_two,
                pic_three,
                weight
                ) VALUES (
                '$item_number',
                '$designer',
                '$type',
                '$price',
                '$rrp',
                '$short_desc',
                '$long_desc',
                '$sizes',
                '$pic_one',
                '$pic_two',
                '$pic_three',
                '$weight')";
$result = mysql_query($query) or die(mysql_error());

Then when your code is completely debugged change the result line to

$result = @mysql_query($query);

Rossi Designs
PO Box 1084
Holly Hill, FL 32125-1084
Phone : (904) 226-8979
URL : http://rossidesigns.net
----- Original Message -----
From: Sue Bailey <sue(at)bartandsue.co.uk>
To: <hwg-languages(at)hwg.org>
Sent: Sunday, May 14, 2000 3:30 PM
Subject: MySQL


| Can anyone help me with writing to this wretched database?!
|
| I am getting a parse error with the following line:
| mysql_query ("INSERT INTO foobah (item_number, designer, type, price, rrp,
| short_desc, long_desc, sizes, pic_one, pic_two, pic_three, weight)
|                 VALUES ('$item_number', '$designer', '$type', '$price',
| '$rrp', '$short_desc', '$long_desc', '$sizes', '$pic_one', '$pic_two',
| '$pic_three', '$weight')
|              ");
| which is part of a PHP script just designed to take the input of the form
| and add it into foobah, my testing table. I don't see what's wrong with
it,
| I'm at my wits end!! Can anyone make any suggestions?
|
| TIA
|
| Sue
|
|

HWG: hwg-languages mailing list archives, maintained by Webmasters @ IWA