Jump to content

jebriggsy

New Members
  • Posts

    3
  • Joined

  • Last visited

About jebriggsy

  • Birthday 10/06/2006

Profile Information

  • Gender
    Male

jebriggsy's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I think you may be underestimating my level of competency. I'm doing this project to buff out rust not re-learn basics. I'm not a complete noob, just someone who hasn't done serious coding in a year or three. I intended to implement transactions once I had the basic prototype working. I don't need concurrency when I'm the only one using the software at the moment and nowhere near the point where I'm writing AJAX requests Indeed, eventually I will implement stored procedures, transactions, GPG-based two-factor auth, and maybe a bit of OAuth if I'm feeling adventurous. I'm just stuck on why PDO/PostgreSQL is returning > 0 affected rows on an INSERT that has obviously failed because the table is empty and yet hasn't thrown any exceptions, errors, notices, or warnings. I've always used MySQL and Apache with custom-rolled auth and session systems. I chose a project implementing SessionHandlerInterface using PostgreSQL and Nginx specifically to avoid using old habits that are probably outdated and force me to catch up with modern techniques and design flows. And specifically avoiding frameworks so as to develop a deeper understanding of the concepts.
  2. Just a guess as I'm new to PostgreSQL myself, but you might need a space inbetween the table name and the opening parenthesis. I'm thinking that because there is a new line after the opening parenthesis without a space between it and the table name PostgreSQL is assuming the table name is "bd(" and not "bd". At least that's the impression I got after reading http://www.postgresql.org/docs/9.3/static/sql-syntax-lexical.html
  3. Hello, I'm writing a quick roll-your-own blog to get back into the swing of webdev, and I've hit a snag. I'm trying to use session_set_save_handler to use a custom class of functions, implementing SessionHandlerInterface, to save sessions to a PostgreSQL database table via PDO. I've added die() at every point I think it could be failing but no errors are reported. I checked nginx, php-fpm, and postmaster logs, nothing. The thing I'm trying to debug is the fact that no rows are inserted to the database after setting a random test variable in $_SESSION and calling session_write_close(). I know the script is successfully connecting to the database because no exceptions or errors are thrown, so there must be some error that isn't being reported by PDO or the session handler. Basically PDOStatement::rowCount() is returning > 0 for a query inserting a row into the sessions table but upon a SELECT * on said table nothing is there. So I've attached/bpaste'd the relevant files. Here's what's in them: index.php: the script that runs everything database.php: database functionality main.php: instantiates database for session & other classes. also contains the function to test session/database functionality sessions.php: class implementing SessionHandlerInterface SQL for the sessions table: CREATE TABLE sessions ( session_id bytea PRIMARY KEY, session_expires integer NOT NULL, session_data text NOT NULL, session_ip varchar(39) NOT NULL, user_id integer ); Any help or insight would be much appreciated.index.php database.php main.php sessions.php
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.