Hi to all,
It's more mysql question than php, but I like you more than mysql guys! :)
Let's say I have a table called "orders" and other table called
"special_orders_instructions".
Logically, one column in "orders" table should be link to
"special_order_instructions" (foreign key ?) and if that one is checked
go and grab special instructions after order_id.
But, since "orders" table doesn't have such a column (and I CANNOT add
it - long story...) I have to check for every order does that order_id
exists in "special_order_instructions" table. And, if yes - print.
Table "special_order_instructions" has about 25 columns and I have to
show EVERY ONE. Means, have to use
select * from special_order_instructions...
But, just to check does such an order have any special instruction
$query = mysql_query("select * from special_order_instructions...");
is bad idea. It would be "more" correct
$query = mysql_query("select spec_inst_id from
special_order_instructions...");
and then
if (mysql_num_rows($query) > 0)
{
// Show instructions
}
Does this make a sense:
$query = mysql_query("select spec_inst_id from
special_order_instructions...");
if (mysql_num_rows($query) > 0)
{
$query = mysql_query("select * from special_order_instructions...");
while( ... )
{
// show instructions here...
}
}
Thanks for any help!
-afan
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php