snipt

Ctrl+h for KB shortcuts
Notice: Snipt is moving away from free accounts on May 1st, 2014. Read more about the transition here.
#132125

Text only

Mobile App Development, iPhone Application Development Company AgileInfoways.com

1
2
3
4
5
Agile Infoways is a leading mobile app development company with over 600 apps built on iPhone, iPad and Android. Get free mobile app development quotes by http://www.agileinfoways.com/contact-us 

Our mobile application development services help businesses to mobilize their ... With a yearly rise in demand for Iphone apps, our developers and designers.

Find the feasible solutions for your business needs from a quality iPhone application development company who handle small to large projects.
https://snipt.net/embed/503bf95dc6b3e2d30771709de3c995e2/
https://snipt.net/raw/503bf95dc6b3e2d30771709de3c995e2/
503bf95dc6b3e2d30771709de3c995e2
text
Text only
5
2014-04-23T17:57:24
True
True
Apr 23, 2014 at 03:11 AM
/api/public/snipt/132125/
mobile-app-development-iphone-application-development-company-agileinfowayscom
<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></pre></div></td><td class="code"><div class="highlight"><pre><span id="L-1"><a name="L-1"></a>Agile Infoways is a leading mobile app development company with over 600 apps built on iPhone, iPad and Android. Get free mobile app development quotes by http://www.agileinfoways.com/contact-us </span><span id="L-2"><a name="L-2"></a> </span><span id="L-3"><a name="L-3"></a>Our mobile application development services help businesses to mobilize their ... With a yearly rise in demand for Iphone apps, our developers and designers. </span><span id="L-4"><a name="L-4"></a> </span><span id="L-5"><a name="L-5"></a>Find the feasible solutions for your business needs from a quality iPhone application development company who handle small to large projects. </span></pre></div> </td></tr></table>
"hire wordpress", agileinfoways.com, as3, bash, c++, css, django, drupal, git, html, java, javascript, jquery, js, linux, mysql, php, python, ruby, sql, wordpress
#126066

MySQL

Mysql importing errors

SET foreign_key_checks = 0;
https://snipt.net/embed/de729115ea11ac53277b45d415e8d9f9/
https://snipt.net/raw/de729115ea11ac53277b45d415e8d9f9/
de729115ea11ac53277b45d415e8d9f9
mysql
MySQL
1
2014-04-22T08:09:11
True
False
Mar 30, 2014 at 09:22 PM
/api/public/snipt/126066/
mysql-importing-errors
<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><span class="kt">SET</span> <span class="n">foreign_key_checks</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> </span></pre></div> </td></tr></table>
importing, mysql, sql
#122803

Text only

MySQL Find & Replace

