[Solved] PHP in array not working

The reason I can think of why this returns ERROR: if (in_array(array(‘string’, ‘id’), array(‘string’, ‘id’))) { echo ‘IN ARRAY’; } else { echo ‘ERROR!’; } is because PHP is checking each of the haystack’s values against the needle itself. Suppose you have 2 arrays like so: $a = array(‘string’, ‘id’); $b = array(‘string’, ‘id’); $a … Read more

[Solved] Submit returning a blank page

try if($_SERVER[‘REQUEST_METHOD’]==”POST”){ or if(isset($_POST[‘update’])){ instead of if (isset($_POST[‘Submit’])) { the name of the submit button is update not Submit on your form also stop using mysql_* functions. If you have to use them for now, at least escape the inputs properly before inserting them to database. 1 solved Submit returning a blank page

[Solved] Security in codeigniter

Codeigniter and other popular frameworks like Zend, cake, Yii etc. they all provide methods and structure which to a certain extent force the developer to write code that is resistant to common exploits such as cross site scripting XSS, and SQL injection and other hacks. but everything really depends on the developer. frameworks will only … Read more

[Solved] Custom Regular Expressions [closed]

This is very bad practice, but because you asked for it: $str=”BCT34385Z0000N07518Z”; preg_match(‘/^(.{6})(.*?)$/’, $str, $result); echo $result[1]; // ‘BCT343′ echo $result[2]; // ’85Z0000N07518Z’ or if you want an if statement: $str = …; if (preg_match(‘/^BCT343/’, $str)) { // yes! } 2 solved Custom Regular Expressions [closed]

[Solved] Shortest path using php [closed]

As Mark Baker pointed out, you’ll need to use something like Dijkstra’s algorithm to traverse a weighted graph (which is what you’ll have when you include distances). Here’s a simple distance function I found here: <?php /*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/ /*:: :*/ /*:: This routine calculates the distance between two points (given the :*/ /*:: latitude/longitude of those … Read more

[Solved] Assign an array in an array variable in PHP

Following way to do array combine. 1) <?php $segmentVal = array( ‘Origin’ => ‘DEL’, ‘Destination’ => ‘CCU’, ‘FlightCabinClass’ => 2, ‘PreferredDepartureTime’ => ‘2017-10-13T00:00:00’, ‘PreferredArrivalTime’ => ‘2017-10-13T00:00:00’ ); $jsonData = array( ‘EndUserIp’ => $ipAddress, ‘TokenId’ => ‘a58c1052-c08f-4f40-9a9c-8841de585a14’, ‘AdultCount’ => 1, ‘ChildCount’ => 0, ‘InfantCount’ => 0, ‘DirectFlight’ => 1, ‘OneStopFlight’ => 0, ‘JourneyType’ => 1, ‘Segments’ … Read more

[Solved] Can’t get PHP variables in the JS script when setting Highcharts head tag [closed]

Introduction Highcharts is a powerful JavaScript library used to create interactive charts and graphs. It is widely used in web applications to visualize data in an easy-to-understand format. However, when setting Highcharts head tag, it can be difficult to get PHP variables in the JS script. This article will discuss how to solve this issue … Read more

[Solved] How can write a clean url in php? [duplicate]

What you are really asking is that the request to details.php gets routed to index.php. You will therefore need some code in index.php to understand this request is for details. You can use this in your .htaccess file RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-l RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php/$1 In … Read more