Accessing db doesn't seem to work

Search
Other Pre-Sale questions
Forum

Accessing db doesn't seem to work

Thom Hounsell's Avatar Thom Hounsell
I have the following code in an article (latest J version) and while I can make some php work as expected, trying to access a table with JFactory seems to fail completely. My code:
{source}<?php

$invoice_id = 18;

//get the invoice data

$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select($db->quoteName(array('id', 'customer', 'status', 'invoice_number', 'amount', 'tax', 'total_due', 'jobs_description')));
$query->from($db->quoteName('invoices'));
$query->where($db->quoteName('id') . ' = ' . $db->quote('$invoice_id'));
$db->setQuery($query);
$invoice = $db->loadAssoc();

var_dump($company);

?>

{/source}
returns null for var_dump. var_dump on $db causes a 500 error. What's going on? Do I need to add some sort of path info or something?
Peter van Westen's Avatar Peter van Westen ADMIN
How to form your database call depends on your database and table and such.
This is a support request, not a pre-sales question.
I only offer support on the paid version.

Please consider purchasing a pro subscription:
regularlabs.com/sourcerer/features
Please post a rating at the Joomla! Extensions Directory
Thom Hounsell's Avatar Thom Hounsell
Thanks. I'd be happy to use this on a time-limited trial basis and then purchase once I see that it works. But if your business model is based on obfuscating how it's properly used and only sharing info about how to properly use the tool after purchase, then I think I will start by looking for alternatives because your business model isn't really inspiring confidence.
Peter van Westen's Avatar Peter van Westen ADMIN
You can buy and if you are not happy with it, use the 30-day money-back guarantee.
I am not obfuscating anything.

You are asking for usage support. I offer no support on the free version.
If you don't agree with that, then yes, best to look for an alternative.
Please post a rating at the Joomla! Extensions Directory
Thom Hounsell's Avatar Thom Hounsell
Okay, good to know you'd provide a refund. I will keep it in mind. Still, instead of hoping for a refund, I'd prefer working with a business that offers time-based trials and unfettered support. I can't be the first user who wants to access a database from within an article, and the fact that i cannot find the answer on your site doesn't make me wanna pull my wallet out.
You can only post on this forum if you log in