sql result omzetten naar tekst
Hallo, ik heb hier onder even de code gezet... Het gaat om de sitestate (geband of niet). Ik zou het zo willen gemaakt krijgen dat als sitestate 0 is, er een andere tekst verschijnt dan wanneer sitestate 1 is. Dit is een stukje dat iedereen kan zien, geband of niet... Nu is het probleem dat er altijd ss1 komt in de kolom van sitestate, terwijl niet iedereen geband is...
Ik hoop dat het een beetje duidelijk is...
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<tr>
<td width="75" align="left" class="sub"><b>Name:</b></td>
<td width="123" align="left" class="sub"><b>Signup Date:</b></td>
<td width="123" align="left" class="sub"><b>Laatst actief: </b></td>
<td width="100" align="left" class="sub"><b>IP-adres:</b></td>
<td width="150" align="left" class="sub"><b>Email-adres:</b></td>
<td width="12" align="left" class="sub">Sitestate</td>
</tr>
<?php
$result = mysql_query("SELECT name,signup,lastactive,userip,mail,sitestate FROM login ORDER BY id DESC LIMIT 0,10 ") or die(mysql_error());
// keeps getting the next row until there are no more to get
while($row = mysql_fetch_array( $result )) {
?>
<tr>
<td width="75" align="left" class="cell"><?php echo"<a href=\"view_profile.php?name=". $row['name'] ."\" onFocus=\"if(this.blur)this.blur()\">".$row['name']."</a>"; ?></td>
<td width="123" align="left" class="cell" ><?php echo $row['signup']; ?></td>
<td width="123" align="left" class="cell" ><?php echo $row['lastactive']; ?></td>
<td width="100" align="left" class="cell" ><?php echo $row['userip']; ?></td>
<td width="150" align="left" class="cell" ><?php echo $row['mail']; ?></td>
<td width="12" align="left" class="cell" ><?php if($row['sitestate']="0"){echo "ss0";}elseif($row['sitestate']="1"){echo "ss1";}elseif($row['sitestate']="2"){echo "ss2";};?></td>
</tr>
<?php
}// while loop?>
<td width="75" align="left" class="sub"><b>Name:</b></td>
<td width="123" align="left" class="sub"><b>Signup Date:</b></td>
<td width="123" align="left" class="sub"><b>Laatst actief: </b></td>
<td width="100" align="left" class="sub"><b>IP-adres:</b></td>
<td width="150" align="left" class="sub"><b>Email-adres:</b></td>
<td width="12" align="left" class="sub">Sitestate</td>
</tr>
<?php
$result = mysql_query("SELECT name,signup,lastactive,userip,mail,sitestate FROM login ORDER BY id DESC LIMIT 0,10 ") or die(mysql_error());
// keeps getting the next row until there are no more to get
while($row = mysql_fetch_array( $result )) {
?>
<tr>
<td width="75" align="left" class="cell"><?php echo"<a href=\"view_profile.php?name=". $row['name'] ."\" onFocus=\"if(this.blur)this.blur()\">".$row['name']."</a>"; ?></td>
<td width="123" align="left" class="cell" ><?php echo $row['signup']; ?></td>
<td width="123" align="left" class="cell" ><?php echo $row['lastactive']; ?></td>
<td width="100" align="left" class="cell" ><?php echo $row['userip']; ?></td>
<td width="150" align="left" class="cell" ><?php echo $row['mail']; ?></td>
<td width="12" align="left" class="cell" ><?php if($row['sitestate']="0"){echo "ss0";}elseif($row['sitestate']="1"){echo "ss1";}elseif($row['sitestate']="2"){echo "ss2";};?></td>
</tr>
<?php
}// while loop?>
Laat asap iets horen als je weet wat er verkeerd is...
EDIT: reacties niet meer nodig, probleem reeds opgelost!
Gewijzigd op 01/01/1970 01:00:00 door Ruben Vanhoeyveld
Er zijn nog geen reacties op dit bericht.