SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Zealot
    Join Date
    Sep 2010
    0 Post(s)
    0 Thread(s)

    Columns in my Table

    I have 43 columns in my Table.

    I am trying to use Object Oriented programming and have been successful in the past just not so many columns.

    If I address all of them with an "$this->" will I be able to use:

    PHP Code:
     $sql "INSERT INTO Table VALUES ('$this->a','$this->b','...)"
    Currently it is not returning my header and I have double checked the syntax of the "INSERT".

  2. #2
    SitePoint Wizard silver trophybronze trophy Cups's Avatar
    Join Date
    Oct 2006
    France, deep rural.
    17 Post(s)
    1 Thread(s)
    You'd answer your own question by echoing $sql onto a webpage.

    Inspect the string closely looking for errors.

    Paste that string into whatever you manage your database with.

    Look at the resulting error message.

    If it is all on one line, then break the lines down with hard returns to isolate the offending line.

    Generally though, the usual error is just a mismatch between the number of columns expected, and the number you provide.

    If you're using OOP, then you'd perhaps be best advised to look at using PDO (PHP Data Objects) to communicate with your db.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts