Author Topic: "Binary_file.dat" inserted into auto-increment field -- instead of a number  (Read 622 times)

0 Members and 1 Guest are viewing this topic.

Offline stevieontarioTopic starter

  • Enthusiast
  • Posts: 73
    • View Profile
Afternoon Freaks,

I have been getting a weird INSERT query result. I put data into a table using the following query:
Code: [Select]
$cquery = "insert into performance2
(sourceId, column1, column2, column3, column4)
VALUES ('$lastSid', '$value1', '$value2', '$value3', '$value4')";
mysql_query($cquery, $cxn);

The table performance2 contains an id field (perfid) which is an auto-incremented, indexed, primary key.

When I run that query, everything works -- except that all the perfid rows are filled with "binary_file.dat". I've never seen this before, and I've tried googling the problem and still can't find out what's going on.

Anybody have any ideas? Thanks!

Offline Mchl

  • Staff Alumni
  • Freak!
  • *
  • Posts: 8,582
  • Gender: Male
  • That's Largo in my avatar, not me.
    • View Profile
    • FlingBits
What's 'perfid'? It's not in your code.
Most likely you misassigned a value to variable somewhere.
NetBeans fanatic | ExtJS masochist | C++ denier
PHP4 & MySQL4 are no longer supported.
PHPFreaks Tutorials | PHP Debugging: A Beginner's guide | PHP Security Tutorial || How To Ask Questions The Smart Way
Flingbits tutorials | Class Autoloading

Offline stevieontarioTopic starter

  • Enthusiast
  • Posts: 73
    • View Profile
whoops sorry, perfid is my auto incremented primary key column for the table performance2. Since it's auto-incremented, I don't include it in the insert.


Offline Mchl

  • Staff Alumni
  • Freak!
  • *
  • Posts: 8,582
  • Gender: Male
  • That's Largo in my avatar, not me.
    • View Profile
    • FlingBits
If it's auto_increment, it has to be integer. If it's integer, it cannot hold value like 'binary_file.dat'. Please post table structure here (use 'SHOW CREATE TABLE performance2' query and paste results here).
NetBeans fanatic | ExtJS masochist | C++ denier
PHP4 & MySQL4 are no longer supported.
PHPFreaks Tutorials | PHP Debugging: A Beginner's guide | PHP Security Tutorial || How To Ask Questions The Smart Way
Flingbits tutorials | Class Autoloading

Offline stevieontarioTopic starter

  • Enthusiast
  • Posts: 73
    • View Profile
Thanks Mchl, and sorry for the delay (computer problems related to office move).

Here's the table structure:
performance2    CREATE TABLE `performance2` (
 `perfid` int(125) ...

Hope this helps,

Steve

Offline Mchl

  • Staff Alumni
  • Freak!
  • *
  • Posts: 8,582
  • Gender: Male
  • That's Largo in my avatar, not me.
    • View Profile
    • FlingBits
1. INT(125) is nonsense.
2. I can't see it marked as AUTO_INCREMENT (perhaps you cut it off)
3. As said before, INT column cannot hold anything like 'binary_file.dat'. I'm not sure what to think about it. Where exactly do you see this?
NetBeans fanatic | ExtJS masochist | C++ denier
PHP4 & MySQL4 are no longer supported.
PHPFreaks Tutorials | PHP Debugging: A Beginner's guide | PHP Security Tutorial || How To Ask Questions The Smart Way
Flingbits tutorials | Class Autoloading

Offline stevieontarioTopic starter

  • Enthusiast
  • Posts: 73
    • View Profile
As always, thanks for your time.

I did the "show create table performance2" query in phpMyAdmin, and just copied the results.

"Binary_file.dat" appears in each field in the perfid column when I click on the performance2 table in phpMyAdmin, in Browse mode.