CodeCharge Studio
search Register Login  

Visual Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> PHP

 variable problem ??

Print topic Send  topic

Author Message
knackje

Posts: 30
Posted: 02/06/2008, 1:35 PM

What's wrong with the code below. No record is beeing inserted and also no error. I think it has to be something with the variable $test. Anyone an idea???

tnx in advanced.................

  
  
  
$test = $persoon_gegevens->id->GetValue();   
  
  if ($persoon_gegevens->KampGroep->GetValue() == "LEIDING") {  
    
			$db = new clsDBConnection1();  
			$SQL ="insert into persoon_financien(fk_persoon,jaar) values ($test , 2008)";  
			$db->query($SQL);  
		  
    }  
	else{  
		  
	$db = new clsDBConnection1();  
			$SQL ="insert into persoon_financien(fk_persoon,jaar) values (133, 2008)";  
			$db->query($SQL);  
 	}  


View profile  Send private message
mamboBROWN


Posts: 1713
Posted: 02/06/2008, 5:27 PM

knackje

Try this:
$SQL ="insert into persoon_financien(fk_persoon,jaar) values (".$test.", 2008)";

if this does not work then........

Does your query work directly in mysql?? Have you tried displaying (echo) the value of $test to confirm that it does have an acceptable value in it??

View profile  Send private message
knackje

Posts: 30
Posted: 02/07/2008, 3:36 AM

tried your solution, but also no record is beeing inserted or anu error has given.

Not in the postion to try using the echo method. Will try later today, but is this the right way to fill a variable????

Where
$persoon_gegevens =the form name
id = control textfield in the form

$test = $persoon_gegevens->id->GetValue();  
View profile  Send private message
mamboBROWN


Posts: 1713
Posted: 02/07/2008, 5:06 PM

knackje
The way that you assigned a value to $test is the correct way but my question is what is being stored in $test. This is why I suggested that you echo out the variable so that you can see what is in it or use a PHP function to determine whether or not the variable is empty or null or an integer.
View profile  Send private message
knackje

Posts: 30
Posted: 02/07/2008, 9:41 PM

yes i know what you mean, will try it tonight when i'm back from work. I will let you know.

greetings
View profile  Send private message
JayEdgar


Posts: 77
Posted: 02/10/2008, 5:21 PM

throw in some
echo $SQL;
attempts here and there.

Basic debugging stuff.

Cheers,

J
View profile  Send private message
mamboBROWN


Posts: 1713
Posted: 02/13/2008, 8:11 PM

knackje
Did you resolve this??
View profile  Send private message
knackje

Posts: 30
Posted: 02/13/2008, 11:44 PM

i tried did

echo $test = $persoon_gegevens->id->GetValue();

but then i get a something like: call to a non ... object

the id is an hidden field. and i use the insert function on the event on_click

do you have an idea?
View profile  Send private message
mamboBROWN


Posts: 1713
Posted: 02/20/2008, 9:52 PM

knackje
Are you sure that the controls name is id and not ID (php is case sensitive)?? Are you sure that id is a field in the form #persoon_gegevems?? Have you resolved this issue....
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

MS Access to Web

Convert MS Access to Web.
Join thousands of Web developers who build Web applications with minimal coding.

CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.