hello there,
i have a purchase requisition table in mysql like below:
pr no qty items
1 10 pencil
1 5 ballpen
1 8 eraser
I would like to display them in tabular form and eventually the users should be able to edit.
But my program does not assign the three records to array. Below is my program
`
<?php
session_start();
include('Connection.php');
if( isset($_GET['edit']) )
{
$prno = $_GET['edit'];
$res= mysql_query("SELECT * FROM prdetails WHERE prno='$prno'");
$row= mysql_fetch_array($res);
$count=mysql_num_rows($res);
//echo $count;
$array=array();
$i=0;
while($count+1>$i)
{
$array[$i]=$row['quantity'];
//echo $array[$i];
//echo $i;
$i++;
}
echo $array[0];
echo $array[1];
/* $array=array();
foreach($row as $id => $row[0])
{
$array[$id]=$row[$id];
echo " ".$row[3];
}
*/
}
mysql_close($con);
if(isset($_POST['btnUpdate']))
{
include_once("MainClass.php");
$MainClass= new MainClass;
}
if(isset($_POST['btnBack']))
{
header('Location:.php');
}
?>
<form action="createPo.php" method="POST">
<?php
echo "Pr number:".$row[0];
echo "<br/>";
echo "Item:".$row[2];
echo "<br/>";
echo "Quantity:".$row[3];
echo "<br/>";
include_once("MainClass.php");
$MainClass= new MainClass;
echo "Supplier:";
echo $MainClass -> assignSupplier();
echo "<br>";
?>
</select>
<input type="hidden" name="prno" value="<?php echo $row[0];?>" ?/>
<input type="submit" name="btnUpdate"value=" Create Po "/>
<input type="submit" name="btnBack"value=" Back "/>
</form>
`