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

Link to comment
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.