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
SQL Query
#2
I'm not an expert when it comes to complicated queries. That might be a better question for StackOverflow. The great thing about the database classes with userspice is that although there are tools to write quicker update, delete, insert, etc you can always write just a generic query that is not userspice specific.

So, if you want to assign your query a variable, you just do

$myQuery=$db->query("Your Query Here"); //you can also just run it without assigning a variable

BUT you can also format your results based on what you want back.

Do you want only the first one result?

$answer=$myQuery->first();

Do you want all the results as an object?
$fullAnswer=$myQuery->results();

The great news is that whatever is in your quotes for your query is just normal SQL...not userspice specific.
  Reply


Messages In This Thread
SQL Query - by CuChulla1nn - 07-28-2016, 10:47 AM
SQL Query - by mudmin - 07-28-2016, 10:59 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)