Endless Paradigm

Full Version: MySQL/PHP Code Problem...
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
This is frustrating me terribly.

I'm testing a contact form that rely's on checking if the user has selected a specific setting in a setting selection menu of the site, and if its the a setting in particular, send to a specific email address... and to do this the form uses this code:

Code:
if($row_Recordset_cc['cc_cc'] == "setting_1") { // if setting_1 
	$sendto = $sendto . 'anemail@address.com';
}


but using that output the following on the site:

Code:
Notice: Undefined variable: row_Recordset_cc in /PATH/iframe_contact_form_send.php on line 22


Line 22 being the code above... but what makes no sense is that the "setting_1" variable is there [in the relevent MySQL DB & Table]... and is used just fine in other parts of the site, using the very same "if" statement on row "cc_cc".

I would say I'm working with a site that just moved from another server, and it didn't experience the problem there (apparently).

I'm really pulling my hair out with this one....

Using the same versions of PHP and MySQL?

Hell, what do I know... It took me 5 attempts to get Jinzora2 to a usable state... It still has problems...
The error pretty much states the problem - PHP doesn't know what the hell "$row_Recordset_cc" is (I don't either :P).
Where's the code for reading in MySQL data?
ZiNgA BuRgA Wrote:The error pretty much states the problem - PHP doesn't know what the hell "$row_Recordset_cc" is (I don't either :P).
Where's the code for reading in MySQL data?

the site works by including an inc_main.php that loads another PHP with the MySQL Connection details.

The confusing thing is though Zinga is that the same type of code (lookup through row_Recordset_cc) works elsewhere on the site.

know of an alternative code?
The other part of the site probably has that variable defined, whereas in this part of the site, it isn't, thus PHP throws the error.
You'll probably need to go through the code in the other part of the site to see how it assigns $row_Recordset_cc and probably copy that over.  I can't say more without knowing the code.
ZiNgA BuRgA Wrote:The other part of the site probably has that variable defined, whereas in this part of the site, it isn't, thus PHP throws the error.
You'll probably need to go through the code in the other part of the site to see how it assigns $row_Recordset_cc and probably copy that over.  I can't say more without knowing the code.

Exactly right.

For some reason the file with the variable was called AFTER the point where it was needed. O_o

Fixed now, thanks Zinga.
Reference URL's