Jump to content

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

thanks this is the code.

mysql_select_db($database_profiles, $profiles);

$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'];


}

Link to comment
https://forums.phpfreaks.com/topic/160872-help-needed/#findComment-849024
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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.