<?xml version="1.0" encoding="UTF-8"?>    <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
      <channel>
        <title>Using mysql_get in reports</title>
        <link>https://interactivetools.com/forum/forum-posts.php?Using-mysql_get-in-reports-78501</link>
        <description></description>
        <pubDate>Sun, 19 Jul 2026 15:21:52 -0700</pubDate>
        <language>en-us</language>
        <atom:link href="https://interactivetools.com/forum/forum-posts.php?rss=1&amp;Using-mysql_get-in-reports-78501" rel="self" type="application/rss+xml" />

                <item>
          <title>Using mysql_get in reports</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2230104#post2230104</link>
          <description><![CDATA[<p>Hi Djulia, </p>
<p>Glad to hear you've got it working!</p>
<p>&gt;The idea is interesting, but won't that multiply the queries unnecessarily sometimes? I think of the server resources...</p>
<p>It should be almost no resources since the database connection is already opened by CMSB, just sending the text across, and no databases are being queried.  So if you need to do that on a wider scale in future that's a possibility.</p>
<p>Or alternatively you might be able to put it in a mysql config file if you have access to them: <a href="http://dev.mysql.com/doc/refman/5.5/en/option-files.html" rel="nofollow">http://dev.mysql.com/doc/refman/5.5/en/option-files.html</a></p>
<p>Cheers!</p>]]></description>
          <pubDate>Wed, 03 Apr 2013 13:37:59 -0700</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2230104#post2230104</guid>
        </item>
                <item>
          <title>Using mysql_get in reports</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2230093#post2230093</link>
          <description><![CDATA[<p>Hi Dave,</p>
<p>I added the querie in the script.<br />That functions perfectly! :)</p>
<p><code>  // get query result<br />   $sql          = getEvalOutput($report['mysql']);<br />   mysql_query("SET lc_time_names = 'es_ES'");<br />   $result       = @mysql_query($sql);<br />   $result_error = mysql_error();</code></p>
<p><br />&gt;What about putting that first line in a plugin that runs on every CMS page load.<br />The idea is interesting, but won't that multiply the queries unnecessarily sometimes ?</p>
<p>I think of the server resources...</p>
<p>Thanks again!</p>
<p>Djulia</p>]]></description>
          <pubDate>Wed, 03 Apr 2013 03:25:14 -0700</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2230093#post2230093</guid>
        </item>
                <item>
          <title>Using mysql_get in reports</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2230089#post2230089</link>
          <description><![CDATA[<p>Hi Djulia, </p>
<p>The problem is PHP's mysql_query() does not support multiple queries.  </p>
<p>What about putting that first line in a plugin that runs on every CMS page load.  Because you probably want that setting everywhere don't you?</p>
<p>Let me know if that would work for you or if I can help with a plugin.  Thanks!</p>]]></description>
          <pubDate>Tue, 02 Apr 2013 17:05:57 -0700</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2230089#post2230089</guid>
        </item>
                <item>
          <title>Using mysql_get in reports</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2230071#post2230071</link>
          <description><![CDATA[<p>Hi Dave,</p>
<p>I tried to use SET lc_time_names in a request, but that does not function in reportBuilder.</p>
<p><code>SET lc_time_names = 'es_ES.UTF-8';<br />SELECT DATE_FORMAT(`date`, '%d %M %Y') FROM `dates`;<br /></code><br />Do you think that it is possible to add the function directly in the script?<br /><br />Thank you for your suggestion.</p>
<p>Djulia</p>]]></description>
          <pubDate>Mon, 01 Apr 2013 12:12:39 -0700</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2230071#post2230071</guid>
        </item>
                <item>
          <title>Using mysql_get in reports</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2229578#post2229578</link>
          <description><![CDATA[<p>Hi <span>nmsinc, </span></p>
<p>I'm not exactly sure about how to integrate payroll_dates but here's a join for getting the employee number:</p>
<p><code>SELECT DATE_FORMAT(ph.date_hours_worked, '%M %D %Y') as 'Work Date',<br />        ph.assinged_to_which_group           as 'Member Company',<br />        ph.employee_name                     as 'Imployee Number',<br />        ph.hours_worked                      as 'Hours Worked',<br />        ph.payroll_accounting_group          as 'Work Group',<br />        ph.assign_contract_group_id          as 'Assigned To Work Group',<br />        a.employee_number                    as 'Employee #'<br />      FROM `&lt;?php echo $TABLE_PREFIX ?&gt;paysheet_hours` ph<br /> LEFT JOIN `&lt;?php echo $TABLE_PREFIX ?&gt;accounts` a ON ph.employee_name = a.employee_name</code></p>
<p>How it works is we add an alias after eachg table name (ph for paysheet_hours) and then add that to all the fieldnames so mysql knows which table they're from.  Then where paysheet_hours.empoyee_name is the same as accounts.employee_name we're load a.employee_number.</p>
<p>Hope that helps!  Let me know if you can get any further with that or any other questions.</p>]]></description>
          <pubDate>Thu, 21 Feb 2013 12:40:22 -0800</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2229578#post2229578</guid>
        </item>
                <item>
          <title>Using mysql_get in reports</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2229514#post2229514</link>
          <description><![CDATA[<p>Hi Dave,</p>
<p>See code below:</p>
<p>------------------------------------------------------------------------------------------------------</p>
<p>SELECT DATE_FORMAT(date_hours_worked, '%M %D %Y') as 'Work Date',<br />       assinged_to_which_group           as 'Member Company',<br />       employee_name                     as 'Imployee Number',<br />       hours_worked                      as 'Hours Worked',<br />       payroll_accounting_group          as 'Work Group',<br />       assign_contract_group_id          as 'Assigned To Work Group'</p>
<p>FROM `&lt;?php echo $TABLE_PREFIX ?&gt;paysheet_hours`<br />&lt;?php<br />$start = date("Y-m-d 00:00:00", strtotime('2013-02-03'));<br />$end = date("Y-m-d 00:00:00", strtotime('2013-02-28'));<br />$timedate = strtotime('date_hours_worked');<br />?&gt;</p>
<p>&lt;?php if ($timedate &gt; $start OR $timedate &lt; $end): ?&gt;</p>
<p>WHERE assinged_to_which_group = 177 AND date_hours_worked &gt; '&lt;?php echo $start; ?&gt;' AND date_hours_worked &lt; '&lt;?php echo $end; ?&gt;'<br />GROUP BY date_hours_worked<br />ORDER BY YEAR(date_hours_worked) DESC, MONTH(date_hours_worked) DESC</p>
<p>&lt;?php endif; ?&gt;</p>
<p>----------------------------------------------------------------------------------------------</p>
<p>I want to bring in information from two sections:</p>
<p>SECTION #1: "<strong>payroll_dates</strong>" with fields <strong>'start_date'</strong> and <strong>'end_date'</strong> to replace the start and end date sorting above.</p>
<p>SECTION #2: "<strong>accounts</strong>" with the field 'fullname' of the employee based upon the field  'employee_name' in the report above. The field <strong>'employee_name' </strong>in the table '<strong>paysheet_hours'</strong> is populated when the user chooses an employee from a list of employee names and it saves the '<strong>employee_number'</strong> field rather then the '<strong>num</strong>' field.</p>
<p>Thanks - nmsinc</p>]]></description>
          <pubDate>Mon, 18 Feb 2013 17:08:08 -0800</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2229514#post2229514</guid>
        </item>
                <item>
          <title>Using mysql_get in reports</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2229512#post2229512</link>
          <description><![CDATA[<p>Ahh, it's for Report Builder.  I've been coding blind! :) </p>
<p>You need a join for that, can you post your full query into your message?  I'll see if I can update it to do a mysql join for you.</p>
<p>Cheers,</p>]]></description>
          <pubDate>Mon, 18 Feb 2013 15:15:42 -0800</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2229512#post2229512</guid>
        </item>
                <item>
          <title>Using mysql_get in reports</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2229500#post2229500</link>
          <description><![CDATA[<p>The Reports Plugin although very good has its limits and I need to bring in other field data that is not supported. Does interactivetools have a plugin with csv conversion with more options?</p>
<p>It would be great to have search options built in!</p>
<p>Thanks - nmsinc</p>]]></description>
          <pubDate>Mon, 18 Feb 2013 06:10:46 -0800</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2229500#post2229500</guid>
        </item>
                <item>
          <title>Using mysql_get in reports</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2229490#post2229490</link>
          <description><![CDATA[<p>Hi nmsinc, </p>
<p>CMSB doesn't have any support for anything like that.  But here's two ways to get data from two tables with PHP and MySQL.  They're both a little tricky but will hopefully point you in the right direction.</p>
<p>Using a MySQL join:</p>
<p><code>   SELECT t1.fullname, t2.num<br />     FROM cms_accounts t1<br />LEFT JOIN cms_accounts t2 ON t1.fullname = t2.fullname</code></p>
<p>Basically saying "join table1 with table2 when both fields match.  Using your fieldnames it might look like this:</p>
<p><code>  SELECT t1.employee_name, t2.employee_number<br />    FROM {$TABLE_PREFIX}paysheet_hours t1<br />EFT JOIN {$TABLE_PREFIX}accounts t2 ON t1.employee_name = t2.employee_name</code></p>
<p>Or if you're working in PHP, another way is just to create a lockup array of employee names to nums:</p>
<p><code>$accounts     = mysql_select('accounts');<br />$accountNames = array_pluck($accounts, 'employee_name');<br />$accountNums  = array_pluck($accounts, 'employee_number');<br />$namesToNums  = array_combine($accountNames, $accountNums);<br /><br />print "Bob is account # " .@$namesToNums['Bob']. "&lt;br/&gt;\n";<br />print "And here's a list of all the names to nums:\n";<br />showme($namesToNums);<br />exit;</code></p>
<p>And if it's easy to do, it's generally better to associate records by  number (num, or <span>employee_number) instead of name, since they're less likely to change than names, labels, or titles.</span></p>
<p>Hope that helps, let me know any questions.</p>]]></description>
          <pubDate>Sun, 17 Feb 2013 13:17:15 -0800</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2229490#post2229490</guid>
        </item>
                <item>
          <title>Using mysql_get in reports</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2229469#post2229469</link>
          <description><![CDATA[<p>Hi Dave,</p>
<p>I need to report the field: 'employee_number' from the 'accounts' section based on the field value of 'employee_name' stored in the 'paysheet_hours' section! </p>
<p><span>Thanks - nmsinc</span></p>]]></description>
          <pubDate>Fri, 15 Feb 2013 06:14:38 -0800</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2229469#post2229469</guid>
        </item>
                <item>
          <title>Using mysql_get in reports</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2229464#post2229464</link>
          <description><![CDATA[<p>Hi nmsinc, </p>
<p>What's the tablename that you want to load those fields from and what is there WHERE on conditions you want to filter on (eg: first record, record 456, record where title = 'something').</p>
<p>Let me know and I'll try and help.  Thanks!</p>]]></description>
          <pubDate>Thu, 14 Feb 2013 17:55:28 -0800</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2229464#post2229464</guid>
        </item>
                <item>
          <title>Using mysql_get in reports</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2229463#post2229463</link>
          <description><![CDATA[<p>I need to grab a field from the user section and add it to the SELECT GROUP below. I tried using mysql_get with no luck - any suhhestions?</p>
<p>SELECT DATE_FORMAT(date_hours_worked, '%M %D %Y') as 'Work Date',<br />       assinged_to_which_group           as 'Member Company',<br />       employee_name                     as 'Imployee Number',<br />       hours_worked                      as 'Hours Worked',<br />       payroll_accounting_group          as 'Work Group',<br />       assign_contract_group_id          as 'Assigned To Work Group'</p>
<p> Thanks - nmsinc</p>]]></description>
          <pubDate>Thu, 14 Feb 2013 17:25:59 -0800</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2229463#post2229463</guid>
        </item>
              </channel>
    </rss>
  