Welcome Guest, Not a member yet? Register   Sign In
  Servers running PHP 4.1.2 - Options for adapting CodeIgniter to run?
Posted by: El Forum - 10-22-2007, 12:32 PM - No Replies

[eluser]charlieD[/eluser]
I've developed a site and it turns out that for some reason the servers that it will run on are using the ancient PHP 4.1.2. As you may know CodeIgniter requires 4.3.

I don't think upgrading is an option, so I'm now facing removing CodeIgniter and adapting the code in a very short amount of time.

Does anyone have any other suggestion? For example, is there anything that can be done to adapt CodeIgniter to run on this version? At the moment the fatal exception 'undefined function ob_end_flush' is being returned, but there may be other problems after that.

If not, any suggestions on what would be the quickest way of adapting this to run on its own?

I'm using the sessions, validation and database classes, and obviously models, views and controllers...

Any help ASAP greatly appreciated!


  Validation
Posted by: El Forum - 10-22-2007, 12:04 PM - Replies (5)

[eluser]jasonswett[/eluser]
I've gone through most of the CodeIgniter Form Validation User Guide Page and it worked just fine. But what if you're dealing not with a sign-up form but a form meant to update values in a database?

Here's what the XHTML for one of my fields would look like:

Code:
<tr>
  <th>First Name</th>
  <td>&lt;input type="text" size="40" name="first_name" id="first_name" value="&lt;?= $contact-&gt;first_name ?&gt;" /></td>
</tr>

And here's what the CodeIgniter example uses:
Code:
<h5>Username</h5>
&lt;input type="text" name="username" value="&lt;?=$this-&gt;validation->username;?&gt;" size="50" />

Using "$this->validation->whatever" is fine for when the user submits an incomplete form, then gets redirected back to the same form, but it wouldn't be useful on the initial page load.

Is there a reasonable solution to this problem? It seems like a pretty common need and I'm surprised I haven't been able to find the answer yet.

Thanks,
Jason


  XML-RPC Issue/Bug
Posted by: El Forum - 10-22-2007, 10:26 AM - Replies (17)

[eluser]Unknown[/eluser]
This is in continuation to this thread:
http://ellislab.com/forums/viewthread/53105/

I'm bringing this up in a new thread since the old one seems inactive and the workaround posted there doesn't work for me either.

The issue is that the code on the documentation page located here:
http://ellislab.com/codeigniter/user-gui...mlrpc.html
- doesn't work. If I call the client code I get this:
"Did not receive a '200 OK' response from remote server."
If I call the server page directly I get this:
faultcode 105
XML error: Invalid document end at line 1

