JavaScript – Proper Methods For Getting Values From SELECT LIST – SELECTED

JavaScript – Proper Methods For Getting Values From SELECT LIST
Given Select List:

<select id="ddlViewBy">
    <option value="1">test1</option>
    <option value="2" selected="selected">test2</option>
    <option value="3">test3</option>
</select>

Running this code:

var e = document.getElementById("ddlViewBy");
var strUser = e.options[e.selectedIndex].value;

Would make strUser  == 2".

If what you actually want is the text displayed valuetest2", then do this:

var e = document.getElementById("ddlViewBy");
var strUser = e.options[e.selectedIndex].text;

strUser  == test2"

Multiple Lines For PHP String – Use the concatenation operator – the period

PHP – Sometimes we want to write our strings on Multiple Lines. It is easier to read.
Use the concatenation operator – the period    .      : )

$select_sql =
 "(SELECT nvdtechnical.TECH_Value_Float ".
 "FROM nvdtechnical ".
 "WHERE TECH_TechCode = '11' ".
 "AND nvdtechnical.TECH_Id = capder.cder_ID ".
 "AND nvdtechnical.TECH_Value_Float BETWEEN 40 AND 59 ".
 "LIMIT 1".
 ") as MPG_VALUE ";

[SHORTCODE_Insert_Google_Adsence_Here]

PHP – Use glob() to search for specific file-names in a directory

PHP – Use glob() to search for specific file-names in a directory
/*
Folder with image files contains:

../test_images_folder/21548.JPG
../test_images_folder/21548_1.JPG
../test_images_folder/21548_2.JPG
../test_images_folder/21548_3.JPG
../test_images_folder/21548_4.JPG
../test_images_folder/21548_5.JPG
../test_images_folder/21548_6.JPG
../test_images_folder/22222_5.JPG

*/



$image = "21548";// string to match image file name

foreach(glob("../test_images_folder/*".$image."*") as $filename){

     echo "$filename";

}

/*
Above ‘glob() usage will return:

../test_images_folder/21548.JPG
../test_images_folder/21548_1.JPG
../test_images_folder/21548_2.JPG
../test_images_folder/21548_3.JPG
../test_images_folder/21548_4.JPG
../test_images_folder/21548_5.JPG
../test_images_folder/21548_6.JPG

*/
[SHORTCODE_Insert_Google_Adsence_Here]
 

Regards,

Ken

MySQL said: Incorrect integer value: ” for column ‘your_column’

Later versions of MySQL (my current version MySQL 5.6) will throw an error, if attempting to insert empty (i.e. '') values into a row with INT settings - even with NULL set to "YES"
ERROR: "MySQL said: Incorrect integer value: '' for column 'your_column'"

[SHORTCODE_Insert_Google_Adsence_Here]
You can prevent this error with PHP/MySQL, with a disable of  “STRICT_TRANS_TABLES" - which is triggering the error, on the empty string, you are trying to insert.

$My_Query = " SET SESSION sql_mode= 'NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'; ";
 *No spaces between the commas

Set it back after if you like… Although I belive it is automatically set back.

SET SESSION sql_mode= 'STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' 


*No spaces between the commas

See what your MySQL says about the current settings via phpMyAdmin:

SELECT @@GLOBAL.sql_mode;
SELECT @@SESSION.sql_mode;