Hi, friends,
Here is how I'm putting the information into the database:
$query7 = isset($price) ? "INSERT INTO price (itemid, price) VALUES ($itemid,
'$price')" : 0;
$result7 = @pg_Exec($connection, $query7 );
I'm having difficulties with my test in display.
I've tried isset and == 'NULL' and == '0' as such:
if ($values2 == 'NULL')
{
print "<tr><td class=\"display\"> </td></tr>";
} else
{
print "<tr><td class=\"display\">US$ $values2->price</td></tr></table></td>";
}
and
if (isset($values2))
{
print "<tr><td class=\"display\">US$ $values2->price</td></tr></table></td>";
} else
{
print "<tr><td class=\"display\"> </td></tr>";
}
However, in both cases, if the price doesn't exist in the database, the US$ still
shows up in the
display.
db=> select * from price where itemid=50;
priceid | itemid | price
---------+--------+-------
48 | 50 |
(1 row)
I was surprised that the insert put something into the database at all.
I could use some advice.
I cleaned up the database to remove all the lines where price wasn't set.
Why is it creating a table row? If the insert form is passing in where they didn't
set the price,
wouldn't that get picked up by the isset?
And if there isn't a row in the database, wouldn't testing isset of the result of the
query be
sufficient, or should I do a test on $values2->price instead?
I've tried lots of things and nothing seems to be doing the right behavior. So thanks!
Lara