The following warnings occurred:
Warning [2] Undefined variable $unreadreports - Line: 26 - File: global.php(961) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/global.php(961) : eval()'d code 26 errorHandler->error
/global.php 961 eval
/showthread.php 28 require_once





× This forum is read only. As of July 23, 2019, the UserSpice forums have been closed. To receive support, please join our Discord by clicking here. Thank you!

  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
v.5 -- Didn't know where else to post this so...
#14
I've begun working on this and have reached a frustration point. I'm brand new to PDO and the like and I can't seem to get a simple query to work. For identifying the "id" of the page we're on, I've added this simple function to the helpers.php file.


function currentPage_id() {
$current_page_url = currentPage();

$db = DB::getInstance();
$query = $db->query("SELECT id FROM pages WHERE page = users/" . $current_page_url);
$results = $query->first();
$current_page_id = $results->id;

//echo '$current_page_id: ' . $current_page_id;
return $current_page_id;
}


A couple things then...
1.) Why do we need the "$query->first();" part? It seems like "$query->results();" should work, but it doesn't.
2.) The current code constantly returns "1". For example, on the admin.php page, it should return 4.

Any ideas on why this is failing?
  Reply


Messages In This Thread
v.5 -- Didn't know where else to post this so... - by gtilflm - 11-02-2016, 03:14 AM

Forum Jump:


Users browsing this thread: 4 Guest(s)