[Solved] How to insert to a database with foreach? [closed]

[ad_1] You need to add the MySQL query inside the foreach() function, as well: foreach ($qurum as $value) { $query2 = “INSERT INTO test (data_id, col2) VALUES ($id, $value)”; mysqlExecute($query2); } Note that mysqlExecute() does not exist, you need to use your own function to execute the query. Also note that executing SQL statements in … Read more

[Solved] What is the difference between session_id(), session_create_id() and session_regenerate_id() in php?

[ad_1] session_id(): Get and/or set the current session id session_regenerate_id(): Update the current session id with a newly generated one session_create_id(): Create new session id Here is a link to the PHP sessions doc and PHP docs 6 [ad_2] solved What is the difference between session_id(), session_create_id() and session_regenerate_id() in php?

[Solved] How to prevent SQL injections in manually created queries?

[ad_1] I dont want to use other method You should use whatever provides the required functionality, not the method that you like more over others! Also you should never access superglobals directly in CakePHP, this will only bring you in trouble, especially in unit tests. User the proper abstracted methodes provided by the request object, … Read more

[Solved] Allow HTML in excerpt

[ad_1] COMPLETE GUIDE TO EXCERPTS I’ve recently answered a few questions regarding excerpts, so I’m going to give a detailed explanation covering as much as I can. PREFACE There seems to be a couple of questions arising from this answer on where the code should go, and the answer is, it is really up to … Read more

[Solved] Notice: is_main_query was called incorrectly

[ad_1] the solution is given in your error itself “use the WP_Query->is_main_query() method”– try this – if($query->is_main_query() && !empty($selected_sort_types) && empty($orderby)) { $_sort_types = array_keys($selected_sort_types); $orderby = $_sort_types[0]; $query->set(‘orderby’, $orderby); } instead of this – if(is_main_query() && !empty($selected_sort_types) && empty($orderby)) { $_sort_types = array_keys($selected_sort_types); $orderby = $_sort_types[0]; $query->set(‘orderby’, $orderby); } 2 [ad_2] solved Notice: is_main_query … Read more

[Solved] What is wrong with this sql statement?

[ad_1] First error: field names should be enclosed in backticks, not quotes. (and even then, the backticks are only necessary if the field name is a reserved SQL word or contains special characters. Generally it’s a good idea to have backticks, but in your example you can get away without them) Second error: missing closing … Read more

[Solved] Php multi array foreach loop

[ad_1] I solved it , below code work fine $countryArray = array( ‘AD’ => array( ‘country_name’ => ‘ANDORRA’, ‘dial_code’ => ‘376’ ), ‘AE’ => array( ‘country_name’ => ‘UNITED ARAB EMIRATES’, ‘dial_code’ => ‘971’ ), ‘AF’ => array( ‘country_name’ => ‘AFGHANISTAN’, ‘dial_code’ => ’93’ )); foreach ($countryArray as $keys=> $arraycountry){ foreach($arraycountry as $key => $value) { … Read more

[Solved] how to change php functions send result to jquery ajax [closed]

[ad_1] right code for this <? // http://huddak.net/bbs/board.php?bo_table=cm_free&wr_id=3629 function remove_nr($str) { $reg_e = array(‘/\n/’, ‘/\r/’, ‘/\”https://stackoverflow.com/”, “/<\/script>/i”); $reg_p = array(‘ ‘, ‘ ‘, ‘\\”‘, “<\/SCRIPT>”); return preg_replace($reg_e, $reg_p, $str); } ?> <script type=”text/javascript”> $(“#test1″).html( ” <? echo remove_nr( trim( db_cache(“main_top_naver_cache”, 300, “naver_popular(‘naver_popular’, 4)”)))?> ” ); </script> you can do time consuming php code to jquery … Read more

[Solved] Stuck at this error: Incorrect integer value: ” for column ‘____’ at row 1

[ad_1] Query need to be like:- $sql = “INSERT INTO prodb.simplex_list (code, description, manufacturer, cost_per_unit, weight_per_unit, bar_code, ingredients_list, allergens_contains, allergens_may_contain) VALUES (‘$proCode’, ‘$proDescr’, ‘$proManu’, ‘$proCPU’,’$proWPU’, ‘$proBarCode’, ‘$proIngredients’, ‘$proAllergens’, ‘$proMayAllergens’)”; Note:- please stop using mysql_*. Use mysqli_* or PDO. Also this will work only when id field must be auto incremented. 8 [ad_2] solved Stuck at … Read more

[Solved] on click, reduce countdown with 1 and so something, when countdown reaches 0 open window

[ad_1] This code is maybe the solution you wanted: function countdown() { var i = document.getElementById(‘counter’); if (parseInt(i.innerHTML)<=0) { $(“#counter”).fadeout(); i.innerHTML =10; i.style.width=”100%”; $(“#counter”).fadein(10); } else { i.innerHTML = parseInt(i.innerHTML)-1; setTimeout(function(){ var i = document.getElementById(‘counter’); i.style.width=”10%”; i.innerHTML=”1″; },5000) } var msg = window.open(“”, “Window name”, “width=200, height=100”); msg.document.write(“Some HTML”); } You have to add jquery … Read more