Post Reply 
MySQL/PHP Code Problem...
Author Message
S7*
Sweet Dreams

Posts: 16,689.4373
Threads: 1,056
Joined: 3rd Apr 2007
Reputation: 14.29926
E-Pigs: 383.2309
Offline
Post: #1
MySQL/PHP Code Problem...
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....

30/09/2009 08:37 AM
Find all posts by this user Quote this message in a reply
PSPkiller
*The Sweaty Indian/Welsh Guy*

Posts: 2,393.2167
Threads: 251
Joined: 24th Jun 2007
Reputation: 0.56947
E-Pigs: 53.7911
Offline
Post: #2
RE: MySQL/PHP Code Problem...
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...

[Insert Signature Here]
30/09/2009 03:17 PM
Find all posts by this user Quote this message in a reply
ZiNgA BuRgA
Smart Alternative

Posts: 17,022.2988
Threads: 1,174
Joined: 19th Jan 2007
Reputation: -1.71391
E-Pigs: 446.1294
Offline
Post: #3
RE: MySQL/PHP Code Problem...
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?
30/09/2009 10:12 PM
Visit this user's website Find all posts by this user Quote this message in a reply
S7*
Sweet Dreams

Posts: 16,689.4373
Threads: 1,056
Joined: 3rd Apr 2007
Reputation: 14.29926
E-Pigs: 383.2309
Offline
Post: #4
RE: MySQL/PHP Code Problem...
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?
01/10/2009 06:49 AM
Find all posts by this user Quote this message in a reply
ZiNgA BuRgA
Smart Alternative

Posts: 17,022.2988
Threads: 1,174
Joined: 19th Jan 2007
Reputation: -1.71391
E-Pigs: 446.1294
Offline
Post: #5
RE: MySQL/PHP Code Problem...
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.
02/10/2009 12:05 AM
Visit this user's website Find all posts by this user Quote this message in a reply
S7*
Sweet Dreams

Posts: 16,689.4373
Threads: 1,056
Joined: 3rd Apr 2007
Reputation: 14.29926
E-Pigs: 383.2309
Offline
Post: #6
RE: MySQL/PHP Code Problem...
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.
02/10/2009 05:31 AM
Find all posts by this user Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)

 Quick Theme: