Welcome Guest, Not a member yet? Register   Sign In
Redirect with "pretty" urls after form submit
#2

[eluser]Chris Newton[/eluser]
The query you're pulling is an resource object, not a single piece of data. You need something like this;

$temp=$query->row();
$temp2=$temp->columnname;

OR

$temp=$query->first_row('array');
if you have a column named featured, you could access it;

$temp['featured']

Review the docs on generating query results.
http://ellislab.com/codeigniter/user-gui...sults.html


Also, if you're going to be doing a lot of this stuff... you might want to research using models for pulling out data, as well as active record. That way you don't have to write the same, or a similar query over and over and over.... you can just pull right from the model if it's loaded.

And on a style note, I personally avoid numbered segment variables like the plague. I prefer associative URI string name/value pairs.... helps me keep things straight in my head, and makes it easier to add / change orders of things in the URI string later if you find you have more or different data to pass. I do this so often, I created a simple uri helper that gets and sets URI data. It's nice for things like this... if (get_uri('title'){ do this }
http://codeigniter.com/wiki/URI_helper/


Messages In This Thread
Redirect with "pretty" urls after form submit - by El Forum - 02-13-2008, 12:41 PM
Redirect with "pretty" urls after form submit - by El Forum - 02-13-2008, 09:41 PM



Theme © iAndrew 2016 - Forum software by © MyBB