Mailing List Archive



Back to the month index Back to the list index

Oscar Santos (santos@xures.ei.uvigo.es)
Thu, 24 Apr 1997 16:14:57 -0600


Message-Id: <335FDB61.69A3@xures.ei.uvigo.es>
Date: Thu, 24 Apr 1997 16:14:57 -0600
From: Oscar Santos <santos@xures.ei.uvigo.es>
Subject: Re: [mSQL] Automatic field identifier?

Hello Michel!

First, thanks.
Now, I'm probing your solution.

Michel BLANC wrote:
 
> You can try this and use the _seq internal variable. If I do not make
> mistakes, you can go like this :
>
> Note : don't copy the comments
> ===========================================================
> $sock = msqlConnect();
> if ($sock < 0)
> {
> fatal("Error : $ERRMSG\n");
> }
>
> if (msqlSelectDB($sock,"address") < 0)
> {
> fatal("Error : $ERRMSG\n");
> }
>
> //retrieving _seq value from the people table (differs from one table to
> the other
>
> if (msqlQuery($sock,"select _seq from people") < 0)
> {
> fatal("Error : $ERRMSG\n");
> }
>
> //now the query returned one row containing one field containing the seq
> value
>
> $res = msqlStoreResult();
> $row = msqlFetchRow($res);
>
> //here, insertion of Oscar with id=_seq
> $query = "insert into people values ( " + $row[0] + ",'OscarSantos')"
>
> if (msqlQuery($sock,$query) < 0)
> {
> fatal("Error : $ERRMSG\n");
> }
>
> echo("<H2>Good for you :)</H2>\n");
> =====================================================================

Oscar Santos
mailto:santos@xures.ei.uvigo.es
--------------------------------------------------------------------------
To remove yourself from the Mini SQL mailing list send a message containing
"unsubscribe" to "unsubscribe" to msql-list-request@bunyip.com. Send a message containing
"info msql-list" to majordomo@bunyip.com for info on monthly archives of
the list. For more help, mail owner-msql-list@bunyip.com NOT the msql-list!