Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Getting an error - Warning: mysql_fetch_array() [closed]
- <?php
- $MemberDisplayList = '<table border="0" align="center" cellpadding="6">
- <tr> ';
- $sql = mysql_query("SELECT id, firstname FROM myMembers WHERE email_activated='1' ORDER BY RAND() LIMIT 9");
- while($row = mysql_fetch_array($sql)){
- $id = $row["id"];
- $firstname = $row["firstname"];
- $firstname = substr($firstname, 0, 10);
- $check_pic = "members/$id/image01.jpg";
- if (file_exists($check_pic)) {
- $user_pic = "<img src="members/$id/image01.jpg" width="64px" border="0" />";
- } else {
- $user_pic = "<img src="members/0/image01.jpg" width="64px" border="0" />";
- }
- $MemberDisplayList .= '<td><a href="profile.php?id=' . $id . '"><font size="-2">' . $firstname . '</font></a><br />
- <div style=" height:64px; overflow:hidden;"><a href="profile.php?id=' . $id . '">' . $user_pic . '</a></div></td>';
- }
- $MemberDisplayList .= ' </tr>
- </table> ';
- ?>
- <?php
- require_once('connect_my_sql.php');
- while($row = mysql_fetch_array($sql))
- $db_host = "localhost";
- $db_username = "amirato";
- $db_pass = "gapa";
- $db_name = "rato";
- mysql_connect("$db_host","$db_username","$db_pass") or die ("could not connect to mysql");
- mysql_select_db("$db_name") or die ("no database");
- ?>
- $result = mysql_query("SELECT * FROM table");
- while($row = mysql_fetch_array($result))
- {
- ...
- }
Add Comment
Please, Sign In to add comment