Welcome Guest, Not a member yet? Register   Sign In
  Error message from model
Posted by: El Forum - 09-30-2008, 01:08 PM - Replies (5)

[eluser]Unknown[/eluser]
Hello,

i am new to CI and i have problem...
now i have in development an app with dojo and ajax support, so all queries are called by ajax
my problem is:
i need get error message from model if query is bad or if there is another error
is that any function or method for it?

P.S: i want to add error message to variable

Thank for replies and sorry id the question is dumb :-)


  Spry Ajax PHP Codeigniter Smarty - Report in XLS formate header problem
Posted by: El Forum - 09-30-2008, 12:59 PM - Replies (5)

[eluser]kamal1976[/eluser]
Dear Sir,

I am using CI with Spry Adodb Ajax and smarty template. I have problem while creating a Excel file on submit when the submit is through Ajax if its a normal submit promptly starts to down load. Following is the code i am using.

/* make an xls file */
if (! function_exists ( 'makeXLS' ) ) {
function makeXLS( $data, $file, $title ) {
$i = 0;
$xls = "<table border='1' cellpadding='1' cellspacing='0' bgcolor=''>";
$keyrow = "";
$valrow = array();
/* dump ($data);
print("<br>") . $file;
print("<br>") . $title; */

foreach($data as $res) {
$keyrow = "<tr><td colspan='". sizeof($res) ."' bgcolor='#000000' align='center'><font color='#FFFFFF' size='2'><b>$title</b></font></td></tr><tr>";
$valrow[$i] = "<tr>";
foreach((array)$res as $key=>$val) {

/* manual field/display key name mangling here */
switch ($key) {

case "gc_id":
$key = "Global Company ID";
break;
/* case "amount":
$val = "\$" . number_format($val,2);
break;
case "amount_sum":
$val = "\$" . number_format($val,2);
break; */
}

if (preg_match("/amount/i","$key")) {
$val = "\$" . number_format($val,2);
}
if (preg_match("/date/i", "$key")) {

$val = substr($val, 0, -11);
}
$key = preg_replace('/_/', ' ',"$key");
$key = ucwords($key);

/* now add the key and value to the excel output table */
$keyrow .= "<td bgcolor='#cccccc'><b>$key</b></td>";
$valrow[$i] .= "<td>$val</td>";
}
$keyrow .= "</tr>";
$valrow[$i] .= "</tr>";
$i++;
}
$xls .= $keyrow;
foreach ($valrow as $row) {
$xls .= $row;
}
$xls .= "</table>";


header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Content-Type: application/force-download");
header("Content-Type: application/octet-stream");
header("Content-Type: application/download");
header("Content-Disposition: attachment;filename= ". $file ." ");
header("Content-Transfer-Encoding: binary ");

print $xls;
exit;
}
}

My submit button with Ajax it is printing my xls file on the html page rather then prompt for the download in xls format.

&lt;form action="/acctls/main/company_records" method="post"
name="get_transactions" id="get_transactions"
&gt;&lt;input
type="hidden" name="form_name" id="form_name" value="get_invoices" />

If I use the same form submit like below it works perfectly but I must use Ajax as its Ajax progression.

&lt;form action="/acctls/main/company_records" method="post"
name="get_transactions" id="get_transactions"&gt;&lt;input
type="hidden" name="form_name" id="form_name" value="get_invoices" />


Can you please guide if its a header setting problem as if the submit is not ajax it works perfectly.
I am keenly waiting for your response.
Regards
Kamal.


  I have a problem with GD2 php library...
Posted by: El Forum - 09-30-2008, 11:26 AM - Replies (5)

[eluser]miky4e[/eluser]
Hello, I have a big problem with GD Library on my Macintosh System.

I have mac os x leopard 10.5.5, with php 5.2.6 compiled from source, today, with support libjepg and libpng (from diskimage install).

But, I have this problem...

Code:
Your server does not support the GD function required to process this type of image.

But at

Code:
/usr/local/php5/ext/

I found gd/ directory with .h extension files.

Where is the problem?? O_O

I Need GD2 support to develop my web gallery!

Thanks Wink


  Error Oracle + Session in DB
Posted by: El Forum - 09-30-2008, 10:23 AM - Replies (3)

[eluser]Unknown[/eluser]
I have a problem when using Session-PHP-Codeigniter + Oracle, as the sql generated by the Session has quotes in the names of columns and tables, but the Oracle does not accept. How to fix it?