update table_name set field_name = replace(field_name,'string_to_find','string_to_replace');
https://snipt.net/embed/91ceec1f408f00ebb1d2f4dbdce72f8d/
https://snipt.net/raw/91ceec1f408f00ebb1d2f4dbdce72f8d/
91ceec1f408f00ebb1d2f4dbdce72f8d
text
Text only
1
2014-04-20T11:52:30
True
False
Mar 18, 2014 at 12:04 PM
/api/public/snipt/122803/
mysql-find-replace
<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>update table_name set field_name = replace(field_name,&#39;string_to_find&#39;,&#39;string_to_replace&#39;); </span></pre></div> </td></tr></table>
mysql
#118288

PHP

Connect to a database

1
2
3
4
5
6
7
8
<?php
	$mysql_host = "localhost";
	$mysql_database = "test";
	$mysql_user = "root";
	$mysql_password = "";
	$socket = mysql_connect($mysql_host, $mysql_user, $mysql_password) or die(mysql_error());
	$db_select= mysql_select_db($mysql_database) or die(mysql_error());
?>
https://snipt.net/embed/4de122eda83cb85058012df995226217/
https://snipt.net/raw/4de122eda83cb85058012df995226217/
4de122eda83cb85058012df995226217
php
PHP
8
2014-04-23T13:04:41
True
False
Mar 03, 2014 at 09:23 PM
/api/public/snipt/118288/
connect-to-a-databse
<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> <a href="#L-8">8</a></pre></div></td><td class="code"><div class="highlight"><pre><span id="L-1"><a name="L-1"></a><span class="cp">&lt;?php</span> </span><span id="L-2"><a name="L-2"></a> <span class="nv">$mysql_host</span> <span class="o">=</span> <span class="s2">&quot;localhost&quot;</span><span class="p">;</span> </span><span id="L-3"><a name="L-3"></a> <span class="nv">$mysql_database</span> <span class="o">=</span> <span class="s2">&quot;test&quot;</span><span class="p">;</span> </span><span id="L-4"><a name="L-4"></a> <span class="nv">$mysql_user</span> <span class="o">=</span> <span class="s2">&quot;root&quot;</span><span class="p">;</span> </span><span id="L-5"><a name="L-5"></a> <span class="nv">$mysql_password</span> <span class="o">=</span> <span class="s2">&quot;&quot;</span><span class="p">;</span> </span><span id="L-6"><a name="L-6"></a> <span class="nv">$socket</span> <span class="o">=</span> <span class="nb">mysql_connect</span><span class="p">(</span><span class="nv">$mysql_host</span><span class="p">,</span> <span class="nv">$mysql_user</span><span class="p">,</span> <span class="nv">$mysql_password</span><span class="p">)</span> <span class="k">or</span> <span class="k">die</span><span class="p">(</span><span class="nb">mysql_error</span><span class="p">());</span> </span><span id="L-7"><a name="L-7"></a> <span class="nv">$db_select</span><span class="o">=</span> <span class="nb">mysql_select_db</span><span class="p">(</span><span class="nv">$mysql_database</span><span class="p">)</span> <span class="k">or</span> <span class="k">die</span><span class="p">(</span><span class="nb">mysql_error</span><span class="p">());</span> </span><span id="L-8"><a name="L-8"></a><span class="cp">?&gt;</span><span class="x"></span> </span></pre></div> </td></tr></table>
mysql, php
#114552

Shell Session

Import sql file to MySQL database using SSH

mysql -p -u DB_USERNAME DB_NAME < PATH/TO/FILE.sql
https://snipt.net/embed/2889d808e26a0fbea9ed3b8e1bfeeecf/
https://snipt.net/raw/2889d808e26a0fbea9ed3b8e1bfeeecf/
2889d808e26a0fbea9ed3b8e1bfeeecf
shell-session
Shell Session
1
2014-04-23T11:51:47
True
False
Feb 17, 2014 at 05:03 PM
/api/public/snipt/114552/
import-sql-file-to-mysql-database-using-ssh
<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><span class="go">mysql -p -u DB_USERNAME DB_NAME &lt; PATH/TO/FILE.sql</span> </span></pre></div> </td></tr></table>
database, mysql, sql, ssh, terminal
#107183

Text only

Create a new MySQL user and grant permissions

1
2
3
CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON *.* TO 'newuser'@'localhost';
FLUSH PRIVILEGES;
https://snipt.net/embed/e75d2b07cd56ee71c09da2af27eb7b58/
https://snipt.net/raw/e75d2b07cd56ee71c09da2af27eb7b58/
e75d2b07cd56ee71c09da2af27eb7b58
text
Text only
3
2014-04-19T04:03:44
True
False
Jan 20, 2014 at 07:43 AM
/api/public/snipt/107183/
create-a-new-mysql-user-and-grant-permissions
<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></pre></div></td><td class="code"><div class="highlight"><pre><span id="L-1"><a name="L-1"></a>CREATE USER &#39;newuser&#39;@&#39;localhost&#39; IDENTIFIED BY &#39;password&#39;; </span><span id="L-2"><a name="L-2"></a>GRANT ALL PRIVILEGES ON *.* TO &#39;newuser&#39;@&#39;localhost&#39;; </span><span id="L-3"><a name="L-3"></a>FLUSH PRIVILEGES; </span></pre></div> </td></tr></table>
mysql, user
#104619

MySQL

MYSQL insert random from list

1
2
3
4
5
INSERT INTO `im`
(`im`, `service`)
SELECT LOWER(`last`),
    ELT(0.5 + RAND() * 6, 'AIM', 'ICQ', 'MSN', 'Yahoo', 'GTalk', 'Other')
FROM `contact`
https://snipt.net/embed/8d58c72edaccf531a160855108a72482/
https://snipt.net/raw/8d58c72edaccf531a160855108a72482/
8d58c72edaccf531a160855108a72482
mysql
MySQL
6
2014-04-23T06:20:08
True
False
Jan 09, 2014 at 04:42 PM
/api/public/snipt/104619/
mysql-insert-random-from-list
<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></pre></div></td><td class="code"><div class="highlight"><pre><span id="L-1"><a name="L-1"></a><span class="k">INSERT</span> <span class="k">INTO</span> <span class="ss">`im`</span> </span><span id="L-2"><a name="L-2"></a><span class="p">(</span><span class="ss">`im`</span><span class="p">,</span> <span class="ss">`service`</span><span class="p">)</span> </span><span id="L-3"><a name="L-3"></a><span class="k">SELECT</span> <span class="nf">LOWER</span><span class="p">(</span><span class="ss">`last`</span><span class="p">),</span> </span><span id="L-4"><a name="L-4"></a> <span class="nf">ELT</span><span class="p">(</span><span class="mi">0</span><span class="p">.</span><span class="mi">5</span> <span class="o">+</span> <span class="nf">RAND</span><span class="p">()</span> <span class="o">*</span> <span class="mi">6</span><span class="p">,</span> <span class="s1">&#39;AIM&#39;</span><span class="p">,</span> <span class="s1">&#39;ICQ&#39;</span><span class="p">,</span> <span class="s1">&#39;MSN&#39;</span><span class="p">,</span> <span class="s1">&#39;Yahoo&#39;</span><span class="p">,</span> <span class="s1">&#39;GTalk&#39;</span><span class="p">,</span> <span class="s1">&#39;Other&#39;</span><span class="p">)</span> </span><span id="L-5"><a name="L-5"></a><span class="k">FROM</span> <span class="ss">`contact`</span> </span></pre></div> </td></tr></table>
mysql