Click here to Skip to main content
15,887,683 members
Home / Discussions / Linux, Apache, MySQL, PHP
   

Linux, Apache, MySQL, PHP

 
AnswerRe: Powershell question: How to print only the current folder name Pin
Sauro Viti27-Oct-10 0:17
professionalSauro Viti27-Oct-10 0:17 
AnswerRe: Powershell question: How to print only the current folder name Pin
Peter_in_278027-Oct-10 0:18
professionalPeter_in_278027-Oct-10 0:18 
GeneralRe: Powershell question: How to print only the current folder name Pin
melwyn27-Oct-10 0:22
melwyn27-Oct-10 0:22 
QuestionMySQL syntax error near '' Pin
nathionice25-Oct-10 21:10
nathionice25-Oct-10 21:10 
AnswerRe: MySQL syntax error near '' Pin
Geoff Williams25-Oct-10 22:28
Geoff Williams25-Oct-10 22:28 
GeneralRe: MySQL syntax error near '' Pin
Gerben Jongerius26-Oct-10 1:08
Gerben Jongerius26-Oct-10 1:08 
GeneralRe: MySQL syntax error near '' Pin
nathionice26-Oct-10 1:55
nathionice26-Oct-10 1:55 
GeneralRe: MySQL syntax error near '' Pin
Gerben Jongerius26-Oct-10 3:36
Gerben Jongerius26-Oct-10 3:36 
The problem is in your for loop. You start building up your insert just above it and then append the values in the loop. This might not seem like a problem, but when you look at what it does it is something like this:

q="insert into blaat(col1, col2) values"

Run 1:
q="insert into blaat(col1, col2) values('1','2'),"
mysql_query($q)

Run 2:
q="insert into blaat(col1, col2) values('1','2'),('3','4'),"
mysql_query($q)

Run 3:
q="insert into blaat(col1, col2) values('1','2'),('3','4'),('5','6'),"
mysql_query($q)

So the problem is probably two things. First you are appending to the q variable every time you loop through the for. This type of insert will work in a console MySQL client app, but I doubt that PHP supports it. Then there is a second issue with this, inside the loop you are running the mysql_query. So every single time you loop you are running the query over and over again.

The second issue is that you instantly add the ',' in the for loop. Since $i + 1 < $c is valid as soon as there is even one row to be inserted.
GeneralRe: MySQL syntax error near '' Pin
nathionice26-Oct-10 5:00
nathionice26-Oct-10 5:00 
GeneralRe: MySQL syntax error near '' Pin
Gerben Jongerius26-Oct-10 20:34
Gerben Jongerius26-Oct-10 20:34 
AnswerRe: MySQL syntax error near '' Pin
Graham Breach26-Oct-10 2:57
Graham Breach26-Oct-10 2:57 
AnswerRe: MySQL syntax error near '' Pin
cjoki26-Oct-10 5:04
cjoki26-Oct-10 5:04 
GeneralRe: MySQL syntax error near '' Pin
nathionice26-Oct-10 5:42
nathionice26-Oct-10 5:42 
GeneralRe: MySQL syntax error near '' Pin
Gerben Jongerius26-Oct-10 20:29
Gerben Jongerius26-Oct-10 20:29 
GeneralRe: MySQL syntax error near '' Pin
nathionice26-Oct-10 20:53
nathionice26-Oct-10 20:53 
GeneralRe: MySQL syntax error near '' Pin
cjoki27-Oct-10 5:50
cjoki27-Oct-10 5:50 
Questionhello about Cacti Pin
lxlenovostar19-Oct-10 2:38
lxlenovostar19-Oct-10 2:38 
AnswerRe: hello about Cacti Pin
cjoki19-Oct-10 4:39
cjoki19-Oct-10 4:39 
Questioni catch a problem when i compiling Pin
lxlenovostar18-Oct-10 3:03
lxlenovostar18-Oct-10 3:03 
AnswerRe: i catch a problem when i compiling Pin
Iranian MM8-Sep-11 5:30
Iranian MM8-Sep-11 5:30 
Questionproblem in windows 7 Pin
mstanwar13-Oct-10 14:46
mstanwar13-Oct-10 14:46 
AnswerRe: problem in windows 7 Pin
Mohamed7IBrahim18-Nov-10 3:48
Mohamed7IBrahim18-Nov-10 3:48 
GeneralRe: problem in windows 7 Pin
Ali Al Omairi(Abu AlHassan)13-Feb-11 14:50
professionalAli Al Omairi(Abu AlHassan)13-Feb-11 14:50 
QuestionPHP File Open and Reading character by character Pin
nathionice13-Oct-10 5:33
nathionice13-Oct-10 5:33 
AnswerRe: PHP File Open and Reading character by character Pin
cjoki14-Oct-10 4:44
cjoki14-Oct-10 4:44 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.