Jump to content

[SOLVED] problem returning int values from table


neridaj

Recommended Posts

Hello,

 

I'm trying to return some invoice numbers (int) from a table to populate a select list but for some reason the values are coming back as as '' i.e., the correct number of select options are populated but with no data. When I try the same script on any other column (varchar or decimal) the data is returned correctly but var_dump returns null for all.

 

Here is my function:

 

function display_update_invoice($result)
{
?>
<form method='post' action='invoice.php'>
<table align='center' bgcolor='#4E4D4D'>
<tr>
<th colspan='2'>Update Invoice</th>
</tr>
<?php
  $info = mysqli_fetch_array($result);
  printf ("<tr><td>Description: </td><td><input type='textarea' rows='3' name='description' value='%s' /></td></tr>
		<tr><td>Amount Due: $</td><td class='alignright'><input type='text' name='amt_due' value='%s' /></td></tr>
		<tr><td>Amount Paid: $</td><td class='alignright'><input type='text' name='amt_paid' value='%s' /></td></tr>
		<tr><td>Balance: $</td><td class='alignright'><h3>%s</h3></td></tr>
		<tr><td colspan='2'><input type='submit' value='Update' /></td></tr>",
$info['inv_description'], $info['inv_amt_due'], $info['inv_amt_paid'], $info['inv_amt_balance']);
echo "<tr><td><select>";
  while ($obj = mysqli_fetch_array($result)) {
  printf("<option value='inv_num'>'%s'</option>", $obj['inv_number']);
    }
    echo "</select></td></tr></table></form>";
var_dump($obj['inv_number']);
  	mysqli_free_result($result);
}
?>

 

Thanks for any help,

 

J

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.