Welcome Guest, Not a member yet? Register   Sign In
How to insert mysql query to CodeIgniter?
#11

[eluser]Nica[/eluser]
How about the dfrom..?
Code:
WHERE mds_orders.OrderDate BETWEEN '".$date_from." 00:00:00' AND '".$date_to('dto'." 23:59:59'


Is it okay to load also my libraries like this..?
Code:
$autoload['libraries'] = array('database','form_validation','session','pagination','email');

Like you said I already change my starting form tag like this..
Code:
<html>
<head>
</head>
<body>
  <h1>Sales Per Sales Frequency Bracket</h1>
  &lt;?php echo form_open('sales/getAll');?&gt;
   <b>Date From:</b> <br>&lt;input type="text" name="dfrom" id="dfrom"&gt;&lt;/p>
   <b>Date To:</b> <br>&lt;input type="text" name="dto" id="dto"&gt;&lt;br /><br />
   &lt;input name="submit" type="submit" value="Go"&gt;
  &lt;?php echo form_close();?&gt;  
   <table border="2"
   cellpadding="2"
   cellspacing="1"
  >
   <tr>
    <th>Restaurant Code</th>
    <th>Restaurant Name</th>
    <th>100 & Below</th>
    <th>101-200</th>
    <th>201-300</th>
    <th>301-400</th>
    <th>401-500</th>
    <th>501-600</th>
    <th>601-700</th>
    <th>701-800</th>
    <th>801-900</th>
    <th>901-1000</th>
    <th>1001 & Above</th>
    <th>Total Gross Sales</th>
  </tr>
</table>
&lt;?php
if(isset($_POST['submit']))
{
foreach($query as $row)
print $row->code;
print $row->name;
print $row->less100;
print $row->less200;
print $row->less300;
print $row->less400;
print $row->less500;
print $row->less600;
print $row->less700;
print $row->less800;
print $row->less900;
print $row->less1k;
print $row->gtr1k;
print $row->total;
print "<br>";

}
?&gt;
&lt;/html&gt;

but still there are no display.,I don't know if I'm doing right.,I understand if my coding style is a bad practice I'm new in this Code Igniter that's why I'm asking a lot of questions. And thank you a lot for helping me this. Smile
#12

[eluser]Andy Armstrong[/eluser]
Could you export the database? and send it to me.. i can get it work for you then i will post the correct codes.. if that's okay with you
#13

[eluser]Nica[/eluser]
Thank you for your kindness. Smile I really appreciate it. Big Grin
#14

[eluser]Bhashkar Yadav[/eluser]
why you are loading database with PHP.
Code:
$db = "mds_reports";

if($connect = mysql_connect("172.16.8.32", "mds_reports", "password"))
    $connect = mysql_select_db($db);
     else die("Unable to connect".mysql_error());

you can set other database variable into application/config/database.php and can load databases like
Code:
$this->load->database('first_database');
OR
$this->load->database('second_database');
#15

[eluser]Nica[/eluser]
@Bhashkar - I already done with it, I already set my database into application/config/database.php. The first one that you are talking about is just part of my php query.
#16

[eluser]Nica[/eluser]
Hi..

How can I extract the file as csv using Code Igniter..?
#17

[eluser]Nica[/eluser]





Theme © iAndrew 2016 - Forum software by © MyBB