pg-query

How can PDO not return a row which pg_query() does?

允我心安 提交于 2019-12-25 04:27:24
问题 I had a table with a bigserial PK, one character varying FK and a bigint FK and a unique constraint on these FKs, a character varying NOT NULL and two nullable smallints. All of this was running in a VM with Ubuntu 14.04.2 LTS, PHP 5.5.9 and PostgreSQL 9.3 and all other packages from the distribution. I did $pdo->query("SELECT * FROM table")->fetchAll(PDO::FETCH_ASSOC) and $r = pg_query($db, "SELECT * FROM table"); pg_fetch_all($r) The latter returned all rows while the former returned all

PHPExcel to insert database using Pg_query

大憨熊 提交于 2019-12-13 07:03:51
问题 I'm using PHP Excel to insert data CSV into database. But i confused to apply it. Here's Mycode: <?php session_start(); include 'connect.php'; include 'PHPExcel/Classes/PHPExcel/IOFactory.php'; $input=$_POST['times']; $rev=$_POST['rev']; $chan=$_POST['channel']; $uploadid='UP'.$_POST['number']; $fcid = 'FC'.$_POST['number']; $schid = 'SCH'.$_POST['number']; $file = $_POST['filename']; $inputFileName = 'D:/ForecastCapacity/'.$file; echo($input.'/'.$rev.'/'.$chan.'/'.$uploadid.'/'.$file); //

pg_query error going directly to console, while pg_last_error returns nothing

…衆ロ難τιáo~ 提交于 2019-12-12 03:56:04
问题 I'm updating some legacy PHP code and trying to get some decent error logging. All calls to the DB now go through this function: private function dbQuery($sql) { if (DEBUG) print("\n" . $sql . "\n"); $result = pg_query($this->dbh, $sql); if ($result == FALSE) print("DB Error: " . pg_last_error($this->dbh) . "\n"); return $result; } But, in at least one case, the error is appearing in the console all by itself (as a PHP Warning), while pg_last_error returns nothing (even though the result of