I am trying to connect to the DB to run a SQL query just after creating a ticket through the API.  I don't want to have to include the DB connection details when they are already in use during the new ticket creation.  What variable would I use for the connection string in mysqli($conn, Query)?

db_query('your query here')

When I try that I get the following error:Fatal error: Call to undefined function db_query()

Ok, I figured out that I needed to include mysqli.php for this to work.  Now I am getting the following error.Notice: Trying to get property of non-object in C:\xampp.php5\htdocs\support\include\mysqli.php on line 157

Fatal error: Call to a member function query() on null in C:\xampp.php5\htdocs\support\include\mysqli.php on line 164I am trying to retrieve the ticket_id internal value from the DB for the newly created ticket.  Here is my SQL query. I will populate the query with the variable once I get it working with a known value.  This Query works perfectly in phpMyAdmin.$ticket = db_query('SELECT ticket_id FROM ost_ticket WHERE number = 491551');

I am able to get the results that I want if I use mysqli (the php function not the included script), but this requires defining the database connection within the script.  This is what I want to avoid.  Is there already a variable that contains this information?

Write a Reply...