Jump to content

[Ask] [CodeIgniter] [Ion_Auth] uri segment


Recommended Posts

Hi again all.

I have an annoying bug and cant seem to solve it for past 5 days.

So, here I am, asking all of you for a help  ;)


I want to fetch 3rd uri segment and use it as username then show his/her profile from.

In my controller, I do this

$usercheck = str_replace($this->data['revsearch'], $this->data['revreplace'], $this->uri->segment(3));
$this->data['usercheck'] = str_replace($this->data['revsearch'], $this->data['revreplace'], $this->uri->segment(3));

$sql = "select email from users where username = $usercheck ;";
$email = mysql_query($sql);
$this->data['email'] = mysql_query($sql);
$user = $this->ion_auth->get_user_by_email($email);


note : I make $email for production purpose (real code) and make $this->data['email'] for debug purpose


This is my view code

<div id="myprofile">
<h2>Personal Information</h2>
<p><?php echo $usercheck ?></p>
<p><?php echo $email ?></p>
<p>Name : <?php echo $user->first_name; ?> <?php echo $user->last_name; ?></p>
<p>Email : <?php echo $user->email; ?></p>

</div><!-- myprofile end -->
<div id="push"></div>
</div><!-- wrapper end -->


And it return this

Personal Information


Name : Ndaru Aji

Email : orasionseis@gmail.com


As you can see, $usercheck return my 3rd URI segment but my $email did not return any result, so the next commands return the result that I did not want.

Can you give me a hint to solve this ?

:confused: :confused:


thanks in advance


Link to post
Share on other sites
  • 1 month later...


This topic is now archived and is closed to further replies.

  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.