I want to randomly display bits of text from my DB in the title tags and other places on my site, but I cant figure out how. First I used
Im stuck with pulling array elements from mysql DB with PHP please help
4
I want to randomly display bits of text from my DB in the title tags and other places on my site, but I cant figure out how.
First I used
$keyword_one = $result['keyword_one'];
$keyword_two = $result['keyword_two'];
$keyword_three = $result['keyword_three'];
$keyword_four = $result['keyword_four'];
$keyword_five = $result['keyword_five'];
$keyword_multi = $result['keyword_multi'];
$input = array($keyword_one, $keyword_two, $keyword_three, $keyword_four, $keyword_five);
$keyword = array_rand($input);
// echo $input[$keyword];
?>
and i worked fine, but I didnt want a brand new column in the DB for every snippet so I tried this
$keyword_one = $result['keyword_one'];
$keyword_two = $result['keyword_two'];
$keyword_three = $result['keyword_three'];
$keyword_four = $result['keyword_four'];
$keyword_five = $result['keyword_five'];
$keyword_multi = $result['keyword_multi'];
$input = array($keyword_multi);
$keyword = array_rand($input);
// echo $input[$keyword];
?>
and stored this in the DB
'best rated e cigarette 2017', 'most popular e cig 2017', 'best priced e cigarette', 'number one voted e cigarette worldwide', 'the longest established e cig supplier','number one e cig 2017', 'get healthy with e cigs', 'forget the craving smoke anywhere', 'we all love to smoke and with this e cig you can do it anywhere', 'the new super e cigarette for everyone'
can anyone tell me where im going wrong or do I need to use a different column for every keyword??
I want to do this with random content sections to but a column per one would be a nightmare
can anyone help please
First I used
$keyword_one = $result['keyword_one'];
$keyword_two = $result['keyword_two'];
$keyword_three = $result['keyword_three'];
$keyword_four = $result['keyword_four'];
$keyword_five = $result['keyword_five'];
$keyword_multi = $result['keyword_multi'];
$input = array($keyword_one, $keyword_two, $keyword_three, $keyword_four, $keyword_five);
$keyword = array_rand($input);
// echo $input[$keyword];
?>
and i worked fine, but I didnt want a brand new column in the DB for every snippet so I tried this
$keyword_one = $result['keyword_one'];
$keyword_two = $result['keyword_two'];
$keyword_three = $result['keyword_three'];
$keyword_four = $result['keyword_four'];
$keyword_five = $result['keyword_five'];
$keyword_multi = $result['keyword_multi'];
$input = array($keyword_multi);
$keyword = array_rand($input);
// echo $input[$keyword];
?>
and stored this in the DB
'best rated e cigarette 2017', 'most popular e cig 2017', 'best priced e cigarette', 'number one voted e cigarette worldwide', 'the longest established e cig supplier','number one e cig 2017', 'get healthy with e cigs', 'forget the craving smoke anywhere', 'we all love to smoke and with this e cig you can do it anywhere', 'the new super e cigarette for everyone'
can anyone tell me where im going wrong or do I need to use a different column for every keyword??
I want to do this with random content sections to but a column per one would be a nightmare
can anyone help please
- timokeefe
- [ 1 ] Thanks
- [1] reply
- Michael Martin
- timokeefe
Next Topics on Trending Feed
-
4