[Solved] Combine/Mix two lists of words [closed]

[ad_1] For a correct answer I would need to know what you are trying or how, but a solution for that problem is as simple as <?php $array1 = array(“make”, “break”, “buy”); $array2 = array(“home”, “car”, “bike”); foreach ($array1 as $i => $value) { foreach ($array2 as $j => $value2) { echo $value.’ ‘.$value2.'<br />’; … Read more

[Solved] please help me PHP and SQL [closed]

[ad_1] You want to create a new table that acts as a link between the subject and teacher, lets call it teacher_subject. The table should have three columns: id, subjectId and teacherId. To add a subject to the teacher, just insert a new row with the correct subjectId and teacherId. To get all the subjects … Read more

[Solved] Pass variables from Javascript to PHP – Popup/Modal Window

[ad_1] If you’re okay with the page reloading, you can simply do window.location.href(‘php_script_that_needs_your_input.php?id=input_id_from_js’); If not, I absolutely recommend using JQuery as it makes Ajax queries a breeze. Inside the <head> tags: <script src=”http://code.jquery.com/jquery-2.2.0.min.js”></script> Upload the script to your own server for production purposes, obviously. in the <body>, where you want the results from the PHP … Read more

[Solved] Displaying key/value in PHP object

[ad_1] I think this might work with your current setup: <?php //assuming your current dataset isn’t in JSON, you can ignore this part $json = ‘{ “items”: { “item”: [{ “id”: “59”, “type”: “Domain”, “relid”: “27”, “description”: “Sample Monthly Product”, “amount”: “180.00”, “taxed”: “0” }, { “id”: “203”, “type”: “Server”, “relid”: “86”, “description”: “Sample Yearly … Read more

[Solved] save array to mysql using php [closed]

[ad_1] If you’re planning on saving all of the array as one string in the database you can just use mysqli_query, and mysqli_real_escape_string: Saving all of the array as one string: $arr = [“002012295915”, “00971595502”, “8885555512”, “5555648583”, “4085555270”, “0562825196”, “01147220964”]; $con = mysqli_connect(“localhost”,”root”,”pass”,”db”); mysqli_query($con,”insert into TABLE values(‘”.mysqli_real_escape_string($con,$arr).”‘)”); And if you want to print it later … Read more

[Solved] PHP doesn’t follow if..else conditions

[ad_1] You cannot check value of colActualStart by checking the result of the mysqli_query. After your mysqli_query, your must call a fetch function to retrieve data, like you did 2 lines below. A something like that and it will work : $checker=mysqli_fetch_array(mysqli_query($con, “SELECT colActualStart FROM tblChecklist WHERE colEntryID=’1′ AND colDate=”Aug 19,2014″”)); if($checker[0] != NULL){ 1 … Read more

[Solved] column based mysql results in php [closed]

[ad_1] assuming you have a mysql table setup like this https://www.dropbox.com/s/cth0mkfwt382z0g/Screenshot%202014-08-20%2016.27.48.png and you have your php files setup to db properly //query database for data $result = mysql_query(“SELECT question, answer, ip FROM test_answers”); //Create some arrays $answer_array = array(); $ip_array = array(); $question_array = array(); //loop through the mysql data and populate the arrays while … Read more

[Solved] how to convert php script to exe? [closed]

[ad_1] Try using HipHop from Facebook. This compiles PHP down to highly optimized C++ and works on Linux. You’d have to try compiling and installing it yourself, but once you got it compiled down to C++ you can now use g++ or any other C++ compiler to create for yourself a nice executable (though not … Read more

[Solved] php ‘ISSET’ function not working. OR the code skips my if statements

[ad_1] In addition to the supplied answer(s), I would like to suggest doin the following: // Before anything else, start your session if (!isset($_SESSION)) { session_start(); } // Next, check if your form is actually submitted if ($_SERVER[‘REQUEST_METHOD’] == ‘POST’) { if (isset($_POST[‘…’])) { } elseif (isset($_POST[‘…’])) { } } ?> <!– Keep PHP and … Read more

[Solved] Calculate price based on interval [closed]

[ad_1] function calculatePrice($numberOfUnits) { // Initialise price $price = 0; // Prices: amount for category => price for category // Starts with largest category $prices = array(150 => 1.5, 100 => 2, 50 => 2.5, 0 => 3); // Loop over price categories foreach($prices as $categoryAmount => $categoryPrice) { // Calculate the numbers that fall … Read more

[Solved] How to get image URL within HTML tags?

[ad_1] thanks for your answers.i could solve my problem with this code.hope help other guys. $text = $row[“your html text from database row”]; preg_match(‘/< *img[^>]*src *= *[“\’]?([^”\’]*)/i’, $text, $img); $pics=$img[1]; output is ($pics)= ( images/akhbar/5/q103.jpg ) [ad_2] solved How to get image URL within HTML tags?

[Solved] PHP array_merge combining arrays with same values

[ad_1] Arrays can contain repeated values but, for obvious reasons, cannot contain repeated keys. array_combine will overwrite the value corresponding to each duplicate key it finds. Assuming that all your serial numbers are unique, a simple solution would be to swap round your array_combine to make the serial number the key: foreach (array_combine($serial, $make) as … Read more