Nice, I'll try it out.Rather than hard coding you could also make it a bit more elaborate.
- I just used a premade table called "texts" which holds all your captioning on your hotel, just to have a field that will handle the news you want, this way you can add a page to change it VIA Housekeeping, and you can change it easily in the database without having to open up the page EVERY TIME.
- You have to fetch the assoc in order to grab fields otherwise you won't be able to use the information
- If you want to use this same setup, open your texts table and add identifier = "news_id" and display_text = "2" or whatever one you need.
//Get
$setID = mysql_fetch_assoc(mysql_query("SELECT `display_text` FROM `texts` WHERE `identifier` = 'news_id'"));
$news = mysql_query("SELECT * FROM cms_news WHERE id = '".$setID['setID']."'");
- You can use this to simply post a form to update the news ID in your housekeeping
//Set
<?php
if(isset($_POST['newsID']){
$newID = filter($_POST['newsID']);
if(is_numeric($newID)){
mysql_query("UPDATE `texts` SET `news_id` = '".$newID."' WHERE `identifier = 'news_id'");
}else{
echo "Not Numeric";
}
}
None of this code is testing, I just coded it on my phone. Enjoy