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

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 a … Read more

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

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 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?

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, that … Read more

[Solved] Allow HTML in excerpt

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 you … Read more

[Solved] Notice: is_main_query was called incorrectly

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 solved Notice: is_main_query was called … Read more

[Solved] What is wrong with this sql statement?

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 bracked … Read more

[Solved] Php multi array foreach loop

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) { if($value … Read more

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

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 loading. … Read more

[Solved] Stuck at this error: Incorrect integer value: ” for column ‘____’ at row 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 solved Stuck at this error: … Read more

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

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 in … Read more