xCypherx Posted October 17, 2005 Share Posted October 17, 2005 hmm for some reason my script will only show 1 field when it should show 2 both with images see if you can see whats wrong with my script i know its messy, but im quite new... <?php $username="user"; $password="pass"; $database="db1"; mysql_connect("localhost",$username,$password); @mysql_select_db($database) OR die( "Unable to select database"); $query="SELECT * FROM ibf_members WHERE (`mgroup`='6' OR `mgroup_others`='6') ORDER BY `joined`"; $result=mysql_query($query); $num=mysql_numrows($result); mysql_close(); echo "<b><center>Roster</center></b><br>"; $i=0; while ($i < $num) { echo($num); $name=mysql_result($result,$i,"name"); $email=mysql_result($result,$i,"email"); $id=mysql_result($result,$i,"id"); mysql_connect("localhost",$username,$password); @mysql_select_db($database) OR die( "Unable to select database"); $sql="SELECT * FROM ibf_pfields_content WHERE (`member_id`='$id')"; $result2=mysql_query($sql); $num=mysql_numrows($result2); mysql_close(); $image=mysql_result($result2,$i,"field_2"); ?> <font face="Arial, Helvetica, sans-serif"><a href="index.php?showuser=<? echo $id; ?>"><? echo $name; ?></a><img src=/style_flags/<? echo $image; ?>></font><br> <?php $i++; } ?> Quote Link to comment Share on other sites More sharing options...
khuti Posted October 20, 2005 Share Posted October 20, 2005 hi, duno if this seems easier for u, but i find it easier to do things like this.. $db = mysql_connect("localhost", "user", "pass"); mysql_select_db("database_name", $db); $result = mysql_query("SELECT * FROM table_name ORDER BY sumink_like_id_is_always_good ASC", $db); while($row=mysql_fetch_array($result)) { echo("name ur field:" . $row['field_name']); echo("if more than one thing u can do it like this"); echo("1: " . $row['field_name'] . " 2: " . $row['2nd_field'] . "); } mysql_close(); --- hope this helps.. khuti Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.