SQL output ERRO:
SELECT * FROM pgj.sessions WHERE "session_id" = '5fa1216e9da0d8b50012acb3239a372e' AND "user_agent" = 'Mozilla/5.0 (X11; U; Linux x86_64; pt-BR; rv:1.9.0'


  Database Query not displaying expected output.
Posted by: El Forum - 09-30-2008, 10:11 AM - Replies (1)

[eluser]JasonS[/eluser]
I have a category structure which looks like this.

Bike
- New
Cars

Bike is the parent of New.

I am trying to create a query which will generate an array to display the above output.

What I have currently outputs

Bike
- New

But Cars gets lost. Could someone have a peek and tell me where I am going wrong.

Cheers.

Code:
$this->db->where('parent', '0');
        $query = $this->db->get('categories');
        
        $count = 0;
        
        foreach($query->result() as $row)
        {
            $array[$count]['id'] = $row->id;
            $array[$count]['name'] = $row->name;
            
            $this->db->where('parent', $row->id);
            $newquery = $this->db->get('categories');
            if ($newquery->num_rows() > 0)
            {
                foreach($newquery->result() as $newrow)
                {
                    $array[$count]['id'] = $newrow->id;
                    $array[$count]['name'] = '&nbsp; - ' . $newrow->name;
                }
            }
            
            $count++;
        }


  Pagination page number issues
Posted by: El Forum - 09-30-2008, 06:08 AM - Replies (2)

[eluser]Unknown[/eluser]
Hi,

I've spent the entire day reading through everyone else's pagination issues but none seem to be too similar to mine.

It took me a while but I thought I had everything working. Now, however, it turns out that whatever I set $config['per_page'] to becomes the next page number in the pagination links.

E.G.

If I have 11 results in total, and am showing 10 per page the first 10 results will show fine and the pagination links will show the next page link as "2" but it will point towards /page/10/.

Similarly, if I have 11 results in total, and am showing 5 per page the first 5 results will show fine and the pagination links will show the next page link as "2" but it will point towards /page/5/. The same happens whatever I set $config['per_page'] to.

If I simply put /page/1 into the address bar, the "second" page of results shows up just fine, but the pagination links are still wrong.

I don't really want to post my code here because it's long and a little messy - I don't want to put anyone off. The only instructions I give to the pagination library are:

$config['base_url'], $config['uri_segment'] if the page number is present n the URI, $config['total_rows'] which I know is right, and of course $config['per_page'].

Have I misunderstood something here? Any assistance will be much, much appreciated Smile Thank you.


  Active record problem
Posted by: El Forum - 09-30-2008, 04:45 AM - Replies (2)

[eluser]dimis[/eluser]
I have a controller that call one after the other 2 model functions that make queries at database with a db->where clause.
It seems that at 2nd function exists the db->where of the previous function because the query failed with

Quote:Unknown column 'id' in 'where clause'
where id is at previous function.
How can I fix it?


  help with rewrite log
Posted by: El Forum - 09-30-2008, 03:56 AM - No Replies

[eluser]dexter21[/eluser]
Hi,i've configured my mod_rewrite with following values :


Code:
php_value session.use_trans_sid 0
RewriteCond $1 !^(index\.php|codeigniter|public|ficheros|imagenes|tmp|)
RewriteRule ^/(.*)$ /index.php/$1 [L]



