Jump to content

Undefined Constant.. and Undefined Variable :?


ruletka

Recommended Posts

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.

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']}'");

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.