I have a some problems with my self-made php+sql search engine.
Can You tell me, please, how can I know database name, from which result was find?
I have a few db’s, from which I’m searching using SELECT + UNION ALL + SELECT…
So I need to know from which db was string to use it in image loader as parameters.
$row['file'] = str_ireplace( $row['file'], '<center><A href=openfile.php?id='.$row['id'].'&base='???' target="_blank">Файл '.$row['imgno'].'</A></center>', $row['file'] );
Is there any possibility to realize it except adding extra row (with string like db name) in each db and using .$row[‘base’]. ?
UPD: And how to know the table name id DB have lot of it?
I hope it is clear.
Thanks for help.
I think the DATABASE() function will do this for you.
http://dev.mysql.com/doc/refman/5.0/en/information-functions.html#function_database