[Solved] I want to access another server database in PHP

[ad_1] Just read errors and correct it.. <?php $server2 = ‘192.168.1.211’; $con = mysqli_connect($server2,’root’,’password’,’vvani’); // here, $server2 is variable, not constant if (mysqli_connect_errno()) { echo “Failed to connect to MySQL: ” . mysqli_connect_error(); } 2 [ad_2] solved I want to access another server database in PHP

[Solved] The system is unable to find the requested action “name1”. in yii how to solve it [closed]

[ad_1] NameFormController should extend from Controller, not Controlle In your NameFormController, add the function: public function actionName1() { echo ‘action Name1()’; } Don’t forget to update the access rules to allow access to your new action: public function accessRules() { return array( array(‘allow’, ‘actions’ => array(‘index’, ‘view’, ‘name1’), ‘users’ => array(‘*’), ), array(‘deny’, ‘users’ => … Read more

[Solved] Name of current file PHP

[ad_1] basename(__FILE__, ‘.php’); See also here: http://php.net/basename, or, if you like pathinfo(__FILE__, PATHINFO_FILENAME); This last one works also if the extension is different from .php without the need to specify it, see http://php.net/manual/en/function.pathinfo.php 5 [ad_2] solved Name of current file PHP

[Solved] replace spaces with randam values [closed]

[ad_1] You can use the function rand() : $str = str_replace(‘ ‘, rand(0, 10000), $str); Or did you mean a random value from your list? In this case: $list = array(“value1”, “value2”); $str = str_replace(‘ ‘, array_rand($list, 1), $str); 1 [ad_2] solved replace spaces with randam values [closed]

[Solved] how to sum the array time [closed]

[ad_1] $totalTimeSecs = 0; foreach ($array as $l1) { // Loop outer array foreach ($l1 as $l2) { // Loop inner arrays if (isset($l2[‘jQuery’][‘length’])) { // Check this item has a length list($hours,$mins,$secs) = explode(‘:’,$l2[‘jQuery’][‘length’]); // Split into H:m:s $totalTimeSecs += (int) ltrim($secs,’0′); // Add seconds to total $totalTimeSecs += ((int) ltrim($mins,’0′)) * 60; // … Read more

[Solved] PHP timestamp convert to javascript?

[ad_1] You just need to convert client time to server time zone. Use Date.prototype.getUTCHours and etc methods. Also you can use Date.prototype.getTimezoneOffset() to check the time zone difference and notify use if day changed, for example: <script> var t3=<?php echo $t3; ?>; function update_clock3(){ var now = new Date(Number(t3)); var year = now.getUTCFullYear(); var month … Read more

[Solved] String to Array to list [closed]

[ad_1] You just need to replace the spaces with <br>‘s? echo str_replace(‘ ‘, ‘<br />’, $_POST[‘cake_list’]); Of course you should sanitize the POST, but this is a quick example for you. [ad_2] solved String to Array to list [closed]

[Solved] PDO in PHP doesn´t work – no error

[ad_1] In addition to what @Niet Suggested you have to know that you cannot reuse the same name for the placeholder like you did: INSERT INTO veranstaltung_anfrage (….) VALUES (..:a, :a, :a, :a, :a, :a, :a) You will need to give them unique names: INSERT INTO veranstaltung_anfrage (….) VALUES (..:a1, :a2, :a3, :a4, :a5….) then … Read more

[Solved] Parse JSON object with PHP [duplicate]

[ad_1] It seems to me like it should be. foreach($result[‘currency’]as $item) { print $item[‘value’]; } Because each currency is 0,1,2 and so on. And in the item 0,1,2 there is the “value”. 1 [ad_2] solved Parse JSON object with PHP [duplicate]

[Solved] use of in php and in wamp

[ad_1] I assume it doesn’t have anything to do with WAMP, and I’m not even sure I understand the situation fully, because you say “Strings in php cant have the characters <> in them in the wamp environment” (I interpret it as: It doesn’t work with WAMP) and then directly afterwards “It all works fine … Read more