Re: [PHP-DB] Any method to get primary key matching a given value ?

2016-10-10 Thread Karl DeSaulniers
Hi Ratin, I "think" you can just do this and not have to store the table name. However, I have no way of testing this. You will have to test on your end. while ($result = $query->fetchArray()) { if ($result['pk'] !== null) { $primary_key=$result['pk']; } } Best,

Re: [PHP-DB] Any method to get primary key matching a given value ?

2016-10-10 Thread Ratin
Hi Karl, Isnt it the same ? I am doing the check if ($result['pk'] == 1), and you are doing if ($result['pk'] !== null). I wanted to make sure I dont get false positives, what if $result['pk'] is set to zero, in your case it will be a match but thats probably not what we want, cuz the pk field

[PHP-DB] Incorporating latest version of sqlite.c and making a sqlite3.so for php

2016-10-10 Thread Ratin
Trying to build the latest released version, how should I go about doing it? Currently I installed the php5-sqlite package on ubuntu 14.04 but its a bit outdated and its not working correctly with the c++ library properly (can't open the DB while c++ app is running even when both parties opened

Re: [PHP-DB] Any method to get primary key matching a given value ?

2016-10-10 Thread Karl DeSaulniers
You may be correct. Admittedly, I am stabbing in the dark here. I work on MySQL, not SQLite. Just good at key word searches. :) This link seems to be promising. http://www.sqlite.org/c3ref/table_column_metadata.html Sorry I can't help more. Best, Karl DeSaulniers Design Drumm

Re: [PHP-DB] Any method to get primary key matching a given value ?

2016-10-10 Thread Ratin
Sorry about my late reply but this was my function - a bit of a hack but works properly on my version of php-sqlite3: function get_primary_key_name($table) { $primary_key=''; $db = new MyDB(); if(!$db) { echo