Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I'm new when it comes to MySQLi and databases so I'm not sure how exactly to title this question.

I have a PHP script setup to where it inserts data into the database. Pretty self explanatory. However, I noticed that the database runs through each row instead of just inserting the data. Possibly to check for duplicates? Wouldn't it be much faster not having it query through each row by just inserting the data? The data I'm inserting will never be duplicated anyway unless I force it.

How can I just get it to insert the data without it running through each value in the row? My apologies if this is off-topic.

$SQL = "INSERT INTO `read`(`title`,`url`) VALUES\n ".implode( "\n,",array_reverse( $sql_values ) );
share|improve this question

closed as off-topic by Mark Storey-Smith, ypercube, Paul White, Nick Chammas, dezso Jul 15 '13 at 11:31

If this question can be reworded to fit the rules in the help center, please edit the question.

1  
Do you have anything like an auto incrementing primary key? Or can you add such a column? This way you can insert your rows without having to check for duplicates. Provided you have access to change the way the code works. –  StanleyJohns Jul 13 '13 at 5:38
    
Ah ha! Thanks @StanleyJohns –  Chris Burton Jul 13 '13 at 6:24
    
So Chris, did Stanley answer your question? –  Nick Chammas Jul 14 '13 at 10:00
    
@NickChammas Yes, that worked for me. –  Chris Burton Jul 14 '13 at 19:19

1 Answer 1

up vote 1 down vote accepted

Do you have anything like an auto incrementing primary key? Or can you add such a column? This way you can insert your rows without having to check for duplicates. Provided you have access to change the way the code works.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.