deemurphy Posted February 26, 2009 Share Posted February 26, 2009 I am trying to display the name and email address from MySQL, in a form so it can be changed. It pretty much works, but I only get the email address. Here is the code: <?php $sql = "select * from subscribers"; $result = mysql_query($sql); $num_rows=mysql_num_rows($result); echo "<div align=right class=FormTitle>Total No. of Customers : " . $num_rows."</div>"; $sno = 0; $noofrecord = mysql_num_rows($result); if ($start == "" && $end == "") { $start = 1; $end = 20; } while($row=mysql_fetch_array($result)) { if ($id == $end) { break; } $id++; $id = $row["id"]; $email = $row["email"]; $name = $row["name"]; echo "<tr class=TableFields><td>$email<td>$name</td>"; echo "<td class=LinkText align=center><a href=newsmailerlist.php?action=2&email=$email>Edit</a></td>"; echo "<td class=LinkText align=center><a href=newsmailerlist.php?action=3&email=$email>Delete</a></td>"; } ?> Could someone tell me what I have wrong i this code, so that I can get the name as well. Thank you LadyDee Link to comment https://forums.phpfreaks.com/topic/146964-having-aproblem-with-code/ Share on other sites More sharing options...
Philip Posted February 26, 2009 Share Posted February 26, 2009 Are you sure the name of the column is "name" and not "Name" or something else? while($row=mysql_fetch_array($result)) { if ($id == $end) { break; } $id++; echo '<pre>'; print_r($row); echo '</pre>'; /*$id = $row["id"]; $email = $row["email"]; $name = $row["name"]; echo "<tr class=TableFields><td>$email<td>$name</td>"; echo "<td class=LinkText align=center><a href=newsmailerlist.php?action=2&email=$email>Edit</a></td>"; echo "<td class=LinkText align=center><a href=newsmailerlist.php?action=3&email=$email>Delete</a></td>";*/ } The code above will show you what the proper array keys are. Link to comment https://forums.phpfreaks.com/topic/146964-having-aproblem-with-code/#findComment-771547 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.