Jump to content

warjat

New Members
  • Posts

    2
  • Joined

  • Last visited

    Never

Everything posted by warjat

  1. Thanks for your help, the mysql_error, is also what I was looking for, as I wasn't getting any messages that would let me know what the problem was. Anyway, the problem was, that sure, my connection was correct, but it was to the wrong database, which doesn't have the "tracking" table I was trying to INSERT into. This also explains why I was able to copy and paste the code in phpmyadmin successfully. Sometimes, 5 minutes away from the code allows for a breakthrough! Thanks for you help.
  2. I've got a very simple script that records IP address of every page view. Here is the script: $ip = $_SERVER['REMOTE_ADDR']; $query = "INSERT INTO tracking VALUES ('', '1', '$ip')"; echo $query; echo ("<hr>"); if (mysql_query($query)) { echo ("INSERT OK"); } else { echo ("INSERT failed"); } FYI: the 1st value is "auto_increment" in the DB, therefore blank ('') in the query string, and the 2nd value "1" is just for the page number 1, as this script will be on other pages, with different numbers. Now, when I go to this page, it outputs the query, and hr, and then "INSERT failed" and sure enough, no record gets added to the DB. The strangest thing is, is that when I copy the query that the page shows, and paste it into mysqlPHPadmin's "SQL" section and run it, it executes fine, and a record gets added to the DB, however the page is unable to do that. Any ideas? PS: the connection (which I didn't paste in here) is fine, that's definitely not the problem.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.