Menu
Forums
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Trending
What's new
New posts
New profile posts
Latest activity
Members
Current visitors
New profile posts
Search profile posts
Upgrades
Log in
Register
What's new
Search
Search
Search titles only
By:
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
Software Development
Programming
Programming Q&A
Issue fixed, Close thread.
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="JayC" data-source="post: 350690" data-attributes="member: 36373"><p>Rather than hard coding you could also make it a bit more elaborate.</p><p>- 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.</p><p>- You have to fetch the assoc in order to grab fields otherwise you won't be able to use the information</p><p>- 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.</p><p></p><p>//Get</p><p>$setID = mysql_fetch_assoc(mysql_query("SELECT `display_text` FROM `texts` WHERE `identifier` = 'news_id'"));</p><p>$news = mysql_query("SELECT * FROM cms_news WHERE id = '".$setID['setID']."'");</p><p></p><p>- You can use this to simply post a form to update the news ID in your housekeeping</p><p>//Set</p><p><?php</p><p>if(isset($_POST['newsID']){</p><p>$newID = filter($_POST['newsID']);</p><p>if(is_numeric($newID)){</p><p>mysql_query("UPDATE `texts` SET `news_id` = '".$newID."' WHERE `identifier = 'news_id'");</p><p>}else{</p><p>echo "Not Numeric";</p><p>}</p><p>}</p><p></p><p><strong><em>None of this code is testing, I just coded it on my phone. Enjoy <img src="/styles/default/xenforo/smilies/emojione/smile.png" class="smilie" loading="lazy" alt=":)" title="Smile :)" data-shortname=":)" /></em></strong></p></blockquote><p></p>
[QUOTE="JayC, post: 350690, member: 36373"] 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"; } } [B][I]None of this code is testing, I just coded it on my phone. Enjoy :)[/I][/B] [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Software Development
Programming
Programming Q&A
Issue fixed, Close thread.
Top