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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.