Re: Any method to get primary key matching a given value ?

Karl DeSaulniers <[email protected]> Sat, 20 Aug 2016 05:30:59 -0500
Newsgroups gmane.comp.php.database
Message-ID <[email protected]>
--Apple-Mail=_AF825C7D-4010-4535-9C97-8F0E3FDF804A
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=us-ascii

Hey Ratin,
Have you looked into the table column named 'pk' inside table_info?
That is where a column is indicated to be a primary key or not.

Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com <http://designdrumm.com/>




> On Aug 18, 2016, at 6:51 PM, Ratin <[email protected]> wrote:
>=20
> Hi Karl, Thanks a lot for your response, I think  INFORMATION_SCHEMA =
is not available for sqlite database. I had to built up the whole query =
with php using PRAGMA table_info(tablename), looking at the pk entry, =
when its 1, get the column name, and then update the sql statement based =
on that. A bit of work, wouldve been much simpler if a method was =
provided, but oh well ..
>=20
> Thanks again
>=20
> Ratin=20
>=20
> On Thu, Aug 18, 2016 at 2:53 PM, Karl DeSaulniers =
<[email protected] <mailto:[email protected]>> wrote:
> Hi Ratin,
> Going to take a stab at this one.
> Have you looked into INFORMATION_SCHEMA.COLUMNS for your query?
> Might be where you want to look for what you are trying.
> Sorry can't help more.
>=20
> Best,
>=20
> Karl DeSaulniers
> Design Drumm
> http://designdrumm.com <http://designdrumm.com/>
>=20
>=20
>=20
>=20
> > On Aug 18, 2016, at 1:27 PM, Ratin <[email protected] =
<mailto:[email protected]>> wrote:
> >
> > I'm writing the generic get that works on different tables having =
different
> > primary keys but the argument of get is always the primary key , =
i.e. get
> > request is -
> >
> > get (column name, value)
> >
> > the value is always the primary key value.
> >
> > It looks like it would be a pretty standard method but I cant find a =
method
> > like that. Anybody have any clue?
> >
> > Thanks
> >
> > Ratin
>=20
>=20
> --
> PHP Database Mailing List (http://www.php.net/ <http://www.php.net/>)
> To unsubscribe, visit: http://www.php.net/unsub.php =
<http://www.php.net/unsub.php>
>=20
>=20


--Apple-Mail=_AF825C7D-4010-4535-9C97-8F0E3FDF804A--