Announcement

Collapse
No announcement yet.

What the heck am I doing wrong?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • What the heck am I doing wrong?

    Bit of confusion cause it seems to me like this statement should work


    <?php

    mysql_connect("xxx","xxx","xxx");
    mysql_select_db("xxx");

    INSERT INTO PlayerData (Player_id, FirstName, LastName, Team, Position, Birthdate, College)
    VALUES ('', 'Cris', 'Carter', 'Minnesota Vikings', 'Wide Receiver', 'November 25, 1965', 'Ohio State') ;


    ?>


    I am getting a parse error on the INSERT INTO line - all database info and table name is correct - I actually after trying to get it to work for an hour copied the INSERT INTO statement directly from phpMyAdmin

  • #2
    $result = mysql_query("INSERT INTO PlayerData (Player_id, FirstName, LastName, Team, Position, Birthdate, College)
    VALUES ('', 'Cris', 'Carter', 'Minnesota Vikings', 'Wide Receiver', 'November 25, 1965', 'Ohio State')");

    Comment


    • #3
      You're confusing sql-statements with php-statements ...These are 2 totally different things. You can use php to execute sql-statements (see Ed's example), but cannot use an sql-statement as an php-statement (as you did).

      Comment


      • #4
        at the very least php should know for which database type you're doing a query
        - Insert viable disclaimer here -

        ArtBeast!

        Comment


        • #5
          Thanks - makes a lot more sense now. Knew I was missing something small, but important.

          Comment

          widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
          Working...
          X