How To Select Rows in MySQL with No Matching Entry in Another Table

Author: , May 16th, 2018

SELECT t1.id FROM tableOne t1 LEFT JOIN tableTwo t2 ON t1.id = t2.id WHERE t2.id IS NULL The “WHERE t2.id IS NULL clause” restricts the results to only those rows where the id returned from tableTwo is null. tableTwo.id will be NULL for all records from tableOne where the id is not found in tableTwo.

How To Select the Max Numeric in a Varchar Column in MySQL

Author: , October 2nd, 2015

I needed to automate the addition of new users with a sequential member’s ID in WordPress. Additionally, there were non-numeric entries in that column that had to be ignored. The wp_users.user_login column is a varchar(60) and so does not naturally handle numeric operations well at all. The solution is a combination of REGEXP and cast(): […]

How To Select the First Table Cell in the First Row Using CSS

Author: , April 19th, 2014

table.myTable > tbody > tr:first-child > td:first-child

How To Select Only Numeric Values From MySQL

Author: , September 6th, 2012

1 select field from table where field REGEXP ‘^-?[0-9]+$’; select field from table where field REGEXP ‘^-?[0-9]+$’;

How To Check If Any Radio Button In A Group Is Checked Using jQuery

Author: , May 9th, 2012

1 2 3 4 5 6 7 8 9 if ( ! jQuery(’input[name=yourRadioGroup]‘).is(’:checked’) ) return false;   ~OR~   if (! jQuery(’input[name=yourRadioGroup]:checked’).val()) {    alert(’Please make a selection…’); } else {   alert(’Thank you for making a selection!’); } if ( ! jQuery(‘input[name=yourRadioGroup]‘).is(‘:checked’) ) return false; ~OR~ if (! jQuery(‘input[name=yourRadioGroup]:checked’).val()) { alert(‘Please make a selection…’); […]

How To Display Rows From MySQL Using PHP And Smarty v2

Author: , January 27th, 2012

The PHP 1 2 3 4 5 6 7 8 9 $sql = ‘select * from yourTable’; $result = mysql_query($sql); $rows = array(); while ($row = mysql_fetch_assoc($result)) {    $rows[]   = $row; } $page   = new Smarty(); $page->assign(’rows’, $rows); $page->show(’yourTemplate.php’); $sql = ‘select * from yourTable’; $result = mysql_query($sql); $rows = array(); while […]

How To Deselect All Options Using jQuery

Author: , July 2nd, 2011

1 jQuery(’option:selected’).removeAttr("selected"); jQuery(‘option:selected’).removeAttr(“selected”);

How To Select The First Option Using jQuery

Author: , July 2nd, 2011

1 jQuery(’#elementID option:first’).attr("selected","selected"); jQuery(‘#elementID option:first’).attr(“selected”,”selected”);

How To Copy Data From Table To Table Using MySQL

Author: , June 8th, 2011

1 2 CREATE TABLE newTable LIKE oldTable; INSERT INTO newTable SELECT * FROM oldTable; CREATE TABLE newTable LIKE oldTable; INSERT INTO newTable SELECT * FROM oldTable; 1 INSERT INTO newtable (`name`, `address1`, `address2`, `city`, `state`, `zip`, `phone`) SELECT `name`, `address1`, `address2`, `city`, `state`, `zip`, `phone` FROM oldtable; INSERT INTO newtable (`name`, `address1`, `address2`, `city`, `state`, […]

How To Select A jQuery UI Tab From A Link Anchor

Author: , May 11th, 2011

The HTML: 1 <a href="#" onclick="return switchTab(1);">Your Tab</a> <a href=”#” onclick=”return switchTab(1);”>Your Tab</a> The jQuery: 1 2 3 4 function switchTab(TabIndex) {    jQuery(’#tabs’).tabs(’select’,TabIndex);    return false; } function switchTab(TabIndex) { jQuery(‘#tabs’).tabs(‘select’,TabIndex); return false; }