0
votes
1answer
35 views
Using json encode
I am trying to use json encode for the first time and need some insight to what I am doing wrong.
It should look like this:
{ teams : [ ["2147483647", "9"],["2147483647", "6"],["2147483647", ...
0
votes
0answers
25 views
Unexpected 'undefined offset' error in PHP
In this project I am sifting through non formatted HTML code and looking for a specific value, below is a section of code from a paragraph deconstruction function. I am using preg_replace to get rid ...
0
votes
1answer
11 views
Storing data in global/session variables vs. MySQL queries
A general PHP question about organizing a website: for efficiency purposes, is it better to store data from MySQL queries into global arrays, or to make a new query every time data is needed? I am ...
0
votes
2answers
34 views
how to get output of this code. sometimes it shows output and sometime it doesnot?
<?php
include 'config.php';
$tid = $_GET['tid'];
$sql="SELECT FROM topics where tid='$tid'";
$result=mysql_query($sql);
while($rows=mysql_fetch_array($result)){
?>
<div ...
0
votes
4answers
56 views
PHP is_array returns “1” on true and breaks on false
I am passing a jQuery array to PHP. My call back function returns the value when it is a string, but breaks when sending an array. The break is in the PHP code.
I've tested the following:
$yes = ...
0
votes
1answer
21 views
PHP extension function array_init throws 'return_value is undeclared'
For the first time I'm trying to create PHP extenstion. I need a function that will return an assoc array. So for the test reasons I created a small function:
PHP_FUNCTION(testing_array) {
char ...
0
votes
1answer
15 views
How to loop through a LinkedIn API response?
I am retrieving connections via LinkedIn's API.
This is a sample of the response. All I want to do is loop through this using PHP, accessing first and last names. Should be simple, but I am ...
-5
votes
0answers
46 views
Nested arrays in PHP [on hold]
I want to create an array like this in a while loop in PHP:
$users = array(
array('username' => 'user1', 'email' => '[email protected]'),
array('username' => 'user2', 'email' => ...
0
votes
1answer
17 views
PDO FetchAll Array
I know that $stmt->fetchAll(PDO::FETCH_ASSOC); returns the result in an array to the variable, but how would you go around extracting the information from the array? Say the variable holds 3000 ...
2
votes
0answers
36 views
Adding values to an array works in script but not in function
I am trying to create an array in php to send to a function that I can use to receive user information.
The issue I am having is that the array is "duplicating" its values. This is a very basic ...
0
votes
4answers
44 views
arrays inside array - sort alphabetically
I have an array that contains many other arrays. The first item is a base64-encoded string and the second item is the real string.
How can i sort the array alphabetically based on the second string ?
...
0
votes
6answers
51 views
Increment php array with key value pairs in a loop
How do I increment(add more values) to an array with key value pairs in a loop.
$field['choices'] = array(
'custom' => 'My Custom Choice'
);
Let's says I want to add three more choices from ...
3
votes
5answers
112 views
+100
Can the for loop be eliminated from this piece of PHP code?
I have a range of whole numbers that might or might not have some numbers missing. Is it possible to find the smallest missing number without using a loop structure? If there are no missing numbers, ...
-3
votes
2answers
35 views
Store results of a php foreach loop as an array
I am using a foreach loop to generate a set of thumbnail links. I am using Wordpress and for one reason or another the place my PHP is executing is not the place I would like to render the list. So my ...
-2
votes
5answers
49 views
PHP key-value array push
$test = array (
"test1" => array("a" => "1", "b" => "2", "c" => "3")
);
I have an array like above.
ı want to push its values in a loop. How can it be possible ? Could you please ...