473,403 Members | 2,071 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

Undefined index: learner_id

I have made this codes that registers the students using their learner id. And of course i wanted to make sure that there will be no duplication of learner id as students registered.These are my codes.
Expand|Select|Wrap|Line Numbers
  1.     /*
  2.         This block is used to check whether the student_id already exists in database. 
  3.     */
  4.     $select_query="select student_id from student_information where learner_id = '$learner_id'";
  5.     $result_set = mysql_query($select_query,$link_id);
  6.  
  7.     if($row = mysql_fetch_array($result_set)){
  8.         $flag="exists";
  9.         header("location:Student_login.php?flag=$flag&student_id=$student_id");
  10.         die();
  11.     }
  12.     else{
  13.         /*
  14.             This block is used to insert the learners record in database 
  15.             if the student_id is not yet registered in the database. 
  16.         */
  17.         mysql_query("SET AUTOCOMMIT = 0 ");
  18.         if(mysql_error() != null){
  19.             die(mysql_error());
  20.         }    
  21.  
Everytime there is a duplication of learner id by using this code on the other page.
Expand|Select|Wrap|Line Numbers
  1. >This Learner Id( <?php $_GET['learner_id'] ?> ) already exists. Please try again with another Learner Id.</td>
  2.  
The log in page give me notice

This Learner Id(
Notice: Undefined index: learner_id in C:\xampp\htdocs\a\Student_login.php on line 61
) already exists. Please try again with another Learner Id.

How do i fix this one. Please advise.
Jul 15 '14 #1
5 1471
Please check your table's learner_id collumn is set as unique or primary key then you have to set as not null.
Jul 15 '14 #2
@Bharat383

Yes already did.
Jul 16 '14 #3
would you put here your table structure.
Jul 29 '14 #4
Rabbit
12,516 Expert Mod 8TB
Actually, the error is saying that your $_GET array does not have anything called learner_id.
Jul 29 '14 #5
omerbutt
638 512MB
the page where you are trrying to show the message the expression
Expand|Select|Wrap|Line Numbers
  1. <?php $_GET['learner_id']?>
  2.  
the page cannot detect any set index named learner_id in the $_GET array , verify that when you land or access that page are you sending the learner_id via GET, either you are using form , or using the query string please show the complete code.
regards,
Omer Aslam
Aug 12 '14 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: lawrence | last post by:
I just switched error_reporting to ALL so I could debug my site. I got a huge page full of errors. One of the most common was that in my arrays I'm using undefined offsets and indexes. These still...
5
by: news.bigpond.com | last post by:
getting errors Notice: Undefined index: name in F:\uni\Software engineering\assignment4\guestbook.php on line 6 the variable $name is declared as $name = _POST; What could be causing this?...
4
by: John Oliver | last post by:
PHP Notice: Undefined index: name in /home/www/reformcagunlaws.com/new.php on line 6 PHP Notice: Undefined index: address in /home/www/reformcagunlaws.com/new.php on line 7 PHP Notice: ...
3
cassbiz
by: cassbiz | last post by:
Here are the errors that are coming up in my error_log Notice: Undefined index: andatum in /zipcode.php on line 11 Notice: Undefined index: andatum in /zipcode.php on line 12 Notice: Undefined...
3
by: number1yan | last post by:
Can anyone help me, i am creating a website and am using a php script that recomends the website to other people. I keep getting the same error and can not work out why. The error is: Notice:...
15
by: bill | last post by:
I am trying to write clean code but keep having trouble deciding when to quote an array index and when not to. sometimes when I quote an array index inside of double quotes I get an error about...
5
by: siyaverma | last post by:
Hi, I am new to php, i was doing some small chnages in a project developed by my collegue who left the job and i got the responsibility for that, After doing some changes when i run it on my...
3
by: sickboy | last post by:
$channels=$_GET; if (empty($channels)) { $channels='blank'; } changechannels($channels); $theatre=$_GET; if (empty($theatre)) { $theatre='splash'; } changetheatre($theatre); $info=$_GET; if...
3
by: razvanel442 | last post by:
Hi all i am new here! I take a look on forum but i don't found a the answer for my problem ok this is my problem: Line47:$user = $_GET; Line48:$pass = $_GET; Line49:$char = $_GET;
3
by: mediator | last post by:
Hello I have a php contact email form on my a ecommerce shop website ! I am getting a Undefined index error messages coming from the top of the php code, the email form its self works fine, ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.