Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6330857
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T17:56:48+00:00 2026-05-24T17:56:48+00:00

I have a page called list.php which retrieves from database and shows all the

  • 0

I have a page called list.php which retrieves from database and shows all the student names with their respective ids in a list. In raw php, this is how I have done this-

include("connect.php");
$query = "SELECT * FROM marks ";
$result = mysql_query($query);
$num = mysql_num_rows ($result);
mysql_close();

if ($num > 0 ) {
$i=0;
while ($i < $num) {
$studentname = mysql_result($result,$i,"studentname");
$studentid = mysql_result($result,$i,"studentid");  
?>
And then---

<a href="studentprofile.php?studentid=<? echo $studentid?>"><? echo $studentname ?></a>
<?
++$i; } } else { echo "No Record Found"; }

?>

When a user clicks on any of the student names, it takes the user to the page of that particular student and in that page I have a code like following-

include("connect.php");
$number = $_GET['studentid'];

$qP = "SELECT * FROM student WHERE studentid = '$number' ";
$rsP = mysql_query($qP);
$row = mysql_fetch_array($rsP);
extract($row);
$studentid = trim($studentid);
$studentname = trim($studentname);
$studentgender = trim($studentgender);

The above code is working just fine. Now as far as I know $_get is disable in Codeigniter. But how to do the exact same thing that I mentioned above in codeigniter if $_get is disabled ? I went through some tutorials on alternative way of using $_get, but I didn’t understand those well. Would you please kindly help? Thanks in Advance 🙂

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T17:56:49+00:00Added an answer on May 24, 2026 at 5:56 pm

    The usage of $_GET is discouraged in CI.

    The simpliest way to rewrite that files is not using $_GET. Just add method='post' to your forms and tell your ajax requests to use post, if you have any. Use $_POST in PHP instead of $_GET.

    If you are absolutely sure you need get requests passing parameters, you have to enable query strings. You can do it in your CI’s config file:

    $config['enable_query_strings'] = TRUE;
    

    See section ‘Enabling query strings’ for details. But enabling query strings will cause Url helper and other helpers that generate URLs to malfunction.

    So my suggestion is to use POST requests.

    UPDATE Replace

    <a href="studentprofile.php?studentid=<? echo $studentid?>"><? echo $studentname ?></a>
    

    With

    <a href="studentprofile.php?studentid=<? echo site_url("yourcontroller/studentprofile/$studentid")?>"><? echo $studentname ?></a>
    

    Create method studentprofile:

    <?php
    class Yourcontroller extends CI_Controller {
    
    public function studentprofile($id)
    {
            include("connect.php");
            $number = $id;
    
            $qP = "SELECT * FROM student WHERE studentid = '$number' ";
            $rsP = mysql_query($qP);
            $row = mysql_fetch_array($rsP);
            extract($row);
            $studentid = trim($studentid);
            $studentname = trim($studentname);
            $studentgender = trim($studentgender);
            // and so on...
    }
    }
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a page called send.email.php which sends an email - pretty simple stuff
I have a page called send.email.php which sends an email - pretty simple stuff
Basically, I have populated a dropdown list using php from a database on a
Learning php! I have a sql database which contains a table called 'images' which
I have a page called Error.php. Variables are usually passed to it using the
Let's say I have a page called display.php and the user is viewing display.php?page=3
My project is about a school admin I have a page called : createClass.php,
I have a page index.php where i have a link called add_users.php. In add_users.php,
Suppose I have a page called view.php, if I give an argument like view.php?q=fruit,
I have a page called ..hi i get this error when visiting the page.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.