www.webdeveloper.com
Results 1 to 5 of 5

Thread: [RESOLVED] error: undefined index?

  1. #1
    Join Date
    Jan 2005
    Posts
    216

    resolved [RESOLVED] error: undefined index?

    I get an undefined index on 'family_id' in this last line of this code. Any ideas as to why?

    Code:
    $sql3 = 'SELECT `family_id` FROM `Family` WHERE `family_name` = \''. $_POST['family_name'] .'\' and `f_pass` = \''. $f_pass .'\' LIMIT 1';
    $result = @mysql_query($sql3);
    $row = mysql_fetch_row($result);
    $fam_id = $row['family_id'];

  2. #2
    Join Date
    Jul 2007
    Posts
    357
    $result = mysql_query($sql3) or die(mysql_error());

    See what you get.


    Also mysql_real_escape_string($_POST['family_name']) or mysql_escape_string (if you are using an older version of php)

  3. #3
    Join Date
    Aug 2007
    Posts
    3
    try removing the single quotes around family_id in the select statement, and using mysql_fetch_assoc($result)

  4. #4
    Join Date
    Jan 2005
    Posts
    216
    removing the quotes did it. I didn't realize that made any difference, but thanks!

  5. #5
    Join Date
    Jul 2007
    Posts
    357
    Hmm.. Oh fricken magic quotes...
    Last edited by ellisgl; 08-16-2007 at 04:59 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles