/    Sign up×
Community /Pin to ProfileBookmark

[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’];[/CODE]

to post a comment
PHP

4 Comments(s)

Copy linkTweet thisAlerts:
@ellisglAug 16.2007 — $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)
Copy linkTweet thisAlerts:
@waylon999Aug 16.2007 — try removing the single quotes around family_id in the select statement, and using mysql_fetch_assoc($result)
Copy linkTweet thisAlerts:
@dz_boyauthorAug 16.2007 — removing the quotes did it. I didn't realize that made any difference, but thanks!
Copy linkTweet thisAlerts:
@ellisglAug 16.2007 — Hmm.. Oh fricken magic quotes...
×

Success!

Help @dz_boy spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...