Guest User

Untitled

a guest
Sep 12th, 2018
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.38 KB | None | 0 0
  1. Getting an error - Warning: mysql_fetch_array() [closed]
  2. <?php
  3.  
  4.  
  5. $MemberDisplayList = '<table border="0" align="center" cellpadding="6">
  6. <tr> ';
  7.  
  8. $sql = mysql_query("SELECT id, firstname FROM myMembers WHERE email_activated='1' ORDER BY RAND() LIMIT 9");
  9. while($row = mysql_fetch_array($sql)){
  10. $id = $row["id"];
  11. $firstname = $row["firstname"];
  12. $firstname = substr($firstname, 0, 10);
  13.  
  14. $check_pic = "members/$id/image01.jpg";
  15. if (file_exists($check_pic)) {
  16. $user_pic = "<img src="members/$id/image01.jpg" width="64px" border="0" />";
  17. } else {
  18. $user_pic = "<img src="members/0/image01.jpg" width="64px" border="0" />";
  19. }
  20. $MemberDisplayList .= '<td><a href="profile.php?id=' . $id . '"><font size="-2">' . $firstname . '</font></a><br />
  21. <div style=" height:64px; overflow:hidden;"><a href="profile.php?id=' . $id . '">' . $user_pic . '</a></div></td>';
  22.  
  23. }
  24.  
  25. $MemberDisplayList .= ' </tr>
  26. </table> ';
  27. ?>
  28.  
  29. <?php
  30. require_once('connect_my_sql.php');
  31. while($row = mysql_fetch_array($sql))
  32. $db_host = "localhost";
  33. $db_username = "amirato";
  34. $db_pass = "gapa";
  35. $db_name = "rato";
  36. mysql_connect("$db_host","$db_username","$db_pass") or die ("could not connect to mysql");
  37. mysql_select_db("$db_name") or die ("no database");
  38. ?>
  39.  
  40. $result = mysql_query("SELECT * FROM table");
  41. while($row = mysql_fetch_array($result))
  42. {
  43. ...
  44. }
Add Comment
Please, Sign In to add comment