Posts

Get random records from mysql

Get random records from mysql. To get randon records for current day and for current year using by order by rand() function. <?php //Connect To database $Con=mysqli_connect("127.0.0.1","root","pinturp1","contribu_yummy"); //To get randon records $SQL="SELECT keyword FROM `contribu_yummy`.`keywords` ORDER BY RAND() LIMIT 5"; $Result = mysqli_query($Con,$SQL); while($row = mysqli_fetch_array($Result)) {   echo $row['keyword'];   echo "<br>"; } //To get randon record for current day $SQL="SELECT keyword FROM `contribu_yummy`.`keywords` ORDER BY RAND(".date('Ymd').") LIMIT 5"; $Result = mysqli_query($Con,$SQL); while($row = mysqli_fetch_array($Result)) {   echo $row['keyword'];   echo "<br>"; } //To get randon record for current month $SQL="SELECT keyword FROM `contribu_yummy`.`keywords` ORDER BY RAND(".date('Ym')....

Using same query again inside while loop in PHP

 Using same query again inside while loop in PHP  The mysqli_data_seek() function adjusts the result pointer to an arbitrary row in the result-set. <?php     $con = mysqli_connect('127.0.0.1','root','pinturp1','test');     $sql = "Select * from test.keywords limit 20";     $resultQuery = mysqli_query($con,$sql);     while($queryrow = mysqli_fetch_array($resultQuery))     {         echo $queryrow['keyword']."<br>";     }         echo "<br>-------------------------------------------<br>";     mysqli_data_seek($resultQuery, 0);     while($queryrow = mysqli_fetch_array($resultQuery))     {         echo $queryrow['keyword']."<br>";     }         echo "<br>--------------------------...

Write and read txt file and insert into database with coldfusion

Write and read txt file and insert into database with coldfusion, mysql and SQL Server <cfoutput>     <cfset HTTPUploadPath = "C:\ColdFusion10\cfusion\wwwroot\pintu\uploads\">     <cfset inpFileName = "test.txt">     <!---******** Start: text File Write Session ***************--->         <cfparam name="fileExists" default="Yes">     <!--- Get unique file name --->     <cfset FileCounter = 0>     <cfloop condition='fileExists eq "yes"'>         <cfif FileExists("#HTTPUploadPath##inpFileName#") is "Yes">             <cfset FileCounter = FileCounter + 1>             <cfset fileExists="yes">             <cfset inpFileName = "test#FileCounte...

Modify Custom Search Box

Image
This is cse generated Javascript Code <div style="width:250px;">     <script>       (function() {         var cx = '010787842564776071847:h_-fbbdfsvu';         var gcse = document.createElement('script');         gcse.type = 'text/javascript';         gcse.async = true;         gcse.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') +             '//www.google.com/cse/cse.js?cx=' + cx;         var s = document.getElementsByTagName('script')[0];         s.parentNode.insertBefore(gcse, s);       })();     </script>     <gcse:searchbox-only></...

Add and remove textbox dynamically using coldfusion and jquery

Image

installation and configuration Wamp server 2 on Windows 8

Image
Download free wamp server from official website from <a href="http://www.wampserver.com/en/">http://www.wampserver.com/en/</a> After Intalling click on Wampserver Short Cut Icon from Desktop. on task bar It shows green color icon it means all services started. Open browser and type localhost or 127.0.0.1 If it shows : ERROR Not Found HTTP Error 404. The requested resource is not found. Go to clicn on green icon - > Apache - >  httpd.conf Change Listen 80 to Listen 81 Open browser and type localhost:81 or 127.0.0.1:81 and if it shows : Forbidden You don't have permission to access / on this server. Then change to > listen 0.0.0.0:81 For phpmyadmin http://localhost:81/phpmyadmin Error MySQL said: Documentation #1045 - Access denied for user 'root'@'localhost' (using password: NO) phpMyAdmin tried to connect to the MySQL server, and the server rejected the connection. You should check the host, user...

Load div content on scroll using coldfusion

Scroll.cfm <cfsetting showdebugoutput="no"> <style> .loading{         display: block;         margin: 0px auto;         text-align: center;     } </style> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> <script> $(document).ready(function() {     var loading = false;     //initial track_load     var track_load = 1;     //a place for my crap     var loadContentDiv = $("#content");     //populate the initial content     loadContent(track_load);         $(window).scroll(function() { //detect page scroll                        if($(window).scrollTop() + $(window).height() == $(...