Reply to Re: Field Number Limitation into MySQL

Your name:

Reply:


Posted by Chris Hope on 12/11/05 23:20

cover wrote:

> On Sun, 11 Dec 2005 18:15:52 GMT, Oli Filth <catch@olifilth.co.uk>
> wrote:
>
>>
>>Just tried a 34-field insert; it worked fine.
>
> Hmmm. Guess I'll keep looking for an error.
>
>>
>>What is your query string?
>
> $sqlquery = "INSERT INTO $table VALUES('$id', '$etype', '$area',
> '$equipname', '$jdeno', '$equipno', '$mccloc', '$bspec', '$bsize',
> '$bfpm', '$gbmanu', '$lube', '$gbsize', '$gbratio', '$motorsize',
> '$motorframe', '$drivesprocket', '$drivensprocket', '$chainsize',
> '$lacingtype', '$brgtypesize', '$brgqty', '$tbrgtypesize', '$tbrgqty',
> '$headsize', '$hoawidth', '$tailsize', '$toawidth', '$cbsize',
> '$keysize' '$uhmwsize', '$convnotes',)";

There's a comma before the closing bracket. I would say that's your
error. echo mysql_error() after running the query and see what happens.
Or alternatively echo out the sql string and paste it into the mysql
console or phpMyAdmin etc.

One other thing, where do all those values come from? Directly from the
form with no escaping? If so, you need to read up on the topic of sql
injection.

And one other thing... I personally believe you are better to write your
insert query in the form:

INSERT INTO tablename (fieldname1, fieldname2, ... ) VALUES ('value1',
'value2', ...)

than not specity the fieldnames. Sure, it takes time to write your
query, but if you add a column to the table at a later time you will
break any existing insert queries for that table as the number of
columns specified in your query won't match the number in the table.

--
Chris Hope | www.electrictoolbox.com | www.linuxcdmall.com

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация