codeigniter

Invoking a URL and retrieving the rendered HTML page in Phing

Hi all, So this is my dilemma - I am using the excellent codeigniter-simpletest library by Eric Barnes (http://github.com/ericbarnes/codeigniter-simpletest). Its perfect for my purposes, as it adds an endpoint onto the test deployment of my CodeIgniter application, from which I have a dashboard to run all my unit tests and view the resu...

Insert in to database using codeigniter

HI i want to insert data using form in CI but i am facing the problem Here is my model code function add_form() { $this->load->database(); $id = $this->input->post('id'); $name = $this->input->post('name'); $age = $this->input->post('age'); $data = array( 'name' => $this->in...

Subquery with Flexigrid using CodeIgniter

Hello, I am using CodeIgniter for this project and have chosen to use FlexiGrid for displaying data driven tables in the site's admin tool. The requirement of the project is to display count's and date's related to a record in a query. The only way I know how to do this is to use a sub-query. All of the data is displaying as intended....

Load view passing two arrays

Hi! I have two dropdownlist in one view but i don't know if i can load the view passing the two arrays like this: $this->load->view('primerPaso',$data,$data2); To be more specific i'm doing everything like this: Model /* * Método encargado de consultar las ciudades * donde existen agencias. */ function ConsultarCiudadesAgencias()...

Populate a second DropDownList based on a selected value fron other DropDownList

Hi! I’m trying to link two dropdownlist depending on the value you select from the first dropdownlist. I don’t have any idea how to do this, so if you guys can point me in the right direction that would be great. What I want to do is select a value from the first dropdownlist and depending on its value show some options in the second dr...

How do you use autocomplete for thousands of entries?

Is there a way to setup autocomplete in PHP/jQuery that can quickly run through thousands of rows in a database? I have a job board where the user enters his/her college - and I want to offer autocomplete. Problem is, there are 4,500 colleges in the united states and a seems like an awful solution. Is there a good way to both make th...

Codeigniter: watermarking images and saving the result in database

Hello all, I am trying to upload an image, put another image over it (like watermark) and save the result in the database, all using Codeigniters image_lib class. Here's the code: if ($_FILES['userfile']['error'] == 0 && $_FILES['userfile']['size'] > 0) { $uploaddir = "media/"; $fileName = $_FILES['userfile']['name']; ...

Codeigniter - How to reveal info after is password entered via ajax

Hi, I am working on a codeigniter site, the client has requested that the price columns in a datatable are hidden from view unless a user enters a correct password(which they will give out to clients over the phone). The obvious way is to make the user login which then reveals a new table/page with prices included. Can I achieve this...

Codeigniter - passing multiple data arrays to a view?

Hi, I am trying to populate a dropdown menu on an events page with a list of locations. What I wish to do is retrieve all names from a locations table, store them in an array in my event.php controller, pass this to a view which then lists all the locations in a dropdown menu. Here is the loop in my controller which retrieves the loca...

PayPal discount can't make it work

Hi, I'm trying to setup a discount for a the whole cart using PayPal + Codeigniter, I got this working withouth the discounts. As far as I've read the only thing that I would need to do is set a hidden field discount_amount_cart as I saw here Here is my form: <form method="post" action="https://www.sandbox.paypal.com/cgi-bin/websc...

Getting data from post array in CodeIgniter

Ok, so I have a form that is sending me arrays in the POST array. I am trying to read it like so: $day = $this->input->post("days")[0]; This does not work. PHP says "unexpected '['". Why does this not work? I fixed it by doing it this way: $days = $this->input->post("days"); $day = $days[0]; I fixed my problem, I'm just curious...

CodeIgniter user profile controller.

Why isn't this working? I'm trying to make a php user profile URL. <?php class Users extends Controller { function Users() { parent::Controller(); } function index($id == null) { if($id == null) { redirect('/', 'refresh'); } else { $data['title'] = 'User Page'; $data['result'] = $this...

How do I pull information from URL in PHP?

Lets say the url is http://example.com/product/3 and I only want to retrieve what is after http://example.com/product/. I found this, it echos the domain but how do I get the three. Its this method reliable? I'm using codeIgniter also. <?php function curPageURL() { $pageURL = 'http'; $pageURL .= "://"; if ($_SERVER["SERVER_PORT"] != "80...

Codeigniter: when to use a model vs library?

I've starting using Codeigniter for a project recently (few months ago) but its getting a little out of hand with a bunch of models that need to interact with each other and I was wondering if I should be creating a library instead? In my case, I have a user action that happens when you win a game and it would get logged in my user_mod...

Codeigniter: multiple Active Record calls vs lumping together and breaking models

If I have an event/function that requires changing a lot of different variables in my Active Record, should I directly access them and change them all at once from my library or have the library do multiple model calls? The data I want to change is spread over a handful of different mysql tables but some are within the same table. I'm...

Parsing input to see whether it's an address, zip code, city or state?

I have a job board where a user submits his location, via Google-Maps API, which plots the job on a map. The problem is, because it is a location based job board, I want to make the most broad input allowable a ZIP code (so users can either enter a ZIP code or address). Is there anyway to either parse the input to determine whether it'...

Instead of joining tables, merging objects: Is this bad practice?

Is this bad practice and should I be shot for coming up with this code? function get_business_addresses($business_id) { $query = $this->db->get_where('contact_business_addr_rel', array('business_id'=> $business_id)); if ($query->num_rows() > 0) { foreach ($query->result() as $row) { $address_id = $row->addr...

htaccess 301 redirect not working

I'm trying to add a simple 301 rule to the .htaccess file of a codeigniter site. redirect 301 /newsletter http://sub.domain.com/newsletters/may2010 When I visit http://sub.domain.com/newsletter the redirect goes to http://sub.domain.com/newsletters/may2010/?/newsletter I'm not sure where the ?/newsletter is coming from. Full .hta...

Codeigniter - multiple file upload ->insert into db - having problems!

Hi, I am using Codeigniter and I am trying to upload multiple files into a database. The files are seperate fields not multiple files for one field. I followed this post -http://codeigniter.com/forums/viewthread/110130/P0/ I almost have it working but I am having some trouble with adding the uploaded data into my db. Here is my Contr...

jquery ajax codeigniter

Hi, I wanted to ask, why does the response from a ajax request using the native ajax not post or get return my entire page? is there anything I should know? I have looked at the documentation on jquery.com and nothing is mentioned of something like that unless i'm looking else where. Can I get any help on why that keeps happening? This...