Jump to content

[SOLVED] if else help ...


imarockstar

Recommended Posts

I have joined these 2 tables (after a 90 page post yesterdsy :) ) ...

 

so what I need is that if there is no data in the userinfo table .. i need it to display a link .... if there is data in the userinfo table i need it to display like it is below ...

 

<?php





//select the table
$result2 = mysql_query("select * from userinfo where infoid = ". $_SESSION['userid']);



// Retrieve data from database 
$result = mysql_query("SELECT * FROM users INNER JOIN usersinfo ON users.userid = usersinfo.infoid WHERE usersinfo.infoid = '{$_SESSION['userid']}' ") or die(mysql_error());



// Start looping rows in mysql database.
while($rows=mysql_fetch_array($result)) { ?>


<span class=dataleft>userid</span>		
<span class=dataright><? echo $rows['userid']; ?></span>
<br class=clear>

<span class=dataleft>username</span>			
<span class=dataright><? echo $rows['username']; ?></span>
<br class=clear>

<span class=dataleft>name:</span>			
<span class=dataright><? echo $rows['fname']; ?> <? echo $rows['lname']; ?></span>
<br class=clear>

<span class=dataleft>location</span>			
<span class=dataright><? echo $rows['city']; ?>, <? echo $rows['state']; ?> <? echo $rows['zipcode']; ?></span>
<br class=clear>	

<span class=dataleft>sex</span>			
<span class=dataright><? echo $rows['sex']; ?></span>
<br class=clear>

<span class=dataleft>height</span>			
<span class=dataright><? echo $rows['height']; ?></span>
<br class=clear>

<span class=dataleft>weight</span>			
<span class=dataright><? echo $rows['weight']; ?></span>
<br class=clear>

<span class=dataleft>age</span>			
<span class=dataright><? echo $rows['age']; ?></span>
<br class=clear>


<div class=head1>your current gym</div>				
<div class=data1><? echo $rows['mygym']; ?></div>	

<div class=head1>your myspace</div>				
<div class=data1><? echo $rows['myspace']; ?></div>


<div class=head1>your facebook</div>				
<div class=data1><? echo $rows['facebook']; ?></div>

<div class=head1>your aim</div>				
<div class=data1><? echo $rows['aim']; ?></div>

<div class=head1>your yahoo</div>				
<div class=data1><? echo $rows['yahoo']; ?></div>


<? } ?>

 

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/121593-solved-if-else-help/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.