Since the PHP issue ( http://bugs.php.net/bug.php?id=41293 ) is fixed in 5.2.2 and I'm running PHP 5.2.4 I'm assuming this an issue with the CodeIgniter source code?

Thanks,

Mark H.


  Active Record gotcha
Posted by: El Forum - 10-22-2007, 09:13 AM - No Replies

[eluser]Michael Ekoka[/eluser]
in the following code I want to update the password field in one record :

Code:
$form_data = $this->input->post('form_data');

// I get my input from a form
$user_id = $form_data['user_id'];
$password = md5($form_data['password']);

$this->db->where('id',$id);
// notice the mistake I just made: instead of $user_id, I used $id that has not yet been
// initialized or declared.

$this->db->update('users',array('password'=>$password));

What I will end up doing here is update the password field of all records in the table. So, fellow CodeIgniters beware when making update and delete operations like these.


  Code Igniter Session problem
Posted by: El Forum - 10-22-2007, 08:29 AM - Replies (41)

[eluser]Unknown[/eluser]
Hello

i've tried to use code igniter session library and used ci_session table for added security. so far it was working perfectly in my local machine both IE and firefox. but as soon i have uploaded that in to my client server (php 5) ; i saw that the site is running in Mozilla firefox perfectly but
if i run the site in Internet Explorer(IE), then the site couldnt save the session data.

what is the problem any suggessions?


  Selecting one value from database?
Posted by: El Forum - 10-22-2007, 08:06 AM - Replies (6)

[eluser]fancms[/eluser]
I need to select one value from one row in the database. With the database class I used previously before finding CI I could accomplish this by doing

Code:
$variable = $db->get_var("SELECT somevalue FROM sometable WHERE something='therowvalue'");

This would allow me to use $variable as-is throughout my code.

I've been trying to figure out how to do this (select one value from a table) in CI. Right now I have

Code:
$this->db->select('value'); #Because I need the value
$this->db->where('variable', 'siteoverview'); #Because I need the variable column entitled siteoverview
$grab_cache = $this->db->get("settings"); #From the settings table

This produces
Code:
CI_DB_mysql_result Object
(
    [conn_id] => Resource id #27
    [result_id] => Resource id #31
    [result_array] => Array
        (
        )

    [result_object] => Array
        (
        )

    [current_row] => 0
    [num_rows] => 1
)

I'm a bit lost here. I haven't been able to find my answer in the docs, the forums, or the wiki. I know this is a basic question (and I'll likely feel pretty dumb when I find/get the answer) but I'm hoping someone will be kind enough to clarify a bit.

Thanks! Smile


  INSERT problem -> unknown column... [SOLVED]
Posted by: El Forum - 10-22-2007, 07:02 AM - Replies (1)

[eluser]victor76[/eluser]
Hi,

I got his blog post form in my View dir:

Code:
&lt;form name="postit" action="http://localhost/codeIgniter/index.php/blog_controller/dopost" method="post"&gt;
    title: &lt;input type="text" name="title" id="title" /&gt;<br />
    comment: &lt;input type="text" name="comment" id="comment" /&gt;<br />
    &lt;input type="submit" value="send" /&gt;
&lt;/form&gt;

In my Controller I have:
Code:
function doPost()
        {
            $this->load->model('Blogmodel','',TRUE);
            
            $data['query'] = $this->Blogmodel->insert_entry();
            
        }

..And in my Model:
Code:
function insert_entry()
    {

    $this->title   = $_POST['title'];
        $this->content = $_POST['comment'];
        $this->date    = time();

        $this->db->insert('entries', $this);

    }

When I post my form, I get the error:
Quote:Error Number: 1054

Unknown column '_parent_name' in 'field list'

INSERT INTO entries (title, content, date, _parent_name, _ci_scaffolding, _ci_scaff_table) VALUES ('aaa', 'bla', 1193057963, 'Blogmodel', 0, 0)

...so, as a Newbie I can see i miss some columns in my DB (_parent_name, etc), but how can I fix my code so that it just inserts 'title','comment' and 'date'?

Best regards,
Vic


======================

I found it allready:
perhaps usefull for others...

Code:
function insert_entry()
    {
    $title   = $_POST['title'];
        $comment = $_POST['comment'];
    $aData = array('title' => $title, 'content' => $comment);
    $this->db->insert('entries', $aData);

    }

Is this the best way to insert data from a form, or is there a better way?
Best regards,

Vic


  CodeIgniter and PayPal IPN
Posted by: El Forum - 10-22-2007, 06:52 AM - Replies (6)

[eluser]Jatinder Thind[/eluser]
Hello,

I implemented a CI based E-Commerce site some months back. It uses PayPal for payment processing. I also setup a IPN (Instant Payment Notification) script for managing sales orders.

Although the IPN script works fine most of the time, it sometimes marks some of the IPN posts as invalid.

After a lot of research, I figured out that maybe the CI's Input library was modifying the POST variables so as to make them unusable for PayPal IPN.

Anyone else faced the same problem? Is there someway to skip Input library modifications during runtime?

Thanks,
Jatinder Thind


  404 Object Not Found
Posted by: El Forum - 10-22-2007, 06:36 AM - Replies (1)

[eluser]mikhailt[/eluser]
I get an error "404 Object Not Found"
in http://localhost/codeigniter/index.php/welcome

I have configured
$config['uri_protocol'] = "PATH_INFO";
and tried all the other combinations AUTO,QUERY_STRING etc.
Tried $config['index_page'] = "index.php?"; with ? or without '?' too
Default route is not configured.

If I try just http://localhost/codeigniter/index.php [no welcome here]
then got error "Unable to determine what should be displayed" as it should be.

If the default route is configured the start page is loaded. But further segmented URLs do not work. http://localhost/codeigniter/index.php/w.../my_method
I get an error "404 Object Not Found" Sad

I use the last CI 1.5.4 and IIS5.1 (Win XP) with proxy. But proxy is disabled in browser for localhost.

Can somebody help my?


  [resolved]Function in controller
Posted by: El Forum - 10-22-2007, 06:25 AM - Replies (9)

[eluser]isabelle[/eluser]
Hy everybody,

On my way to learn code igniter and the mvc coding, i have my really first problem.

I don't paste the model, but this one gets the datas of a website.
In that datas there are the tags, the keywords in fact. (example: http://leweb2.be/Mandellia.html)
These ones are separated by commas and i need to explode them via a function made for that.
I tried to define it in the controller but when i call that function in the view, i have that error:

Code:
Fatal error: Call to undefined function explode_term() in C:\wamp\www\eclipse\annuaire\system\application\views\fiche_view.php on line 56

Is that the moment when i need to create my own libraries?

Thanks in advance for your help,

CONTROLLER

Code:
class Fiche extends Controller{
        function fiche(){
            parent::Controller();
            $this->load->helper('url', 'database');
        }
        function index(){
            $id_website=$this->uri->segment(3);
            
            $this->load->model('fiche_model');
            $data['query']=$this->fiche_model->get_fiche($id_website);
            
            $this->load->view('fiche_view', $data);
        }
        
        function explode_term($terms){
            $list = explode(",", $terms);
            echo count($list);
        }    
    }

VIEW
Code:
&lt;?php
        foreach($query->result() as $row):
            echo '<h1>'.$row->app_name.'</h1>';
            echo '<p><span class="pink">Description :'.$row->app_short_description.'</span><br /><br />';
            echo '<span class="pink">Url :</span> <a href="'.$row->app_url.'" title="'.$row->app_short_description.'">'.$row->app_url.'</a><br /><br />';
            echo '<span class="pink">Description :</span><small>'.$row->app_description.'</small></p><br />';
            echo '<small><span class="pink">Mots-clĂ© :</span><a href="" title="">'.explode_term($row->tags);'</a> |</small></div>';
        endforeach;
    ?&gt;


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

Username
  

Password
  





Latest Threads
Changing Session cookie -...
by paulbalandan
33 minutes ago
hot-reload side effects s...
by PaulC
5 hours ago
using app/Config/App.php ...
by sam547
Yesterday, 03:04 PM
Setting baseURL in Regist...
by grimpirate
05-15-2025, 02:20 PM
CRUD Code Generator
by DeanE10
05-15-2025, 05:31 AM
CodeIgniter.com - Report ...
by Harry Lyre
05-14-2025, 04:26 AM
Missing closing bracket w...
by abf
05-13-2025, 07:27 PM
Update from 4.6.0 to 4.6....
by FlavioSuar
05-13-2025, 04:17 AM
Sessions old files are de...
by InsiteFX
05-12-2025, 10:30 PM
Ajax post failing with Ty...
by PaulC
05-12-2025, 12:23 AM

Forum Statistics
» Members: 146,541
» Latest member: pavestepcom9
» Forum threads: 78,392
» Forum posts: 379,464

Full Statistics

Search Forums

(Advanced Search)


Theme © iAndrew 2016 - Forum software by © MyBB