al3bed
09-19-2009, 02:57 AM
hello,
I have a problem (how-to).. let me show you an example:
if(something == something else){
$ain_data = $vbulletin->db->query_first("
SELECT id, type, content
FROM " . TABLE_PREFIX . "ainadse AS ainadse
WHERE id = '1' ");
//str_replace code to fetch the template (show) here
}
if(something == something else){
$ain_data = $vbulletin->db->query_first("
SELECT id, type, content
FROM " . TABLE_PREFIX . "ainadse AS ainadse
WHERE id = '2' ");
//str_replace code to fetch the template (show) here
}
if(something == something else){
$ain_data = $vbulletin->db->query_first("
SELECT id, type, content
FROM " . TABLE_PREFIX . "ainadse AS ainadse
WHERE id = '3' ");
//str_replace code to fetch the template (show) here
}
now the problem is when I call $ain_data from a template it's always take the last one in the template... in our example its will take data of id 3
is there any way to solve that? cuz my brain out of data now!
I try something like this but it's the same:
if(something == something else){
$ain_id = '1';
//str_replace code to fetch the template (show) here
}
if(something == something else){
$ain_id = '2';
//str_replace code to fetch the template (show) here
}
if(something == something else){
$ain_id = '3';
//str_replace code to fetch the template (show) here
}
$ain_data = $vbulletin->db->query_first("
SELECT id, type, content
FROM " . TABLE_PREFIX . "ainadse AS ainadse
WHERE id = '$ain_id' ");
.. template always read last variable $ain_id
what I'm trying to achive? what is my idea?
I want to show ads in a forum by a templete
in a plugin, I read the ads data from the database then
use str_replace to fetch that template in exact place where i want
regarding to the if statment
if there is a better way please tell me
I think my way to achive this is wrong!
thanks alot
I have a problem (how-to).. let me show you an example:
if(something == something else){
$ain_data = $vbulletin->db->query_first("
SELECT id, type, content
FROM " . TABLE_PREFIX . "ainadse AS ainadse
WHERE id = '1' ");
//str_replace code to fetch the template (show) here
}
if(something == something else){
$ain_data = $vbulletin->db->query_first("
SELECT id, type, content
FROM " . TABLE_PREFIX . "ainadse AS ainadse
WHERE id = '2' ");
//str_replace code to fetch the template (show) here
}
if(something == something else){
$ain_data = $vbulletin->db->query_first("
SELECT id, type, content
FROM " . TABLE_PREFIX . "ainadse AS ainadse
WHERE id = '3' ");
//str_replace code to fetch the template (show) here
}
now the problem is when I call $ain_data from a template it's always take the last one in the template... in our example its will take data of id 3
is there any way to solve that? cuz my brain out of data now!
I try something like this but it's the same:
if(something == something else){
$ain_id = '1';
//str_replace code to fetch the template (show) here
}
if(something == something else){
$ain_id = '2';
//str_replace code to fetch the template (show) here
}
if(something == something else){
$ain_id = '3';
//str_replace code to fetch the template (show) here
}
$ain_data = $vbulletin->db->query_first("
SELECT id, type, content
FROM " . TABLE_PREFIX . "ainadse AS ainadse
WHERE id = '$ain_id' ");
.. template always read last variable $ain_id
what I'm trying to achive? what is my idea?
I want to show ads in a forum by a templete
in a plugin, I read the ads data from the database then
use str_replace to fetch that template in exact place where i want
regarding to the if statment
if there is a better way please tell me
I think my way to achive this is wrong!
thanks alot