[Solved] Listing photos with php [closed]

[ad_1] When looping to display the images you need to break every 10 photos like so: $photosPerLine = 10; for ( var $i = 0; $i < $totalNumPhotos; $i++ ) { drawPhoto(); // This does the actual drawing – perhaps echo a <IMG> or whatever // Now we check if we’ve reached 10 in a … Read more

[Solved] complex array merge using nested loop

[ad_1] As discussed in chat, here is a javascript example that builds what you asked for: var tabs = [{“uId”:”2″,”tabId”:1,”tabName”:”Main”,”points”:”10″,”active”:”true”},{“uId”:”3″,”tabId”:2,”tabName”:”Photography”,”points”:”20″,”active”:””}]; var tasks = [{“taskId”:3,”taskName”:”Sing Sing Gem”,”priorty”:3,”date”:”2014-04-25″,”done”:0,”tabId”:1,”uId”:”2″},{“taskId”:4,”taskName”:”Shooting”,”priorty”:4,”date”:”2014-04-25″,”done”:0,”tabId”:2,”uId”:”3″}]; var uidSet = {}; var UIDSortFunction = function(a,b){ uidSet[a.uId] = 1; uidSet[b.uId] = 1; return a.uId – b.uId; }; tabs.sort(UIDSortFunction); tasks.sort(UIDSortFunction); var endResult = []; var i, j, tabsLen … Read more

[Solved] Are these php functions correct? [closed]

[ad_1] Please check the below code, what wrong you did are commented in code:- <?php error_reporting(E_ALL); // check all error including warning and notice error too ini_set(‘display_errors’,1); // display errors function add($x,$y) { $result= $x+$y; return $result; } // ; not needed $number1= $_POST[‘n_1’]; $number2= $_POST[‘n_2’]; echo $number1.” + “.$number2.” = “.add($number1,$number2);// using “ is … Read more

[Solved] Get uncommon values from two or more arrays

[ad_1] Use array_diff and array_merge: $result = array_merge(array_diff($array1, $array2), array_diff($array2, $array1)); Here’s a demo. For multiple arrays, combine it with a callback and array_reduce: function unique(&$a, $b) { return $a ? array_merge(array_diff($a, $b), array_diff($b, $a)) : $b; } $arrays = array( array(‘green’, ‘red’, ‘blue’), array(‘green’, ‘yellow’, ‘red’) ); $result = array_reduce($arrays, ‘unique’); And here’s a … Read more

[Solved] How to make dynamic array from static array

[ad_1] You can generate variable names in for loops like this. Just change the value of $how_many_i_want. $how_many_i_want = 3; for($x=0;$x<$how_many_i_want;$x++){ generate_entropy($x); } function generate_entropy($nth){ $kriteria = [‘C1′,’C2′,’C3′,’C4′,’C5′,’C6’]; $alternatif = [‘ALT1′,’ALT2′,’ALT’,’ALT4′,’ALT5′,’ALT6′,’ALT7′]; ${“nEntropy$nth”} = array(); for ($i=0;$i<count($kriteria);$i++){ for ($j=0;$j<count($alternatif);$j++){ ${“nEntropy$nth”}[$i] = (((-1)/log(7)) *( ($probabilitas[0][$nth]*log($probabilitas[0][$nth]))+ ($probabilitas[1][$nth]*log($probabilitas[1][$nth]))+ ($probabilitas[2][$nth]*log($probabilitas[2][$nth]))+ ($probabilitas[3][$nth]*log($probabilitas[3][$nth]))+ ($probabilitas[4][$nth]*log($probabilitas[4][$nth]))+ ($probabilitas[5][$nth]*log($probabilitas[5][$nth]))+ ($probabilitas[6][$nth]*log($probabilitas[6][$nth])) )); } } showb(${“nEntropy$nth”}); } 6 … Read more

[Solved] PHP and Java, how to join them?

[ad_1] I have noticed some websites using like this, can not remind now, but I think you can do that through JavaScript . Passing the data to JavaScript and retributive it and again use and send result through JavaScript . PHP has support for instantiation of Java objects and using them transparently as PHP objects. … Read more

[Solved] Can’t redirect to another page in PHP

[ad_1] if(!$k) { echo “Koneksi Gagal <br>”; echo mysqli_errno(); } else { echo “Koneksi Berhasil”; } Either of your if-else will run and write something to the response. you can’t redirect after writing the response. To redirect set header(“Location : select.php”); before echo or any other output [ad_2] solved Can’t redirect to another page in … Read more

[Solved] Separate MYSQL results into separate HTML Tables

[ad_1] Keeping the code pretty generic here, but presumably you’re currently doing something like this: // output a table header while ($row = mysql_fetch_assoc($members)) { // output a table row } // output a table footer If you want to begin a new table periodically in that loop, you’d need to add a condition to … Read more

[Solved] Auto email responding

[ad_1] You need to append below code at bottom to send email to the sender as well. // Email to Sender (Without HTML/CSS) $sender_email = $email; $admin_email=”[email protected]”; $message = “Thanks for your interest”.$name.”\n\n”; $message .= “This is just a quick note to let you know we have received your form and will respond as soon … Read more

[Solved] Why is my contact form taking me to contact.php rather than sending an email to me? [closed]

[ad_1] It sounds like your server is not processing PHP correctly. There’s nothing wrong with your HTML form, assuming contact.php is indeed the action page you want – you just need to get your server/computer to handle PHP properly. Check this answer for more info. [ad_2] solved Why is my contact form taking me to … Read more