[Solved] Reset While loop value in PHP

Try use jquery, the below example is for random numbers. <script> var id = window.setInterval(function(){randomNumber();},1000); function randomNumber() { var rand = Math.floor(Math.random()*6); //Do whatever you want with that number $(‘#holder’).html(rand); } </script> <!DOCTYPE html> <html> <head> <script src=”http://code.jquery.com/jquery-1.9.1.min.js”></script> <meta charset=utf-8 /> <title>Random Number</title> </head> <body> <div id=’holder’></div> </body> </html> For random text var names = … Read more

[Solved] Display Who Follows You on Instagram [closed]

These are the relevant Instagram API docs you should refer to for specifics. As a rough overview: you will need to register a developer account, create an app, and authorize that app to receive an access token. Once you have that, something like this will do what you want: $userId = “self”; $url = “https://api.instagram.com/v1/users/$user/followed-by?access_token=$accessToken”; … Read more

[Solved] Extracting data from Json in Php

I hope you are looking for this, its very simple example by using json_decode(): $string = ‘{“seat_booked”:”A5″,”0″:”A5″,”1″:”A3″}’; $decoded = json_decode($string,true); $resuiredString = ‘”‘.”‘”.implode(“‘,'”, $decoded).”‘”.'”‘; echo $resuiredString; Result: “‘A5′,’A5’,’A3′” Side Note: I suggest you to learn about variable concatenation. PHP Concatenation 2 solved Extracting data from Json in Php

[Solved] How can i get javascript variable to store in php? [duplicate]

Pl. try this code <html> <head> <script type=”text/javascript”> var q=document.getElementById(“val”).value; //document.write(q); </script> </head> <body> <input type=”hidden” value=”nis” id=”val”></body> <script type=”text/javascript”> var q=document.getElementById(“val”).value; document.write(q); </script> <?php echo $ff=”<script type=”text/javascript”> document.write(q)</script>”; ?> <?php echo $ff; ?> </html> 1 solved How can i get javascript variable to store in php? [duplicate]

[Solved] How to store array values in new array?

$array = [[0=>’ENG’],[0=>’IND’],[0=>’PAK’],[0=>’ING’]]; $result = call_user_func_array(‘array_merge’, $array); echo “<pre>”; print_r($result); Above code you mention is not useful. I made an array and flattened. output: Array ( [0] => ENG [1] => IND [2] => PAK [3] => ING ) 3 solved How to store array values in new array?

[Solved] How many possibilities on a binary? [closed]

I assume you are thinking of binary rather than hexadecimal? Binary is base 2 (hence either 0 or 1s) where as Hexadecimal is base 16. Assuming you are talking about binary: If you have 8 bits you have 28 possibilities. If you have 9 bits you have 29 possibilities. If you have 10 bits you … Read more

[Solved] Warning: date() expects parameter 2 to be long, object given in [closed]

The variable you supplied ($songs->PLAYEDAT) is probably a string or at best a DateTime object. If it’s a DateTime object: $songs->PLAYEDAT->format(‘Y-m-d H:i:s’) If it’s a string representation of a date: date(‘Y-m-d H:i:s’, strtotime($songs->PLAYEDAT)) UPDATE: Answer specific to this question copied back from comment below date(‘Y-m-d H:i:s’, intval($songs->PLAYEDAT[0])) 8 solved Warning: date() expects parameter 2 to … Read more

[Solved] Using Cake PHP Sort to sort Array Keys

You cannot sort an simple array by his key in cake. You can only sort like this: (or you can use {n}.{n} ) $array = (e,h,u,w,r); $result = Set::sort($array, ‘{n}’, ‘asc’); pr($result); For key sorting use ksort php function, or create in cake a ksort function with same properties and use it ksort( $array ); … Read more

[Solved] SQL, PHP update query

Use the mysql_affected_rows function to find the number of records affected. Please see following code. $record = mysql_query(“update table set a=”$b”, b=’$c’ where id = ‘$id’ “); $total_rows = mysql_affected_rows($conn); echo $total_rows; where $conn is the connection object 0 solved SQL, PHP update query

[Solved] PHP doesn’t recognize mkdir

mkdir() is in your PHP installation and is working; the error actually shows that you’re trying to create a directory inside a directory that doesn’t exist. You may need to pass true as the third parameter to make it work recursively, i.e. mkdir($path, 0777, true) 1 solved PHP doesn’t recognize mkdir

[Solved] Set the returned value from php using AJAX [closed]

Make the index.html an index.php and move your php code to the top of the index file, then make the form submit to itself. This allows you to do live user feedback using echo or similar – without the need for AJAX 🙂 solved Set the returned value from php using AJAX [closed]