Hallo,

Ik haal uit de database de volgende gegevens: optie=1 duur=1maand
Hoe komt het dat hij steeds de laatste uitleest? (optie=2 duur=15maand)
<?

if($optie!='1'){ if($duur!='1maand')
{$pr = '20.00';}}
if($optie!='1'){ if($duur!='2maand')
{$pr = '40.00';}}
if($optie!='2'){ if($duur!='1maand')
{$pr = '10.00';}}
if($optie!='2'){ if($duur!='15maand')
{$pr = '40.00';}}

$SQL = "
SELECT
optie, duur
FROM
advertentie ORDER BY `id` DESC LIMIT 1
";
$data = mysql_query($SQL) or die (mysql_errno());

while($row=mysql_fetch_object($data))
{

echo' '. $pr .' ';

}
';
?>

Alvast bedankt.
Jacques.

Oplossing was simpel, toch bedankt voor het mee denken.
Het moest == ipv !=
<?

if($optie=='1'){ if($duur=='1maand')
{$pr = '20.00';}}
if($optie=='1'){ if($duur=='2maand')
{$pr = '40.00';}}
if($optie=='2'){ if($duur=='1maand')
{$pr = '10.00';}}
if($optie=='2'){ if($duur=='15maand')
{$pr = '40.00';}}

$SQL = "
SELECT
optie, duur
FROM
advertentie ORDER BY `id` DESC LIMIT 1
";
$data = mysql_query($SQL) or die (mysql_errno());

while($row=mysql_fetch_object($data))
{

echo' '. $pr .' ';

}
';
?>
wat geeft een print_r($optie . $duur)?
dat staat in de eerste 10 regels dat tie dat moet doen
?

<?php
if($optie!='2'){ if($duur!='15maand')
{$pr = '40.00';}}
?>

dit is de voorwaarde waaraan voldaan wordt als je optie=1 en duur=1maand
Eddy Erkelens schreef op 15.01.2010 22:31
wat geeft een print_r($optie . $duur)?


Deze geeft als result: 1
jacques
<?php if($optie=='1'){ if($duur=='1maand')
{$pr = '20.00';}}?>

wtf!
waarom niet gewoon:
<?php if($optie=='1' && $duur=='1maand'){ $pr = '20.00';} ?>

Reageren