[Solved] convert this php code to javascript – strpos, str_replace, substr [closed]

Use the search() method of the string object – it returns the position of the match, or -1 if no match is found var position = -1, oldFlipBookThumb; var str=”<?php echo $video[“thumbs’][‘master’];?>’; if(str.search(“/thumbs_old/” != -1){ position = str.search(“.flv”); } if(position != -1){ oldFlipBookThumb = str.replace(str.substring(position, Number(position) + 4), ‘.flv’); } I could be mistaken, but … Read more

[Solved] How to add my own PHP code in Drupal [closed]

Check out the module developers guide: http://drupal.org/developing/modules And the drupal “installing modules” pages: http://drupal.org/documentation/install/modules-themes You can also add code to “theme” your output by using template.php i theme directory: http://drupal.org/node/173880 solved How to add my own PHP code in Drupal [closed]

[Solved] How do i display images from MySQL database in a JavaScript image slider?

Here is a very basic Slideshow-from-PHP application. It can easily be modified or built upon. Image names (file_name) are pulled from the database, then pushed into a JavaScript array of image src values. Make sure you also specify the images directory (where the images are actually stored) to match your own. A simple image preloader … Read more

[Solved] increament by 5 for loop in php

<?php for ($i=5; $i < 1005; $i+=5) { ?> <option value = “<?php echo $i; ?>”><?php echo $i; ?></option> <?php } ?> $i+=5 <– This is the only change. How about this? 0 solved increament by 5 for loop in php

[Solved] Run SQL query based on drop down value [closed]

<?php include(“dbconfig.php”); if(isset($_POST[‘submit’])) { if(isset($_POST[‘type’])) { if($_POST[‘type’] == “enquiry”) { Query } elseif($_POST[‘type’] == “enroll”) { Query } else { echo “Please select enquiry or enrollment”; } } else { echo “Please select an option”; } } ?> <form action=”dropd.php” method=”POST”> <select name=”type”> <option value=””>Please select:</option> <option value=”enquiry”>Student enquiry</option> <option value=”enroll”>Student enrollment</option> <input type=”submit” name=”submit” … Read more

[Solved] How can I print array in parallel using php [closed]

Make your result an associative array keyed by user ID. Then it’s easy to collect all the image paths for the same user ID. $result = array(); while ($rowb = $result->fetch_assoc()) { $userid = $rowb[‘user_id’]; if (!isset($result[$userid])) { $result[$userid] = array(‘user_id’ => $userid, ‘image_path’ => array()); } $result[$userid][‘image_path’][] = $rowb[‘image_path’]; } The resulting JSON will … Read more

[Solved] Save textbox as variable without submitting [closed]

PHP is the sever-side programming language while JavaScript (jQuery) runs on the client-side. we can use PHP to write JS, but JS can’t affect PHP (except via AJAX or similar). What you can do is use SESSION here is sample code. Js Code $(“#varenummer”).change(function(e) { e.preventDefault(); var data_posts = $(this).val(); // Send Ajax request to … Read more

[Solved] OUTPUT Alone 1 key from the array

If you have small arrays, It is not a problem to run the algorithm with complexity O(n2). But for me better is less clear, but faster algorithm with complexity equals to O(2n) $array = array( array( ‘id’ => 12, ‘_from’ => 1, ‘_to’ => 2 ), array( ‘id’ => 13, ‘_from’ => 4, ‘_to’ => … Read more

[Solved] Can super form WordPress plugin works on different OS , with php version 7.0?

PHP 5.3 has different operator precedence to 7.x, if memory serves. So retaining the PHP version would be a problem. Plugins should work exactly the same between different OSes providing that permissions are the same. Changing between Apache and Nginx can break them if they’re dependent on rewrites/.htaccess. I hope that helps. solved Can super … Read more

[Solved] PHP finish text with … if it is too long

There’s no need to apply any PHP programming logic here. This thing can be achieved in CSS easily. .text-ellipsis { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; } And add this class to your span: <span class=”text-ellipsis”>WWWWWWWWWWWWW</span> 0 solved PHP finish text with … if it is too long