Invision Community 4: SEO, prepare for v5 and dormant account notifications By Matt Monday at 02:04 PM
不中用 Posted February 26, 2016 Posted February 26, 2016 . I can't access the database in PHP nor in Pages .. I follow "kind of" the logic I see in the source files .. I am missing something here? I want to retrieve the file version from a file in Downloads .. <?php require_once( 'init.php' ); \IPS\Session\Front::i(); $memCSRF = \IPS\Session::i()->csrfKey; $member = \IPS\Member::loggedIn(); $memName = $member->name; $memEmail = $member->email; $memID = $member->member_id; $fileVersion = \IPS\Db::i()->select( 'file_version', 'downloads_files', array( 'file_id=?', '8' ) ); ?> <!doctype html> <html> <head> <meta charset="utf-8"> <title>testing page</title> </head> <body> <p>Hello <?php echo $memName; ?></p> <p>File version: <?php echo $fileVersion; ?></p> <p><a href="logout/?csrfKey=<?php echo $memCSRF; ?>">Logout</a></p> </body> </html> the result I get is: (it should be a version number) Hello IN10TIONFile version: SELECT file_version FROM `downloads_files` WHERE file_id=?Logout In Pages I've tried: {{$member = \IPS\Member::loggedIn();}} {{$memName = $member->name;}} {{$fileVersion = \IPS\Db::i()->select( 'file_version', 'downloads_files', array( 'file_id=?', '8'));}} <strong>File $fileVersion</strong> and I get also same result: (it should be a version number) File SELECT file_version FROM `downloads_files` WHERE file_id=? I can't find any solution in the forums, so I ask here .. .
Ahmad E. Posted February 26, 2016 Posted February 26, 2016 $fileVersion = \IPS\Db::i()->select( 'file_version', 'downloads_files', array( 'file_id=?', '8' ) ); should be: $fileVersion = \IPS\Db::i()->select( 'file_version', 'downloads_files', array( 'file_id=?', '8' ) )->first();
不中用 Posted February 26, 2016 Author Posted February 26, 2016 . And I was looking at it before "->first()" .. and never tried it out .. because I thought I was requesting just for 1 value ( file_id=8 ) .. Thanks a lot @Ahmad E. !! .
Recommended Posts
Archived
This topic is now archived and is closed to further replies.