I think I've got it!!!!! Maybe

From: Date: Mon, 02 Oct 2000 13:56:24 +0000
Subject: I think I've got it!!!!! Maybe
Groups: php.windows 
Request: Send a blank email to php-windows+get-2883@lists.php.net to get a copy of this message
I think that I've been looking in the wrong place all along. I haven't used BRACKETS in the field name before... that seemed to do it!!!! Anyone seen this before? --------------------- John Asendorf - jasendorf@lcounty.com Web Applications Developer http://www.lcounty.com - NEW FEATURES ADDED DAILY! Licking County, Ohio, USA 740-349-3631 > -----Original Message----- > From: David Lidström [mailto:david.lidstrom@cabesa.com] > Sent: Monday, October 02, 2000 9:54 AM > To: PHP Windows > Subject: RE: [PHP-WIN] Re: Anyone on? INSERT INTO with MS > Access problem > > > > M'kay! > > Try to put brackets around the "date" field-name... > I don't think Access like it when you name it just "date"... > Try; > ---8<---8<-- Cut Here --8<--8<-- > > $sql = "INSERT INTO Datetest ([date]) VALUES ('$date');"; > > ---8<---8<-- Cut Here --8<--8<-- > > /d2 > > > -----Original Message----- > From: Asendorf, John [mailto:JAsendorf@lcounty.com] > Sent: den 2 oktober 2000 15:48 > To: David Lidström; PHP Windows > Subject: RE: [PHP-WIN] Re: Anyone on? INSERT INTO with MS > Access problem > > > Doesn't work with EITHER '$date' or #$date# > > --------------------- > John Asendorf - jasendorf@lcounty.com > Web Applications Developer > http://www.lcounty.com - NEW FEATURES ADDED DAILY! > Licking County, Ohio, USA > 740-349-3631 > > > > -----Original Message----- > > From: David Lidström [mailto:david.lidstrom@cabesa.com] > > Sent: Monday, October 02, 2000 9:48 AM > > To: PHP Windows > > Subject: RE: [PHP-WIN] Re: Anyone on? INSERT INTO with MS > > Access problem > > > > > > > > > > Doesn't it work with "'", like strings, instead of # ? > > Something like this; > > ---8<---8<-- Cut Here --8<--8<-- > > > > $sql = "INSERT INTO Datetest (date) VALUES ('$date');"; > > > > ---8<---8<-- Cut Here --8<--8<-- > > > > /d2 > > -----Original Message----- > > From: > php-windows-return-2877-david.lidstrom=cabesa.com@lists.php.net > > [mailto:php-windows-return-2877-david.lidstrom=cabesa.com@list > > s.php.net] > > On Behalf Of Jeroen ten Berge > > Sent: den 2 oktober 2000 15:38 > > To: Asendorf, John; php-windows@lists.php.net > > Subject: RE: [PHP-WIN] Re: Anyone on? INSERT INTO with MS > > Access problem > > > > > > Make sure u use the latest JET engine from MS, i beleive it's > > currently 4.x > > > > -----Original Message----- > > From: Asendorf, John [mailto:JAsendorf@lcounty.com] > > Sent: Monday, October 02, 2000 3:32 PM > > To: php-windows@lists.php.net > > Subject: RE: [PHP-WIN] Re: Anyone on? INSERT INTO with MS > > Access problem > > > > > > Well, I've been reduced to my lowest level of incompetency... > > > > Anyone else have some input here? > > > > I'm thinking that perhaps I have a bad ODBC Access driver... > > anyone know > > anything about these drivers? > > I currently am using ODBC MS Access driver version 4.00.3711.08 > > > > I can't even get a date into a new database with a new table > > that only has a > > date field with this sql > > > > $sql = "INSERT INTO Datetest (date) VALUES (#$date#);"; > > or > > $sql = "INSERT INTO [Datetest] (date) VALUES (#$date#);"; > > > > If anyone has anything on this, please let me know. > > > > BTW, I can INSERT INTO tables without any problem, UNLESS > it's a date > > field... > > > > --------------------- > > John Asendorf - jasendorf@lcounty.com > > Web Applications Developer > > http://www.lcounty.com - NEW FEATURES ADDED DAILY! > > Licking County, Ohio, USA > > 740-349-3631 > > > > > > > -----Original Message----- > > > From: Bob Hall [mailto:bobhall@clark.net] > > > Sent: Sunday, October 01, 2000 8:30 PM > > > To: php-windows@lists.php.net > > > Cc: JAsendorf@lcounty.com > > > Subject: [PHP-WIN] Re: Anyone on? INSERT INTO with MS > Access problem > > > > > > > > > Instead of '$date', use #$date#. The Jet Database Engine > > requires all > > > dates to be enclosed in pound signs. > > > > > > Bob Hall > > > > > > >I'm having some problems and I'm out of guesses... I'm > > > attempting my first > > > >INSERT INTO with MS Access. I've had wonderful successes > > > with SELECT and > > > >then using that info. But I'm really quite stuck here. > > > > > > > >My first problem is getting the date to not break the INSERT > > > INTO sql. > > > > > > > >When I have date and '$date' in the INSERT INTO sql, I get > > > this error: > > > >Warning: SQL error: [Microsoft][ODBC Microsoft Access > > > Driver] Syntax error > > > >in INSERT INTO statement., SQL state 37000 in SQLPrepare in > > > >D:\InetPub\wwwroot\is\website\test_center\newsinputter.php > > on line 85 > > > > > > > >otherwise it doesn't error out BUT > > > > > > > >BUT BUT BUT > > > > > > > >It doesn't put the data into the table either!!!! no error, > > > but no data > > > >either! Arrrgh! > > > > > > > >Any Suggestions? Thanks in advance, > > > > > > > >John > > > > > > > >Code Below > > > >------------- > > > > > > > ><?php > > > >//check date > > > >//yes, Friedl's book will teach you how to make regexes like > > > this too! > > > >if ( !ereg > > > ("(0?[0-9]|1[0-2])[-/]([0-2]?[0-9]|3[01])[-/]([0-9]{4})", $date ) > > > >) { > > > > //date is invalid > > > > die ("Please press your browser's back button and enter > > > a date in the > > > >format MM-DD-YYYY"); > > > >} > > > > > > > >// create connections > > > >$connection = odbc_connect("web.mdb","",""); > > > > > > > >// test connection > > > >if (!$connection) { > > > >echo "Couldn't make a connection!"; > > > >exit; > > > >} > > > > > > > >echo "TESTING: $date <br> $headline <br> $place <br> > > > >$author > > > <br> $story > > > ><br><br><br>"; > > > > > > > >/* I'll look into these functions a little deeper later > > > >function AccessAddSlashes($S) > > > >{ > > > > > > > >$S=str_replace("\\'","''",$S); > > > >$S=str_replace("\\\"","\"\"",$S); > > > >return $S; > > > >} > > > > > > > >function AccessStripSlashes($S) > > > >{ > > > >$S=str_replace("\"\"","\\\"",$S); > > > >$S=stripslashes($S); > > > >return $S; > > > >} > > > >*/ > > > > > > > >$headline = stripslashes ($headline); > > > >$place = stripslashes ($place); > > > >$author = stripslashes ($author); > > > >$story = stripslashes ($story); > > > > > > > >echo "TESTING AFTER SLASH STRIP: $date <br> $headline <br> > > > $place <br> > > > >$author <br> $story <br>"; > > > > > > > > > > > >// create SQL statement ******(this errors out if I put date > > > and '$date' > > > >into the fields and values)***** > > > >$sql = "INSERT INTO FrontpageNews > > > (headline,place,author,story) VALUES > > > > > > >>('$headline','$place','$author','$story');"; > > > > > > > >// prepare SQL statement > > > >$sql_insert = odbc_prepare($connection,$sql); > > > > > > > >/* execute SQL statement and get results > > > >odbc_execute($sql_insert); */ > > > > > > > > > > > >/* check for errors */ > > > >if (!odbc_execute($sql_insert)) { > > > >/* error */ > > > >echo "Whoops"; > > > >} else { > > > >echo "You did it!"; > > > >} > > > > > > > >odbc_close($connection); > > > > > > > >?> > > > > > > > > > > Know thyself? Absurd direction! > > > Bubbles bear no introspection. -Khushhal Khan Khatak > > > > > > -- > > > PHP Windows Mailing List (http://www.php.net/) > > > To unsubscribe, e-mail: php-windows-unsubscribe@lists.php.net > > > For additional commands, e-mail: php-windows-help@lists.php.net > > > To contact the list administrators, e-mail: > > > php-list-admin@lists.php.net > > > > > > > -- > > PHP Windows Mailing List (http://www.php.net/) > > To unsubscribe, e-mail: php-windows-unsubscribe@lists.php.net > > For additional commands, e-mail: php-windows-help@lists.php.net > > To contact the list administrators, e-mail: > > php-list-admin@lists.php.net > > > > > > -- > > PHP Windows Mailing List (http://www.php.net/) > > To unsubscribe, e-mail: php-windows-unsubscribe@lists.php.net > > For additional commands, e-mail: php-windows-help@lists.php.net > > To contact the list administrators, e-mail: > > php-list-admin@lists.php.net > > > > > > > > -- > > PHP Windows Mailing List (http://www.php.net/) > > To unsubscribe, e-mail: php-windows-unsubscribe@lists.php.net > > For additional commands, e-mail: php-windows-help@lists.php.net > > To contact the list administrators, e-mail: > > php-list-admin@lists.php.net > > > > > -- > PHP Windows Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-windows-unsubscribe@lists.php.net > For additional commands, e-mail: php-windows-help@lists.php.net > To contact the list administrators, e-mail: > php-list-admin@lists.php.net >

« previous php.windows (#2883) next »