Jump to content

Help needed


whizzykid

Recommended Posts

Hi i have this code but dont knw how to make it select each row in the database.

mysql_select_db($database_profiles, $profiles);
$query_Recordset2 = "SELECT * FROM biodata";
$Recordset2 = mysql_query($query_Recordset2, $profiles) or die(mysql_error());
$row_Recordset2 = mysql_fetch_assoc($Recordset2);
$totalRows_Recordset2 = mysql_num_rows($Recordset2);

Link to comment
https://forums.phpfreaks.com/topic/160872-help-needed/
Share on other sites

Use a while loop with mysql_fetch_assoc or mysql_fetch_array. As such -

<?php

while ($row = mysql_fetch_assoc($Recordset2)) {
     // your code here
}

 

So instead of calling the function once like you have up there, the while loop will keep calling the function to retrieve more rows until there are none left, in which case, the while loop stops.

Link to comment
https://forums.phpfreaks.com/topic/160872-help-needed/#findComment-848996
Share on other sites

Hi thanks i hv done tht but shws errors.

$query_Recordset2 = "SELECT * FROM biodata";
$Recordset2 = mysql_query($query_Recordset2, $profiles) or die(mysql_error());
while ($row = mysql_fetch_assoc($Recordset2)){
$row_Recordset2 = $row ['Name'] ['Address'];


}
     
$totalRows_Recordset2 = mysql_num_rows($Recordset2);
form action="<?php echo $editFormAction; ?>" method="post" name="form1" id="form1">
  <table align="center">
    <tr valign="baseline">
      <td nowrap="nowrap" align="right">Name:</td>
      <td><?php echo $row_Recordset2['Name']; ?></td>
    </tr>
    <tr valign="baseline">
      <td nowrap="nowrap" align="right">Address:</td>
      <td><input type="text" name="Address" value="<?php echo htmlentities($row_Recordset2['Address'], ENT_COMPAT, 'utf-8'); ?>" size="32" /></td>
    </tr>
    <tr valign="baseline">
      <td nowrap="nowrap" align="right">Tracking Number:</td>
      <td><input type="text" name="Tracking_Number" value="<?php echo htmlentities($row_Recordset2['Tracking Number'], ENT_COMPAT, 'utf-8'); ?>" size="32" /></td>
    </tr>
    <tr valign="baseline">
      <td nowrap="nowrap" align="right">Phone Number:</td>
      <td><input type="text" name="Phone_Number" value="<?php echo htmlentities($row_Recordset2['Phone Number'], ENT_COMPAT, 'utf-8'); ?>" size="32" /></td>
    </tr>
    <tr valign="baseline">
      <td nowrap="nowrap" align="right">Delivery Address:</td>
      <td><input type="text" name="Delivery_Address" value="<?php echo htmlentities($row_Recordset2['Delivery Address'], ENT_COMPAT, 'utf-8'); ?>" size="32" /></td>
    </tr>

Link to comment
https://forums.phpfreaks.com/topic/160872-help-needed/#findComment-849118
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.