the log looks like:
Code:
ipaddress - - [30/Sep/2008:09:59:43 +0200] [www.midominio.com/sid#82202c0][rid#830fa08/initial] (2) init rewrite engine with requested uri /
ipaddress - - [30/Sep/2008:09:59:43 +0200] [www.misdominio.com/sid#82202c0][rid#830fa08/initial] (2) rewrite '/' -> '/index.php/'
ipaddress - - [30/Sep/2008:09:59:43 +0200] [www.misdominio.com/sid#82202c0][rid#830fa08/initial] (2) local path result: /index.php/
ipaddress - - [30/Sep/2008:09:59:43 +0200] [www.misdominio.com/sid#82202c0][rid#830fa08/initial] (2) prefixed with document_root to /usr/clientes2/index.php/
ipaddress - - [30/Sep/2008:09:59:43 +0200] [www.misdominio.com/sid#82202c0][rid#830fa08/initial] (1) go-ahead with /usr/clientes2/index.php/ [OK]
ipaddress - - [30/Sep/2008:09:59:43 +0200] [www.misdominio.com/sid#82202c0][rid#8315a20/subreq] (2) init rewrite engine with requested uri /
ipaddress - - [30/Sep/2008:09:59:43 +0200] [www.misdominio.com/sid#82202c0][rid#8315a20/subreq] (2) rewrite '/' -> '/index.php/'
ipaddress - - [30/Sep/2008:09:59:43 +0200] [www.misdominio.com/sid#82202c0][rid#8315a20/subreq] (2) local path result: /index.php/
ipaddress - - [30/Sep/2008:09:59:43 +0200] [www.misdominio.com/sid#82202c0][rid#8315a20/subreq] (2) prefixed with document_root to /usr/clientes2/index.php/
ipaddress - - [30/Sep/2008:09:59:43 +0200] [www.misdominio.com/sid#82202c0][rid#8315a20/subreq] (1) go-ahead with /usr/clientes2/index.php/ [OK]
ipaddress - - [30/Sep/2008:09:59:43 +0200] [www.misdominio.com/sid#82202c0][rid#830fa08/initial] (2) init rewrite engine with requested uri /public/frontend/css/estilo.php
ipaddress - - [30/Sep/2008:09:59:43 +0200] [www.misdominio.com/sid#82202c0][rid#830fa08/initial] (1) pass through /public/frontend/css/estilo.php
ipaddress - - [30/Sep/2008:09:59:44 +0200] [www.misdominio.com/sid#82202c0][rid#8313a18/initial] (2) init rewrite engine with requested uri /index.php/destacados/cargar_producto/12
ipaddress - - [30/Sep/2008:09:59:44 +0200] [www.misdominio.com/sid#82202c0][rid#8313a18/initial] (1) pass through /index.php/destacados/cargar_producto/12
ipaddress - - [30/Sep/2008:09:59:44 +0200] [www.misdominio.com/sid#82202c0][rid#8315a20/subreq] (2) init rewrite engine with requested uri /destacados/cargar_producto/12
ipaddress - - [30/Sep/2008:09:59:44 +0200] [www.misdominio.com/sid#82202c0][rid#8315a20/subreq] (2) rewrite '/destacados/cargar_producto/12' -> '/index.php/destacados/cargar_producto/12'
ipaddress - - [30/Sep/2008:09:59:44 +0200] [www.misdominio.com/sid#82202c0][rid#8315a20/subreq] (2) local path result: /index.php/destacados/cargar_producto/12
ipaddress - - [30/Sep/2008:09:59:44 +0200] [www.misdominio.com/sid#82202c0][rid#8315a20/subreq] (2) prefixed with document_root to /usr/clientes2/index.php/destacados/cargar_producto/12
ipaddress - - [30/Sep/2008:09:59:44 +0200] [www.misdominio.com/sid#82202c0][rid#8315a20/subreq] (1) go-ahead with /usr/clientes2/index.php/destacados/cargar_producto/12 [OK]

i have changed ip and domain name to paste there.

Log file said that there arent errors,but rules doesnt go


when i type ip of my domain (http://ipaddress) it charge http://ipaddress/Zend/index.html , should i change this config url to http://ipaddress/

Any idea about it plz?


Many thanks


  Allow all filetypes for uploading
Posted by: El Forum - 09-30-2008, 03:51 AM - No Replies

[eluser]mvdg27[/eluser]
Hi,

Just wondering if there is a way to allow all filetypes to be uploaded, using CI's uploading class. I've been reading some topics on the forum on this subject already, but so far I haven't found a solution yet.

Thanks, Michiel


  NEWBIE on CI please for PHP IDE
Posted by: El Forum - 09-30-2008, 03:35 AM - Replies (20)

[eluser]itot[/eluser]
Dear friends


i'm newbie on CI there's any suggestion for editor that's free on windows for PHP IDE

best regards

ITOT


Welcome, Guest
You have to register before you can post on our site.

Username
  

Password
  





Latest Threads
VIRUS reported after Chro...
by InsiteFX
3 hours ago
Codeigniter4 version 4.5....
by kenjis
10 hours ago
SQL server connection not...
by kenjis
10 hours ago
Problem with session hand...
by kenjis
10 hours ago
Is it possible to go back...
by kenjis
11 hours ago
Cannot access protected p...
by xsPurX
Yesterday, 02:10 PM
Update to v4.5.1, same us...
by xsPurX
Yesterday, 08:31 AM
How to use Codeigniter wi...
by kenjis
Yesterday, 05:06 AM
CVE-2022-40834 SQL Inject...
by kenjis
Yesterday, 03:44 AM
Retaining search variable...
by pchriley
Yesterday, 03:15 AM

Forum Statistics
» Members: 85,430
» Latest member: bugraptors
» Forum threads: 77,581
» Forum posts: 376,008

Full Statistics

Search Forums

(Advanced Search)


Theme © iAndrew 2016 - Forum software by © MyBB