kenyi Posted January 15, 2007 Share Posted January 15, 2007 Code:[code]$result = mysql_query("SELECT username,email,name,user.ID FROM user, user_info") or die(mysql_error()); echo "<table border=1 ><tr><td>Name</td><td>Username</td><td>E-mail</td><td>Actions</td></tr>"; while ($user_info = mysql_fetch_array($result,MYSQL_ASSOC)){ echo "<tr><td>".$user_info['name']."</td> <td>".$user_info['username']."</td> <td>".$user_info['email']."</td> <td><a href='".$_SERVER['PHP_SELF']."?action=edit&uid=".$user_info['ID']."'>Edit</a></td> <td><a href='".$_SERVER['PHP_SELF']."?action=remove&uid=".$user_info['ID']."'>Remove</a></td> </tr>"; }[/code]This is the output:[quote]Name Username E-mail ActionsLim Yong Fei kenyi [email protected] Edit RemoveAH KEONG kenyi [email protected] Edit RemoveDOREMI kenyi [email protected] Edit RemoveLim Yong Fei admin [email protected] Edit RemoveAH KEONG admin [email protected] Edit RemoveDOREMI admin [email protected] Edit RemoveLim Yong Fei demo [email protected] Edit RemoveAH KEONG demo [email protected] Edit RemoveDOREMI demo [email protected] Edit RemoveLim Yong Fei kenyi25 Edit RemoveAH KEONG kenyi25 Edit RemoveDOREMI kenyi25 Edit RemoveLim Yong Fei keong [email protected] Edit RemoveAH KEONG keong [email protected] Edit RemoveDOREMI keong [email protected] Edit RemoveLim Yong Fei DOREMI [email protected] Edit RemoveAH KEONG DOREMI [email protected] Edit RemoveDOREMI DOREMI [email protected] Edit Remove[/quote]So..obviously the values are mixed and repeated. How do i get rid of that?? Link to comment https://forums.phpfreaks.com/topic/34242-mysql_fetch_array-mixes-value-in-different-row/ Share on other sites More sharing options...
kobmat Posted January 15, 2007 Share Posted January 15, 2007 You should review your query.. there should be a connection between the user and the userinfo tables likeSELECT user_info.username,user_info.email,user_info.name, user.ID FROM user, user_info WHERE user.ID=user_info.ID Link to comment https://forums.phpfreaks.com/topic/34242-mysql_fetch_array-mixes-value-in-different-row/#findComment-161052 Share on other sites More sharing options...
kenyi Posted January 15, 2007 Author Share Posted January 15, 2007 oh.. yea.. i forgot that.. thnx Link to comment https://forums.phpfreaks.com/topic/34242-mysql_fetch_array-mixes-value-in-different-row/#findComment-161062 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.