snipt

Ctrl+h for KB shortcuts
#14708

Bash

Coldfusion - redirect

1
2
3
4
<cfset CurrentServerName = CGI.SERVER_NAME>
<cfif CurrentServerName EQ 'blah.com'>
    <cflocation url='http://blah2.com'>
</cfif>
https://snipt.net/embed/5b95656b1f4bc347fe0f6f415d8a43e6/
https://snipt.net/raw/5b95656b1f4bc347fe0f6f415d8a43e6/
5b95656b1f4bc347fe0f6f415d8a43e6
bash
Bash
4
2014-04-15T10:02:10
True
False
/api/public/snipt/14708/
coldfusion-redirect
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a></pre></div></td><td class="code"><div class="highlight"><pre><span id="L-1"><a name="L-1"></a>&lt;cfset <span class="nv">CurrentServerName</span> <span class="o">=</span> CGI.SERVER_NAME&gt; </span><span id="L-2"><a name="L-2"></a>&lt;cfif CurrentServerName EQ <span class="s1">&#39;blah.com&#39;</span>&gt; </span><span id="L-3"><a name="L-3"></a> &lt;cflocation <span class="nv">url</span><span class="o">=</span><span class="s1">&#39;http://blah2.com&#39;</span>&gt; </span><span id="L-4"><a name="L-4"></a>&lt;/cfif&gt; </span></pre></div> </td></tr></table>
coldfusion, redirect
#13428

HTML+PHP

Coldfusion - count sql results

1
2
3
4
5
6
7
<cfquery datasource="x" name="getX">
   Select *
   From Employees
</cfquery>

To get the record count, simply do a
<cfoutput>#getX.recordcount#</cfoutput>
https://snipt.net/embed/e0d1d395297ac392f4aeb4ccde6ea7ac/
https://snipt.net/raw/e0d1d395297ac392f4aeb4ccde6ea7ac/
e0d1d395297ac392f4aeb4ccde6ea7ac
html+php
HTML+PHP
7
2014-04-15T12:29:43
True
False
/api/public/snipt/13428/
coldfusion-count-sql-results
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a> <a href="#L-5">5</a> <a href="#L-6">6</a> <a href="#L-7">7</a></pre></div></td><td class="code"><div class="highlight"><pre><span id="L-1"><a name="L-1"></a><span class="nt">&lt;cfquery</span> <span class="na">datasource=</span><span class="s">&quot;x&quot;</span> <span class="na">name=</span><span class="s">&quot;getX&quot;</span><span class="nt">&gt;</span> </span><span id="L-2"><a name="L-2"></a> Select * </span><span id="L-3"><a name="L-3"></a> From Employees </span><span id="L-4"><a name="L-4"></a><span class="nt">&lt;/cfquery&gt;</span> </span><span id="L-5"><a name="L-5"></a> </span><span id="L-6"><a name="L-6"></a>To get the record count, simply do a </span><span id="L-7"><a name="L-7"></a><span class="nt">&lt;cfoutput&gt;</span>#getX.recordcount#<span class="nt">&lt;/cfoutput&gt;</span> </span></pre></div> </td></tr></table>
coldfusion
#13426

Bash

Coldfusion - current url

<cfset CurrentURL = 'https://' & CGI.SERVER_NAME & CGI.SCRIPT_NAME>
https://snipt.net/embed/88d094751ce226ac2b8d042e3fa061e9/
https://snipt.net/raw/88d094751ce226ac2b8d042e3fa061e9/
88d094751ce226ac2b8d042e3fa061e9
bash
Bash
1
2014-04-15T10:56:04
True
False
/api/public/snipt/13426/
coldfusion-current-url
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span id="L-1"><a name="L-1"></a>&lt;cfset <span class="nv">CurrentURL</span> <span class="o">=</span> <span class="s1">&#39;https://&#39;</span> <span class="p">&amp;</span> CGI.SERVER_NAME <span class="p">&amp;</span> CGI.SCRIPT_NAME&gt; </span></pre></div> </td></tr></table>
coldfusion