[ Date Index ] [ Thread Index ] [ <= Previous by date / thread ] [ Next by date / thread => ]
That explains the error thanks I wondered why it was complaining about "Columns" when my problem was in the table data, as I knew I certainly had no Columns by the names of the errors. Living and learning On Sun, 2011-04-24 at 08:38 +0100, Peter Walker wrote: > Hi Kevin > > I assume the mysql errors were because the parser treats unquoted > strings as column names, it is clever enough to know that a number > will not be a column. As Gordon said, all strings hould be quoted and > out is good practice to quote the column names or you will get errors > for the more unusual ones. > Apologies for the to p posting but this client will not do anything > else- even edit the original message! > > Cheers > Pete > > Connected by MOTOBLURâ > > > -----Original message----- > From: Kevin Lucas <kevin.lucas@xxxxxxxxxxxxxxxxxx> > To: list@xxxxxxxxxxxxx > Sent: Sat, 23 Apr 2011, 22:39:46 GMT+01:00 > Subject: Re: [LUG] php mysql help > > > On Sat, 2011-04-23 at 21:09 +0100, Gordon Henderson wrote: > > On Sat, 23 Apr 2011, Kevin Lucas wrote: > > > > > Hi all hope you are enjoying this Easter sunshine break? > > > > No rest for the wicked... > > (and we had thunder here earlier!) > > > > > //but I get a ,' left at the end so the query wont run > > > > > > So is there an easier way of collecting the string > together with commas > > > between and delimited by ' ' ? > > > > If all else fails, use brute force: > > > > $x = "" ; > > foreach ($_POST ['box'] as $y) > > if ($x == "") > > $x = $y ; > > else > > $x .= ",'" . $y . "'" ; > > > > $x = "(" . $x . ")" ; > > > > etc. (untested, use at your own risk, etc. and it's probably > advisable to > > make sure _POST ['box'] isn't empty or the foreach might > whinge). > > > > And I hope you're validating the POST data before sending to > to mysql > > though... (little bobby tables and all that) > > > > Gordon > > > > Getting close > thanks Gordon > > this is the o/p from all the four methods with yours first > I need to put a ' before and after first item > > (70765,'XM411','BP10891') > > get the checkboxes in a while list > you have chosen '70765','XM411','BP10891', > > implode results(70765,XM411,BP10891) > > loop round count of checkboxes and add comma > ('70765','XM411','BP10891',') > > Do you know why the query fails with alpha chars? > > -- > Regards > > Kevin Lucas > Minions Post Master(Sub) > Eleven Years in the Making! > www.minionsbandb.co.uk > www.tearooms.minionsbandb.co.uk > FaceBook Minions_shop > Po House, Minions, > Liskeard Cornwall > PL14 5LE > 01579363386 > > > -- > The Mailing List for the Devon & Cornwall LUG > http://mailman.dclug.org.uk/listinfo/list > FAQ: http://www.dcglug.org.uk/listfaq -- Regards Kevin Lucas Minions Post Master(Sub) Eleven Years in the Making! www.minionsbandb.co.uk www.tearooms.minionsbandb.co.uk FaceBook Minions_shop Po House, Minions, Liskeard Cornwall PL14 5LE 01579363386 -- The Mailing List for the Devon & Cornwall LUG http://mailman.dclug.org.uk/listinfo/list FAQ: http://www.dcglug.org.uk/listfaq