Search Results

Search found 42698 results on 1708 pages for 'php in array'.

Page 120/1708 | < Previous Page | 116 117 118 119 120 121 122 123 124 125 126 127  | Next Page >

  • Submtting data using $.ajax and retrieving values from $_POST array

    - by Linda Keating
    I'm having trouble retrieving my form Data that has been submitted via ajax like this: $( "form" ).on( "submit", function( event ) { var formData = $(this).serializeArray(); console.log("fomData"); $.ajax({ url: window.location.origin+ "/selfservicemanager/localtmfsetup/local_tmf_setup.php", type: "POST", data: JSON.stringify(formData), success : function (){ alert("success"); } }); }); I can see the data being sent over the network like this: But when I try to retrieve the data on the server side the $_POST array is empty. <?php var_dump($_POST); die(); ?> array (size=0) empty Any ideas? I've tried to stringify the data being sent, and also tried to decode the $_POST array but it expects a string.....

    Read the article

  • foreach with an array of stdclass objects

    - by Jared Steffen
    So, what I want to do is quite simple in my mind. I have an array that consists solely of four objects. I want to create a loop that will echo an attribute of each object in the array. The only success I've had, however, is echoing every object and every property of the objects. I've never dealt with objects so this is probably the TRUE root of the problem. There's been a few revisions but the only thing I've really excelled at is creating error codes. Here is what I have: $categories = get_categories(array('child_of' => '8')); foreach ($categories as $cat) { echo $cat->name; };

    Read the article

  • How to create two dimensional array in jquery or js

    - by learner
    I need to create dynamic global two dimensional array in jquery or javascript My function is like this <script> var index = 0; var globalArray = new Array(); function createArray(){ var loop = globalArray[index].length; var name = $.("#uname").val(); if(loop == 0){ globalArray[index][0] = uname; }else{ globalArray[index][loop++] = uname; } } </script> <div><input type="text" id="uname"> <input type='button' value='save' onclick='createArray();'> </div> On click of that button I am getting this error "globalArray[index] is undefined" How can I create one global array using jquery or javascript like this. I dont want any hidden field and all. Please help me. Thanks

    Read the article

  • Copy an array backwards? Array.Copy?

    - by daniel
    I have a List<T> that I want to be able to copy to an array backwards, meaning start from List.Count and copy maybe 5 items starting at the end of the list and working its way backwards. I could do this with a simple reverse for loop; however there is probably a faster/more efficient way of doing this so I thought I should ask. Can I use Array.Copy somehow? Originally I was using a Queue as that pops it off in the correct order I need, but I now need to pop off multiple items at once into an array and I thought a list would be faster.

    Read the article

  • Jquery get array details

    - by Matt
    I'm having trouble getting a response back from a Jquery ajax call... (It's a script to authenticate a user, and needs to return their name and user ID. My understanding was that I could encode it as JSON and get the data in the format below. It is returning an error of "undefined" for the alert(). The javascript $.ajax({ type: "POST", url: "myURL.php", data: {username: username, password: password}, success: function(results) { //THIS IS WHERE THE PROBLEM IS alert('Hi '+results.name); //Should be "Hi Basil Fawlty" } }); The PHP (myURL.php) //This comes from a SQL call that returns the following name json_encode(array( 'id'=>1, 'name'=>'Basil Fawlty' )); Any help or ideas on where I am going wrong would be greatly appreciated! Thanks.

    Read the article

  • Sending an array to a function in codeigniter

    - by Mozammil
    I have the following codes which sends an array to the function /chat in codeigniter $(document).ready(function () { $('#submit').live('click', function (eve) { eve.preventDefault(); $.ajax({ url: "http://localhost/fq/index.php/splash/chat/", type: 'POST', data: a, success: function (html) { alert(html); } }); }); Let us assume that array a contains names of people only. ( John, James, Smith) I want to be able to retrieve the all the values from the array in the function chat. How can it be done?

    Read the article

  • Converting a PHP array to class variables.

    - by animuson
    Simple question, how do I convert an associative array to variables in a class? I know there is casting to do an (object) $myarray or whatever it is, but that will create a new stdClass and doesn't help me much. Are there any easy one or two line methods to make each $key => $value pair in my array into a $key = $value variable for my class? I don't find it very logical to use a foreach loop for this, I'd be better off just converting it to a stdClass and storing that in a variable, wouldn't I? class MyClass { var $myvar; // I want variables like this, so they can be references as $this->myvar function __construct($myarray) { // a function to put my array into variables } }

    Read the article

  • help with accessing an array/object

    - by noname
    i have printed out the contents of an array/object (named 'document') with print_r. it looks like this: Array ( [0] => SimpleXMLElement Object ( [@attributes] => Array ( [id] => 7006276 ) [name] => Arnessysla [type] => region [latitude] => 64.5833 [longitude] => -21.8833 [entities] => SimpleXMLElement Object ( ) ) ) how do i get the 'entities' contents? i've tried this: $document[0]-attributes['entities'] but it didnt work!

    Read the article

  • Sorting Multidimensional Array with Javascript: Integers

    - by tkm256
    I have a 2D array called "results." Each "row" array in results contains both string and integer values. I'm using this script to sort the array by any "column" on an onclick event: function sort_array(results, column, direction) { var sorted_results = results.sort(value); function value(a,b) { a = a[column]; b = b[column]; return a == b ? 0 : (a < b ? -1*direction : 1*direction) } } This works fine for the columns with strings. But it treats the columns of integers like strings instead of numbers. For example, the values 15, 1000, 200, 97 would be sorted 1000, 15, 200, 97 if "ascending" or 97, 200, 15, 1000 "descending." I've double-checked the typeof the integer values, and the script knows they're numbers. How can I get it to treat them as such?

    Read the article

  • Deleting Part of An Array in Java to Free Memory on Heap

    - by kate
    I am implementing a dynamic programming algorithm for the knapsack problem in Java. I declare the array and then initialize its size to be [number of objects][capacity of knapsack]. When my number of objects or my capacity gets too large, I get a memory error because I run out of space on the heap. My questions is: If I delete rows from my double array as I go along, will Java free the memory as I delete? Or does Java reserve that memory space for the size of the array I originally created? If it's the latter, is there a way to manually free the memory in Java? Thanks for your Help!

    Read the article

  • php and XML range into array

    - by Mike
    The code below helps be to get the WHOLE XML and put it into an array. What I'm wondering is, what would be a good way to get the XML only from item 3 - 6 or any arbitrary range instead of the whole document. $mt_arr = array(); $d = new DOMDocument(); $d->load('http://news.google.com/?output=rss'); foreach ($d->getElementsByTagName('item') as $t) { $list = array ( 'title' => $t->getElementsByTagName('title')->item(0)->nodeValue); array_push($mt_arr, $list); } Thanks

    Read the article

  • Help me to break array

    - by Wazzy
    Please Help me getting only emails from this array Mentioning array not in code tags is intentional-Sorry for that array(16) { [0]=> string(273) ""guid":"","contactId":"44","contactName":"_, atri","email":"[email protected]","emaillink":"http:\/\/mrd.mail.yahoo.com\/compose?To=atri_megrez%40yahoo.com","isConnection":false,"connection":"","displayImg":null,"msgrID":"atri_megrez","msgrStatus":"","isMsgrBuddy":122}," [1]=> string(260) ""guid":"","contactId":"100","contactName":"afrin","email":"[email protected]","emaillink":"http:\/\/mrd.mail.yahoo.com\/compose?To=fida_cuty123%40yahoo.com","isConnection":false,"connection":"","displayImg":null,"msgrID":"","msgrStatus":"","isMsgrBuddy":false}," [2]=> string(258) ""guid":"","contactId":"101","contactName":"afrin","email":"[email protected]","emaillink":"http:\/\/mrd.mail.yahoo.com\/compose?To=waliyani%40yahoo.com","isConnection":false,"connection":"","displayImg":null,"msgrID":"","msgrStatus":"","isMsgrBuddy":false}," }

    Read the article

  • Compare string and array

    - by alex
    Hello all! I have an array and variable. If the variable does not exist in the array to be added, if there is - remove from the array. Why not work? $ar = ["a","b","c"]; $vr = "b"; foreach ($ar as $i => $value) { if ($value == $vr) { unset ($ar[$i]); } else { $ar[] = $vr; $ar = array_unique($ar); } } Thanks.

    Read the article

  • Create numbers within an array that add up to a set amount

    - by RussellDias
    I'm fairly new to PHP - programming in general. So basically what I need to accomplish is, create an array of x amount of numbers (created randomly) who's value add up to n: Lets say, I have to create 4 numbers that add up to 30. I just need the first random dataset. The 4 and 30 here are variables which will be set by the user. Essentially something like x = amount of numbers; n = sum of all x's combined; create x random numbers which all add up to n; $row = array(5, 7, 10, 8) // these add up to 30 Also, no duplicates are allowed. I need the values with an array. I have been messing around with it sometime, however, my knowledge is fairly limited. Any help will be greatly appreciated. Cheers

    Read the article

  • Passing an array of structures to an Oracle stored procedure (CFMX)

    - by Patti
    I'm looking to write a Oracle stored procedure where I would pass in (from ColdFusion) an array of structures and loop over each iteration to insert the bits and pieces within the structures to the DB., I haven't written this type of procedure / package before. I am planning to do an sp / package similar to what is sketched out in the second reply to this thread: How to pass a array of object to oracle stored procedure Assuming I do, how can I call the procedure from ColdFusion (I'm using MX) and pass in my array? As far as I can see, none of the CF_SQL_Types make sense.

    Read the article

  • PHP to make vars and values part of array

    - by Chris
    I currently have this function to search and replace in a text file. // Input $ect = array('Visssa', 'Lisssa', 'her'); // Placeholders in the file $put = array('lname', 'fname', 'hisher'); // Replace the placeholders $oput = str_replace($put, $ct, 'tmpfile.txt'); This is not the full program but the idea is replace the values found in tmpfile.txt with the ones found in the $etc array. And it works flawlessly. But, what I need to do is get all passed vars (get/post) and then make the arrays so that the var is the value to replace and the value is the value to replace it with. So, if I sent the url http://xyz.com/?lname=tom&ogre=yes All instances of lname in the file would be replaces with tom and all instances of ogre would be replaced with yes. So somehow it just gets any/all variables passed in get/post and then the arrays showed above would cause the var to be replaced by the value in the file.

    Read the article

  • An array of structures in C...

    - by 00010000
    For the life of me I can't figure out the proper syntax for creating an array of structures in C. I tried this: struct foo { int x; int y; } foo[][] = { { { 1, 2 }, { 4, 5 }, { -1, -1 } }, { { 55, 44 } { 100, 200 }, } }; So for example foo[1][0].x == 100, foo[0][1].y == 5, etc. But GCC spits out a lot of errors. If anyone could provide the proper syntax that'd be great. EDIT: Okay, I tried this: struct foo { const char *x; int y; }; struct foo bar[2][] = { { { "A", 1 }, { "B", 2 }, { NULL, -1 }, }, { { "AA", 11 }, { "BB", 22 }, { NULL, -1 }, }, { { "ZZ", 11 }, { "YY", 22 }, { NULL, -1 }, }, { { "XX", 11 }, { "UU", 22 }, { NULL, -1 }, }, }; But GCC gives me "elements of array bar have incomplete type" and "excess elements in array initializer".

    Read the article

  • C: Why does gcc allow char array initialization with string literal larger than array?

    - by Ashwin
    int main() { char a[7] = "Network"; return 0; } A string literal in C is terminated internally with a nul character. So, the above code should give a compilation error since the actual length of the string literal Network is 8 and it cannot fit in a char[7] array. However, gcc (even with -Wall) on Ubuntu compiles this code without any error or warning. Why does gcc allow this and not flag it as compilation error? gcc only gives a warning (still no error!) when the char array size is smaller than the string literal. For example, it warns on: char a[6] = "Network"; [Related] Visual C++ 2012 gives a compilation error for char a[7]: 1>d:\main.cpp(3): error C2117: 'a' : array bounds overflow 1> d:\main.cpp(3) : see declaration of 'a'

    Read the article

  • Updating multiple rows with an array

    - by Copephobia
    I have a table that holds user information. One of the columns holds the position of the user in the game they are in. When a game is being created, I need to update the positions of the users of each team. Here is an example: Game id : 7 Team 1 users : 1,2 Team 2 users : 3,4 team1_position : array(1,2) team2_position : array(13,14) What I want to do is update the user table using the array of positions in the SET area. My goal is to be able to update the users without the need for their id (I have different size game boards, so I have multiple position arrays for each board size) How can I do something like this: UPDATE user SET position='(team1_position)' WHERE game = '7' AND team = '1' I feel like it would be a waste of resources to select all the id's of each team and update them separately.

    Read the article

  • PHP Network Monitoring

    - by Vlad Patrascu
    Is there a way that I can monitor the traffic, Upload/Download (separately) using PHP? I`d like to echo out something like that: Upload: 523 GB | Download: 25 GB This should be based on the System Uptime, so if I restart the computer, the count should restart. Thanks in Advance.

    Read the article

  • PHP bcompiler install

    - by dobs
    How to install bcompiler on Fedora, have this error: [root@server server]# pecl install channel://pecl.php.net/bcompiler-0.9.1 downloading bcompiler-0.9.1.tgz ... Starting to download bcompiler-0.9.1.tgz (47,335 bytes) .............done: 47,335 bytes 10 source files, building running: phpize Configuring for: PHP Api Version: 20090626 Zend Module Api No: 20090626 Zend Extension Api No: 220090626 building in /var/tmp/pear-build-server/bcompiler-0.9.1 running: /var/tmp/bcompiler/configure checking for grep that handles long lines and -e... /bin/grep checking for egrep... /bin/grep -E checking for a sed that does not truncate output... /bin/sed checking for cc... cc checking whether the C compiler works... yes checking for C compiler default output file name... a.out checking for suffix of executables... checking whether we are cross compiling... no checking for suffix of object files... o checking whether we are using the GNU C compiler... yes .... /var/tmp/bcompiler/bcompiler.c:2174: ?????????: expected ‘struct zend_arg_info *’ but argument is of type ‘const struct _zend_arg_info *’ /var/tmp/bcompiler/bcompiler.c: ? ??????? ‘apc_serialize_zend_class_entry’: /var/tmp/bcompiler/bcompiler.c:3100: ??????????????: ???????????? ???????? ????????????? ?????????? ???? /var/tmp/bcompiler/bcompiler.c:3107: ??????????????: ???????? ????????? 1 ‘apc_serialize_zend_function_entry’ ???????? ????????????? ?????????? ???? /var/tmp/bcompiler/bcompiler.c:2874: ?????????: expected ‘struct zend_function_entry *’ but argument is of type ‘const struct _zend_function_entry *’ /var/tmp/bcompiler/bcompiler.c: ? ??????? ‘apc_deserialize_zend_class_entry’: /var/tmp/bcompiler/bcompiler.c:3324: ??????????????: ???????? ????????? 1 ‘apc_deserialize_zend_function_entry’ ???????? ????????????? ?????????? ???? /var/tmp/bcompiler/bcompiler.c:2900: ?????????: expected ‘struct zend_function_entry *’ but argument is of type ‘const struct _zend_function_entry *’ make: *** [bcompiler.lo] ?????? 1 ERROR: 'make' failed yum install bzip2-libs bzip2-devel - Fix it...

    Read the article

  • Mac Os X 10.7 + PHP OCI8 + MAMP PRO

    - by Mike
    i followed this article: http://www.enavigo.com/2012/01/04/enabling-oracle-oci8-php-extension-on-os-x-snow-leopard/ and im getting this error: Error 324 (net::ERR_EMPTY_RESPONSE): The server closed the connection without sending any data. Anytime i try to connect to an oracle database using OCI8. I'm not sure that oci8 is install properly. Can someone provide steps for installation of OCI8 using Mamp Pro?

    Read the article

  • Mac Os X 10.7 + PHP OCI8 + MAMP PRO + ERR_EMPTY_RESPONSE

    - by gorelative
    i followed this article: http://www.enavigo.com/2012/01/04/enabling-oracle-oci8-php-extension-on-os-x-snow-leopard/ and im getting this error: Error 324 (net::ERR_EMPTY_RESPONSE): The server closed the connection without sending any data. Anytime i try to connect to an oracle database using OCI8. I'm not sure that oci8 is install properly. Can someone provide steps for installation of OCI8 using Mamp Pro?

    Read the article

  • downgrade PHP 5.3 to 5.2 on lenny

    - by Ron
    Unfortunately I did upgrade PHP to version 5.3, but it end up breaking up some web apps, now I'm trying to go back to 5.2. I removed both sources php53.dotdeb.org from /etc/apt/sources.list and I did apt-get update && apt-get upgrade, but it didn't downgrade anything. Any ideas on how to go back will be appreciated Thanks

    Read the article

  • What files to backup on Lighttpd+MySQL+PHP server

    - by Tomaszs
    I have a VPS with CentOS 5. I would like to create backup of: all my config files tweaks of database, php, server a databases cron settings website files installed applications and their settings (?) What files should i take into account? I don't want to miss any file that will be necessary to restore fast my webserver in case of any failure. And I don't want to create whole backup because entire VPS has like 30 GB of data.

    Read the article

< Previous Page | 116 117 118 119 120 121 122 123 124 125 126 127  | Next Page >