PHP INSERT Bad data

From: Adrian Parker (adrian.parker_at_NOSPAMsympatico.ca)
Date: 04/29/04


Date: Thu, 29 Apr 2004 12:26:31 -0400

I have the code below. It builds an INSERT command, and it gets run on the
database. Everything works fine except the database is only receiving the
first 6 characters of the phone number.

The field in the database can hold 10 digits (confirmed). The echo
statement shows that the phone number is indeed 10 characters long.

The second echo statement show the $query looks similar too:
INSERT INTO students Values ('', '1', 'SomeFirstname', 'SomeLastName',
'License', 'adrian.parker@sympatico.ca', ' 6135315960', ' ', ' ', ' ')

When I run this query in mySQL when logged onto the terminal, the phone
number appears fine.

How could truncation be happening?

 if (isset($_POST["firstName"]))
 {
  $query = "INSERT INTO students Values ('', '1', '" . $_POST["firstName"] .
"', '
   " . $_POST["lastName"] . "', '
   " . $_POST["licenseNumber"] . "', '
   " . $_POST["eMail"] . "', '
   " . $_POST["phone"] . "', '
   " . $_POST["city"] . "', '
   " . $_POST["address"] . "', '
   " . $_POST["birthDate"] . "')";

   echo "Phone number is: " . $_POST["phone"] . "<br><br>";
   echo "The query statement is: " . $query . "<br>";

  $result = mysql_query($query) or die("Adding the student to the database
failed: " . mysql_error());
 }

<Ade

-- 
Adrian Parker.  Ordained priest.  <adrian.parker@sympatico.ca>
"A society that views graphic violence as entertainment ...should not be
surprised when senseless violence shatters the dreams of it's youngest and
brightest..."  - Ensign (March 2004)


Relevant Pages

  • Re: DBMS and lisp, etc.
    ... Naively implemented with SQL, again for 10 ... (1 query for the initial orders, 1 query for each order for its ... soon as you upgrade to the SQL database. ... (eq (order-customer orderA) ...
    (comp.lang.lisp)
  • Re: OT: SQL
    ... query processing. ... FROM Employees e, Employees m, Management mgt ... Manager and Employee Salaries. ... The scheme used does not model database files in general, ...
    (sci.logic)
  • Re: access 2003
    ... I removed the parameters from the form query source. ... boxes from the form header, events, code, etc and ran the form query source ... forms queries and the SQL because syntax of the SQL will change randomly. ... the Access 97 database, I wouldn't have thought any expressions would be ...
    (microsoft.public.access.conversion)
  • RE: Import external data - web query
    ... Your reply for my query is very extensive, this is for importing a file from ... The data source I want isn't listed in the Select Data Source dialog box. ... information used to connect to a database. ... Check your driver First, make sure you have the right ODBC driver (Open ...
    (microsoft.public.excel.misc)
  • Re: access 2003
    ... I removed the parameters from the form query source. ... synchronize combo boxes to the detail section or the parameter form query ... forms queries and the SQL because syntax of the SQL will change randomly. ... the Access 97 database, I wouldn't have thought any expressions would ...
    (microsoft.public.access.conversion)