Hi Ratin,

working with sqlite, are you ?

In that case, take a look at the default table :

SELECT sql from sqlite_master where type= "table" and name = "<your_table_name>"

This query returns the creation query of the table concerned.
By parsing it textually, you can find out the field name that was declared PRIMARY (key)

On 19/08/16 01:51, Ratin wrote:
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 ..

Thanks again


On Thu, Aug 18, 2016 at 2:53 PM, Karl DeSaulniers <k...@designdrumm.com>

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.


Karl DeSaulniers
Design Drumm

On Aug 18, 2016, at 1:27 PM, Ratin <rat...@gmail.com> wrote:

I'm writing the generic get that works on different tables having
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
like that. Anybody have any clue?



PHP Database 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