Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7020753
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T23:21:33+00:00 2026-05-27T23:21:33+00:00

I am trying to load all records from the database that have been created

  • 0

I am trying to load all records from the database that have been created by the current logged on user in Joomla, im not sure if its possible to have php inside a mysql query though ?, if not how would I go about doing this otherwise ?

SELECT
  leadname,
  businessname,
  postcode,
  gasoiluser,
  dervuser,
  kerouser,
  cf_uid,
  cf_id
FROM
  #__chronoforms_data_addupdatelead
WHERE createdby = '<?php
  $user =& JFactory::getUser(); echo $user->get('name') ; ?>'
ORDER BY cf_created DESC
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T23:21:34+00:00Added an answer on May 27, 2026 at 11:21 pm

    Of course you can access PHP variables for creating the query – as the #__ prefix suggests, you’re already running your query from “inside Joomla”. Which means it is in php, and something like this should do what you want:

    $user =& JFactory::getUser();
    $db =& JFactory::getDBO();
    if (!$user->guest) {
        $query = 'SELECT leadname, businessname, postcode, gasoiluser, '.
            ' dervuser, kerouser, cf_uid, cf_id '.
            ' FROM #__chronoforms_data_addupdatelead '.
            ' WHERE createdby = '.$db->Quote($user->name)).
            ' ORDER BY cf_created DESC';
        $db->setQuery($query);
    }
    

    But a little more context would help us see what you’ll have to do exactly – what’s the code around the SQL query – is it in a php file?

    Remember, echo prints to the Response, which is not what you want to do in this case, you want to change the query; so just concatenate the variable content to your query, as shown above; and you should actually be already be in php mode where this query is defined, so the <?php tag is of no use (but again, too few context to be sure about this)!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an unnormalized events-diary CSV from a client that I'm trying to load
I have a C# List, that is filled from a database.. So far its
I'm trying to get all records from a table and loop through it. Pseudo
I have a DomainService which I am trying to delete records from. Assuming the
I am trying to clean up a database with a load of crap records
I've been looking for something like that for days. I'm trying to remove all
All, I am trying to load up a bmp file into a GLubyte array
Afternoon all, Using the code below I'm trying to load what is render by
I'm trying to get all controls in a winform disabled at the Load event.
I have a problem with out of memory when I'm trying load a few

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.