RE: SQL Insert problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Try echoing out your query to the browser window before you send it to the
database. A simple echo $sql should suffice. Then you can see what's
actually being sent in the query string to the database. Thar may show you
exactly what's going wrong. If your query string looks right, then the error
lies elsewhere.

Was your error reporting logic reporting that you had a mismatched number of
columns and arguments before? If not, then your error reporting logic is
probably not doing what you expect it to.

Rich


> -----Original Message-----
> From: Vincent Jordan [mailto:vjordan@xxxxxxxxxxxxxx]
> Sent: Thursday, August 05, 2004 11:06 AM
> To: php-db@xxxxxxxxxxxxx
> Subject: RE:  SQL Insert problem
> 
> 
> I have inserted '$address2', correctly in the row however it 
> is still not
> putting the data in the table.
> 
> I am not getting an error but I do believe I have correct 
> syntax set to
> display problems. 
> 
> > -----Original Message-----
> > From: Hutchins, Richard [mailto:Richard.Hutchins@xxxxxxxxxxxxxx]
> > Sent: Thursday, August 05, 2004 10:26 AM
> > To: php-db@xxxxxxxxxxxxx
> > Subject: RE:  SQL Insert problem
> > 
> > You're missing address2 in your list of values. This means 
> that you have
> > an
> > unmatching number of column names and values in your query 
> and that'll
> > make
> > the query bomb.
> > 
> > Rich
> > 
> > 
> > > -----Original Message-----
> > > From: Vincent Jordan [mailto:vjordan@xxxxxxxxxxxxxx]
> > > Sent: Thursday, August 05, 2004 10:25 AM
> > > To: php-db@xxxxxxxxxxxxx
> > > Subject:  SQL Insert problem
> > >
> > >
> > > Im having a problem inserting data. Ive looked over this
> > > again and again and
> > > can not find what ive missed. Everything else works besides
> > > the db insert.
> > >
> > >
> > >
> > > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
> > > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
> > >
> > > <?php
> > >
> > > ini_set ('display_errors', 1);
> > >
> > > error_reporting (E_ALL & ~E_NOTICE);
> > >
> > > // Define
> > >
> > > $firstname = $_POST['firstname'];
> > >
> > >
> > >
> > > $lastname = $_POST['lastname'];
> > >
> > >
> > >
> > > $address = $_POST['address'];
> > >
> > >
> > >
> > > $address2 = $_POST['address2'];
> > >
> > >
> > >
> > > $city = $_POST['city'];
> > >
> > >
> > >
> > > $state = $_POST['state'];
> > >
> > >
> > >
> > > $zip = $_POST['zip'];
> > >
> > >
> > >
> > > $phone = $_POST['phone'];
> > >
> > >
> > >
> > > $email = $_POST['email'];
> > >
> > >
> > >
> > > $serial = $_POST['serial'];
> > >
> > >
> > >
> > > $product = $_POST['product'];
> > >
> > >
> > >
> > > $reason = $_POST['reason'];
> > >
> > >
> > >
> > > $gold = $_POST['gold_button_y'];
> > >
> > >
> > >
> > > $goldaccount = $_POST['goldaccount'];
> > >
> > >
> > >
> > > $rmanumber = $lastname{0}.date("ndyGi");
> > >
> > >
> > >
> > > $connect = mysql_connect("SERVER ", "USER", "PASSWORD") or die
> > > (mysql_error());
> > >
> > > $select = mysql_select_db ("spdata") or die (mysql_error());
> > >
> > > $sql = "INSERT INTO rmarequest (firstname, lastname, address,
> > > address2,
> > > city, state, zip, phone, email, serial, product, reason,
> > > rmanumber)VALUES
> > > ('$firstname', '$lastname', '$address', '$city', '$state',
> > > '$zip', '$phone',
> > > '$email', '$serial', '$product', '$reason', '$rmanumber') or die
> > > (mysql_error())";
> > >
> > > if (isset($_POST['submit'])) {
> > >
> > > $sql;
> > >
> > > }
> > >
> > > // Send  and put in email message
> > >
> > > $htmlheader = "Content-Type: text/html; charset=us-ascii\n";
> > >
> > > $htmlheader .= "Content-Transfer-Encoding: 7bit";
> > >
> > > $header = $from; // set the from field in the header
> > >
> > > $header .= "\n"; // add a line feed
> > >
> > > $header .= "MIME-version: 1.0\n"; //add the mime-version header
> > >
> > > $header .= $htmlheader."\n";
> > >
> > > $from = "From: RMA Request <RMA@xxxxxxxxxxxxxx>";
> > >
> > > $message = "$firstname $lastname
> > >
> > > $address
> > >
> > > $address2
> > >
> > > $city
> > >
> > > $state
> > >
> > > $zip
> > >
> > > $phone
> > >
> > > $email
> > >
> > > $product
> > >
> > > $serial
> > >
> > > $gold
> > >
> > > $goldaccount
> > >
> > > $reason
> > >
> > > $rmanumber";
> > >
> > >
> > >
> > >
> > >
> > > // Send email to support
> > >
> > > mail("support@xxxxxxxxxxxxxx", "RMA Request", $message, $header);
> > >
> > > ?>
> > >
> > > <html xmlns="http://www.w3.org/1999/xhtml";>
> > >
> > > <head>
> > >
> > > <title>Untitled Document</title>
> > >
> > > </head>
> > >
> > > <body>
> > >
> > > <p><strong>RMA Request Sent</strong></p>
> > >
> > > <p>Your RMA Number is <strong> <? echo $rmanumber ?> 
> </strong> </p>
> > >
> > > <p>Please include a note within your package with your
> > > shipping address,
> > > phone number and discription of the problem.<br />When
> > > shipping Smart Parts
> > > reccomends insuring your package for the full replacment cost.
> > >
> > >     We also advise purchasing tracking services if using 
> the postal
> > > service.</p>
> > >
> > > <p><strong>Ship your return to: </strong></p>
> > >
> > > <p>Smart Parts, Inc<br />
> > >
> > >         ATTN <? echo $rmanumber ?><br />
> > >
> > >         Loyanhanna Business Complex<br />
> > >
> > >         100 Station St.<br />
> > >
> > >     Loyalhanna Pa. 15661</p>
> > >
> > > <p><br />
> > >
> > >   Please allow up to one week for package delivery.
> > >
> > >     For status information please call 800-992-2147 and ask
> > > for the returns
> > > department.</p>
> > >
> > > <a href="#" onClick="window.print();">Click Here to print
> > > this page</a><br
> > > />
> > >
> > > <a href="form.htm">Click here to return to RMA Request form</a>
> > >
> > > </body>
> > >
> > > </html>
> > >
> > >
> > >
> > >
> > 
> > --
> > PHP Database Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux