Insert Two Inputs Into One Column

Discussion in 'PHP' started by koolsamule, Apr 13, 2010.

  1. #1
    Hi Chaps,

    Maybe a simple answer to this one, I have two input fields, which I want to combine into 1 SQL column.

    Inputs:
    <input type="text" name="job_no" value="00001" size="32" />
    <input type="text" name="job_model" value="MODEL_A" size="32" />
    Code (markup):
    SQL:
    "INSERT INTO tbl_job (job_title) VALUES (%s)", GetSQLValueString($_POST['job_no'], "text").GetSQLValueString(' - '.$_POST['job_model'], "text");
    Code (markup):
    This produces:
    job_title = 00001' - MODEL_A

    Problem:
    Notice the character after the job_no. . . .how do I get rid of this?
     
    koolsamule, Apr 13, 2010 IP
  2. mfscripts

    mfscripts Banned

    Messages:
    319
    Likes Received:
    4
    Best Answers:
    8
    Trophy Points:
    90
    Digital Goods:
    3
    #2
    Code looks ok on the face of it, although not sure what GetSQLValueString() is doing though. Have you tried doing it like this:

    "INSERT INTO tbl_job (job_title) VALUES (%s)", GetSQLValueString($_POST['job_no'].' - '.$_POST['job_model'], "text");
    PHP:
     
    mfscripts, Apr 13, 2010 IP
  3. koolsamule

    koolsamule Peon

    Messages:
    101
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Hi, yeah, have tried that, comes up with a 'Truncated incorrect DOUBLE value:' error.
    The GetSQLValueString() is an Adobe DreamWeaver function.
     
    koolsamule, Apr 13, 2010 IP
  4. koolsamule

    koolsamule Peon

    Messages:
    101
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Sorted it, I altered the function that was inserting '/" marks between text, double, date, float data types.
     
    koolsamule, Apr 13, 2010 IP