I need to pull some random (table_2 'product') content
into an existing php/smarty template system
The php page call has to be in the format
{include file="element:ww_1"}
(that works just fine) to the "element DB" tabel_1
===========================================================
DB_ABC.tabel_1
==========================================================
id name description content
88 ww_1 products call XXXXX
XXXX = something like below
SELECT * FROM `tabel_2` ORDER BY `item`, RAND() LIMIT 1; code to insert 'product' randomly selected in the rendered html/php page
the random content has to be is pulled from
====================
DB_ABC.tabel_2
====================
item product
1 Plastic
2 Metal
3 Wooden
4 Rubber
5 Stone
z problem
depending on tags/calls used the present results are
1)either the bare code TD> SELECT * FROM `Tabel_2` ORDER BY .....</TD
showes in the rendered php/html page or
2)nothing is rendered & nothings sent back/done from Tabel_2
just TD> </TD
CODE CREATE TABLE `tabel_2` ( `item` int(4) NOT NULL auto_increment, `product` varchar(10) NOT NULL default '', KEY `item` (`item`) ) TYPE=MyISAM AUTO_INCREMENT=6;
Trying to adapt either of these calls
$mynumber = rand(1, 5);
$query_content = "SELECT * FROM tabel_2 WHERE item = $mynumber";
echo $query_content['product'];
$qc = mysql_query("SELECT * FROM tabel_2 ORDER BY item, RAND() LIMIT 1");
$query_content = mysql_fetch_array($qc);
Just cant seem to hit on the right code & tearr'in my hair out
any help
cheers
Zoote
Edited by zoot, 29 January 2007 - 04:36 AM.
