TOPIC:

SOLVED! Urgent! Display SQL view on page 1 week 1 day ago #249544

  • Topic Author
  • sprockt012
  • Offline
  • Senior Breezer
  • Senior Breezer
  • Posts: 96
  • Thanks: 0
This is rather urgent (needs to be working tomorrow) and I appreciate any help anyone can offer. I hope it's simple for someone...

I have two views I created in PHPMyAdmin (view4 and view5) that call BF and CB table data. I also have a view6 that calls on the other views to display one column of data (about 15 records). The views work beautifully within PHPMyAdmin and I see the exact data I need.

I simply want to display this information somewhere on my site. I though ContentBuilder would be easy to use for this but I am striking out. When I try to use data storage, view, etc. my site throws errors.

Here is the SQL code for each view in case someone can suggest a solution:

xmacorp_view4
SELECT concat(t905v_irisxmacorp_eelist.cbLastname,' ',t905v_irisxmacorp_eelist.cbFirstname)
FROM t905v_irisxmacorp_eelist

xmacorp_view5
SELECT concat(t905v_irisxmacorp_today.xmaFirstName,' ',t905v_irisxmacorp_today.xmaLastName)
FROM t905v_irisxmacorp_today
WHERE DATE( t905v_irisxmacorp_today.created ) = CURDATE()

xmacorp_view6
SELECT *
FROM xmacorp_view4
EXCEPT
SELECT *
FROM xmacorp_view5

Thank you!

Please Log in or Create an account to join the conversation.

Last edit: Post by sprockt012.

URGENT! Display SQL view on page 1 week 1 day ago #249549

  • tihana.krivic's Avatar
  • tihana.krivic
  • Offline
  • Moderator
  • Moderator
  • Posts: 1664
  • Karma: 3
  • Thanks: 149
Hi,

for this you can use datastorage, and choose existing table.
But also, you can show the result of this in column.
I'm not sure if you want that?
Something like this in content prepare:
$db = JFactory::getDBO();
$db->setQuery('Your query here'); 
$result = $db->loadResult();
 $items["ITEMNAME"]["value"]=$result;

Regards,
Tihana

Please Log in or Create an account to join the conversation.

Last edit: Post by tihana.krivic.

URGENT! Display SQL view on page 1 week 20 hours ago #249555

  • Topic Author
  • sprockt012
  • Offline
  • Senior Breezer
  • Senior Breezer
  • Posts: 96
  • Thanks: 0
Thank you for your help! Getting closer - as it’s displaying a row number. I’d expect to see data however. Does my select look right to choose all columns?
<?php
defined('_JEXEC') or die('Restricted Access');

// Get a db connection.
$db = JFactory::getDbo();

// Create a new query object.
$query = $db->getQuery(true);

// Select all records from the test view
$query->select('*')
->from($db->quoteName('view2_test'));

// Reset the query using our newly populated query object.
$db->setQuery($query);

// Load the results
$result = $db->loadResults();

 $items["ITEMNAME"]["value"]=$result;

// print_r($results);

?>

Please Log in or Create an account to join the conversation.

URGENT! Display SQL view on page 1 week 20 hours ago #249556

  • tihana.krivic's Avatar
  • tihana.krivic
  • Offline
  • Moderator
  • Moderator
  • Posts: 1664
  • Karma: 3
  • Thanks: 149
Hi,

as far as I can see the code looks ok.
But this will only load in one column
With this part:
....
 $items["ITEMNAME"]["value"]=$result;
ITEMNAME is name of your element (one column).

Maybe with this:
<?php
defined('_JEXEC') or die('Restricted Access');

// Get a db connection.
$db = JFactory::getDbo();

// Create a new query object.
$query = $db->getQuery(true);

// Select all records from the test view
$query->select('*')
->from($db->quoteName('view2_test'));

// Reset the query using our newly populated query object.
$db->setQuery($query);

// Load the results
$result = $db->loadResults();

 
 print_r($result);

?>
Regards,
Tihana

Please Log in or Create an account to join the conversation.

Last edit: Post by tihana.krivic.

URGENT! Display SQL view on page 1 week 19 hours ago #249557

  • Topic Author
  • sprockt012
  • Offline
  • Senior Breezer
  • Senior Breezer
  • Posts: 96
  • Thanks: 0
Hmmm...not sure I’m following...

Should I replace the word ITEMNAME with the name of the column I want to see?

Please Log in or Create an account to join the conversation.

URGENT! Display SQL view on page 1 week 19 hours ago #249558

  • tihana.krivic's Avatar
  • tihana.krivic
  • Offline
  • Moderator
  • Moderator
  • Posts: 1664
  • Karma: 3
  • Thanks: 149
Hi,

ITEMNAME is name of element in which you want to show that :)

Regards,
Tihana

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
  • 2
Time to create page: 0.041 seconds

BreezingForms Pro 1.4.7 for WordPress Released!

Available in the membership section.

September Discount!

Massive discounts on all subscriptions!

Get Your Subscription Here

Quick Links

Downloads

BreezingForms

ContentBuilder

BreezingCommerce

Templates

Documentation

BreezingForms

ContentBuilder

BreezingCommerce

Apprendre BreezingForms (French Community)

Apprendre et maîtriser BreezingForms par des tutoriels et exemples, le tout en français

breezingforms.eddy-vh.com

Questions et réponses sur les forums de l'AFUJ

AFUJ

Special Offer

Summer Sale! All subscriptions at a special price!

Includes prio support, all of our current and future Joomla!® extensions and Joomla!® templates for the duration of your membership.

Get it from here

3rd Party Discount - 25% Off

We help you to keep your costs under control. If you are a new member and purchased a form building tool from a different form vendor, then you'll get a 25% discount on our subscription plans.

How to receive the discount:

Send us a quick email to sales@crosstec.org with a proof of purchase (for example a paypal receipt), await payment instructions and enjoy your membership!