ruletka Posted January 28, 2011 Share Posted January 28, 2011 I am pretty sure I defined these, by making it something like $blah="blah" and `blah` = ' {$blah}' So why am I getting these errors = Notice: Use of undefined constant petid - assumed 'petid' in /home/vhosts/foggyjungle.6te.net/viewpet_forum.php on line 38 Notice: Use of undefined constant adopter - assumed 'adopter' in /home/vhosts/foggyjungle.6te.net/viewpet_forum.php on line 41 Notice: Undefined variable: fulldate in /home/vhosts/foggyjungle.6te.net/viewpet_forum.php on line 44 Fatal error: Call to undefined function showpet_forum() in /home/vhosts/foggyjungle.6te.net/viewpet_forum.php on line 45 $time = mysql_query("SELECT * FROM `pets_adopted`"); $date = mysql_fetch_array($time); $fulldate = "$date[fulldate]"; $halfdate = "$date[halfdate]"; function check(){ $pid = mysql_real_escape_string($_GET['id']); $result = mysql_query("SELECT * FROM `pets_adopted` WHERE `id` = '{$pid}'"); while($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $results = mysql_query("SELECT * FROM `pets_list` WHERE `id` = '{$row[petid]}'"); $pet = mysql_fetch_array($results); $results2 = mysql_query("SELECT * FROM `users` WHERE `id` = '{$row[adopter]}'"); $usercc = mysql_fetch_array($results2); There's the snippet. Thank you for any help. I am just really lost. Quote Link to comment https://forums.phpfreaks.com/topic/225918-undefined-constant-and-undefined-variable/ Share on other sites More sharing options...
DavidAM Posted January 28, 2011 Share Posted January 28, 2011 You need quotes around the array element names. Otherwise, PHP thinks they are constants (which have not been defined). $results = mysql_query("SELECT * FROM `pets_list` WHERE `id` = '{$row['petid']}'"); $results2 = mysql_query("SELECT * FROM `users` WHERE `id` = '{$row['adopter']}'"); Quote Link to comment https://forums.phpfreaks.com/topic/225918-undefined-constant-and-undefined-variable/#findComment-1166396 Share on other sites More sharing options...
ruletka Posted January 28, 2011 Author Share Posted January 28, 2011 Thank you for your help :3 That worked Quote Link to comment https://forums.phpfreaks.com/topic/225918-undefined-constant-and-undefined-variable/#findComment-1166443 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.