473,503 Members | 1,952 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Undefined index: learner_id

20 New Member
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 1475
Bharat383
93 New Member
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
hanspeare
20 New Member
@Bharat383

Yes already did.
Jul 16 '14 #3
Bharat383
93 New Member
would you put here your table structure.
Jul 29 '14 #4
Rabbit
12,516 Recognized Expert Moderator MVP
Actually, the error is saying that your $_GET array does not have anything called learner_id.
Jul 29 '14 #5
omerbutt
638 Contributor
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
108819
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
10865
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
7173
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
4955
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
5483
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
4447
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
7167
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
3846
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
5975
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
2013
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
7205
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
7093
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7287
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,...
1
7006
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7467
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...
1
5021
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4685
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3175
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3166
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.