Re: Only can display first row of tables to a form
Hi Peter,
Discovered why my other entries were not populating. Since I was doing a loop function the line $dbLink->close(); needed to be moved to the end of the script. The below script is working fine now. I really appreciate the help and advice you gave me. You are awesome!
<?php
require('dbconnect_test.php');
$dbLink = new mysqli ($DBHOST, $DBUSER, $DBPASS, $DBNAME);
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$player_first_name = ($_get['player_first_name']);
$player_last_name = ($_get['player_last_name']);
$sql = "SELECT * FROM test_tbl";
$result = mysqli_query ($dbLink, $sql);
while($row=mysqli_fetch_array($result)) {
echo $row['player_first_name'], $row['player_last_name'], "<br />";
?>
<form action="test.php" method="get" enctype="multipart/form-data" multiple="multiple">
<input type="text" name="player_first_name" value= "<?php echo $row['player_first_name']; ?> ">
<input type="text" name="player_last_name" value= "<?php echo $row['player_last_name']; ?> ">
</form>
<?php
}
$dbLink->close();
?>
Subject
Written By
Posted
September 06, 2017 05:32PM
September 06, 2017 06:37PM
September 07, 2017 07:55AM
September 07, 2017 10:23AM
Re: Only can display first row of tables to a form
September 07, 2017 02:36PM
September 07, 2017 05:29PM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.