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);
}
|
 |
 |
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??
|
 |
 |
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();
|
 |
 |
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.
|
 |
 |
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
|
 |
 |
JayEdgar
Posts: 77
|
| Posted: 02/10/2008, 5:21 PM |
|
throw in some echo $SQL; attempts here and there.
Basic debugging stuff.
Cheers,
J
|
 |
 |
mamboBROWN
Posts: 1713
|
| Posted: 02/13/2008, 8:11 PM |
|
knackje
Did you resolve this??
|
 |
 |
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?
|
 |
 |
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....
|
 |
 |