Thanks again Miles

I tried all the numerous permutations for assigning the value to the record
but I couldnt get it to work

However I took your advice on ODBC and got it to work!!!
The only
problem I have is entering a date through a SQL insert command.
I am using the following sql string (for may 21 2002) which works fine for
strings, booleans
and double data types

insert into M_EVENTS (FROM) values ('20020521')


I have tried the following formats with and without quotes to no avail:

21/05/2002
05/21/2002
21052002
20022105
20020521

This is the error I am getting:
SQL error: [Microsoft][ODBC dBase Driver] Syntax error in INSERT INTO
statement., SQL state 37000 in SQLExecDirect

nearly there!
I would appreciate any suggestions
thanks
Labhras



"Miles Thompson" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Labrhas,
>
> If you echo $new_record, and $newrecord["name"], what displays? I'm really
> trying to confirm that $new_record is an array, and that
> $new_record["name"] contains what you expect. Is it possible that you have
> to assign like this:
>          $new_record['name'] = "'xxxxxxxxxx'";
> which would put a quoted string in the array. I know this seems weird, but
> I started with dBase II and I've been working with FoxPro since 1.01 and
> every so often you get into weird scenarios where the dBase/FP engine
> thinks you're passing a var not a literal. (This is also "grasping at
> staws" territory.)
>
> I want to reiterate that the dbase functions are not recommended for
> production work. See the note under dbase. AS an alternative, what about
> using odbc? You may be able to run an insert query.
>
> Miles
>
> At 03:17 PM 7/4/2002 +0100, labhras sammin wrote:
> >thanks for your help
> >I have tested that everything works, valid handles, returned method
values,
> >etc.
> >Line 23 is the dbase_add_record line. Do you know of anywhere there may
be
> >an example
> >thanks Labhras
> >
> >
> >"Miles Thompson" <[EMAIL PROTECTED]> wrote in message
> >[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > > 1. Please don't cross post.
> > > 2. Which line is #23?
> > > 3. Have you tested to ensure that you have a valid handle? ($db_num)
> > > 4. Have you tried adding error code to see the result of
dbase_create(),
> > > dbase_open()
> > > 5. I seem to remember reading in the docs, a long time ago (2 yr) that
the
> > > dbase functions were not really reliable and were intended mostly to
> > > extract info for export to another database. I could not be 100% wrong
on
> > > that, and I've not worked with the dbase functions in PHP.
> > >
> > > After this reply, please keep this focused on the php-db list.
> > >
> > > Regards - Miles Thompson
> > >
> > > At 12:14 PM 7/4/2002 +0100, labhras sammin wrote:
> > > >Hi I need to use PHP (ver 4 windows) to add a record to a dBase iv
> >database.
> > > >
> > > >I can  create, open, read and close a database but when I try to add
a
> > > >record I always get  the following error:
> > > >Warning: unexpected error in C:\php\phpstuff\addTest1.php on line 23
> > > >
> > > >Here is the code [shortened] that I use to create the database table,
> >open
> > > >the table, create the record and add the record- the database table
has
> >one
> > > >field a 10 char string:
> > > >
> > > >$dbname = "test1.dbf";
> > > >$dbflag = 2;
> > > >$def = array( array("name",     "C",  10));
> > > >dbase_create($dbname, $def));
> > > >$db_num = dbase_open($dbname, $dbflag);
> > > >$new_record['name'] = 'xxxxxxxxxx';
> > > >dbase_add_record ($db_num, $new_record);
> > > >
> > > >any help, advice or code samples would be very appreciated
> > > >thanks
> > > >Labhras
> > > >
> > > >
> > > >
> > > >
> > > >--
> > > >PHP Database Mailing List (http://www.php.net/)
> > > >To unsubscribe, visit: http://www.php.net/unsub.php
> > >
> > >
> >
> >
> >
> >--
> >PHP General Mailing List (http://www.php.net/)
> >To unsubscribe, visit: http://www.php.net/unsub.php
>
>





-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to