The following warnings occurred:
Warning [2] Undefined variable $unreadreports - Line: 26 - File: global.php(961) : eval()'d code PHP 8.2.25 (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
$db->query not returning records
#4
@neverforget98 and @eer3,

I'm running into a similar issue. I've created another table in my userspice database and I'm trying to query data from it using the same format as the queries already in US.

In a previous section I'm generating a 32-digit random token ($project_token), along with name and description, which are inserted into an auto-incrementing table.

<pre>
Code:
$p_create=array('project-token'=>$project_token,'project-name'=>$_POST['project-name'],'project-description'=>$_POST['project-description']);
$db->insert('apps_project',$p_create);
</pre>


Now I'm trying to query the table to find my project by that token

<pre>
Code:
$project_get = $db->query("SELECT * FROM apps_project WHERE token = ".$project_token.";");
$project_get_id = $project_get->results();
$this_id = $project_get_id->id;
</pre>


When I print_r($project_get), this is the result:

Quote:DB Object ( [_pdoBig GrinB:private] => PDO Object ( ) [_queryBig GrinB:private] => PDOStatement Object ( [queryString] => SELECT * FROM apps_project WHERE token = oimevmvlaeccuspb0dtzq6y3xrig4jwt; ) [_errorBig GrinB:private] => 1 [_resultsBig GrinB:private] => Array ( ) [_resultsArrayBig GrinB:private] => Array ( ) [_countBig GrinB:private] => 1 [_lastIdBig GrinB:private] => 20 [_queryCountBig GrinB:private] => 9 )

print_r($project_get_id) just returns an empty "Array()"

I'm guessing from "[_errorBig GrinB:private] => 1" that my sql query has generated an error, and returned no data.

So is it possible to use the built-in DB class/functions, or will that not work for data outside of the US installation?
  Reply


Messages In This Thread
$db->query not returning records - by eer3 - 10-10-2017, 08:31 PM
$db->query not returning records - by eer3 - 10-10-2017, 11:36 PM
$db->query not returning records - by Brandin - 10-11-2017, 09:04 AM
$db->query not returning records - by corey_hitt@multiverse.software - 10-16-2017, 04:30 PM
$db->query not returning records - by Brandin - 10-16-2017, 04:46 PM
$db->query not returning records - by karsen - 10-16-2017, 05:23 PM
$db->query not returning records - by Brandin - 10-18-2017, 11:05 PM

Forum Jump:


Users browsing this thread: 3 Guest(s)