![]() |
[PHP/MySQL] Query problem
Alright, so I got MySQL v. 4.0.18-standard, and php 4.3.4 as background.
What I'm tryin to do is create a script that'll create a table thru a table. Some people may have the PHP fast & easy development and I'm trying to copy the one that they have in the book. I've looked at the php.net, and it didn't really answer my question though. Here's the error I get. You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 't (Array[0]),)' at line 1 This is in the table creation script PHP Code:
This is in the table selection field. PHP Code:
If you have any references about this that I can look at, I would be greatly appriciative. |
I think the problem is that the last time this for loop goes through:
PHP Code:
Do a check to see if you're at the last iteration of the loop. If you are, don't print the comma. Hopefully that helps. Such as: PHP Code:
|
A common, but small mistake
This happens all the time.
when your loop goes through, it will end up with an extra comma on the end, remove it with rtrim() after your loop is finished PHP Code:
|
I generally toss stuff like that into a temporary array, then implode() the array, gluing with commas.
No trailing commas that way. MPEDrummer |
All times are GMT -8. The time now is 01:33 PM. |
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
Search Engine Optimization by vBSEO 3.6.0 PL2
© 2002-2012 Tilted Forum Project