Search Results

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

Page 146/1708 | < Previous Page | 142 143 144 145 146 147 148 149 150 151 152 153  | Next Page >

  • PHP display progress messages on the fly

    - by XaviEsteve
    Hi everyone, I am working in a tool in PHP that processes a lot of data and takes a while to finish. I would like to keep the user updated with what is going on and the current task processed. What is in your opinion the best way to do it? I've got some ideas but can't decide for the most effective one: The old way: execute a small part of the script and display a page to the user with a Meta Redirect or a JavaScript timer to send a request to continue the script (like /script.php?step=2). Sending AJAX requests constantly to read a server file that PHP keeps updating through fwrite(). Same as above but PHP updates a field in the database instead of saving a file. Does any of those sound good? Any ideas? Thanks!

    Read the article

  • how to make PHP lists all Linux Users?

    - by Data-Base
    Hello I want to build a php based site that (automate) some commands on my Ubuntu Server first thing I did was going to the file (sudoers) and add the user www-data so I can execute php commands with root privileges! # running the web apps with root power!!! www-data ALL=(ALL) NOPASSWD: ALL then my PHP code was <?php $command = "cat /etc/passwd | cut -d\":\" -f1"; echo 'running the command: <b>'.$command."</b><br />"; echo exec($command); ?> it returns only one user (the last user) !!! how to make it return all users? thank you

    Read the article

  • jQuery, Ajax & PHP submit multiple forms dilemma

    - by user557563
    This is a very simple form that I have found on the web (as I am a jQuery beginner). <!-- this is my jquery --> <script> $(document).ready(function(){ $("form#submit_wall").submit(function() { var message_wall = $('#message_wall').attr('value'); var id = $('#id').attr('value'); $.ajax({ type: "POST", url: "index.php?leht=pildid", data:"message_wall="+ message_wall + "&id="+ id, cache: false, success: function(){ $("ul#wall").prepend(""+message_wall+"", ""+id+""); $("ul#wall li:first").fadeIn(); alert("Thank you for your comment!"); } }); return false; }); }); </script> <!-- this is my HTML+PHP --> some PHP ... while($row_pilt = mysql_fetch_assoc($select_pilt)){ print <form id="submit_wall"> <label for="message_wall">Share your message on the Wall</label> <input type="text" id="message_wall" /> <input type="hidden" id="id" value="'.(int)$row_pilt['id'].'"> <button type="submit">Post to wall</button> </form> and down below is my PHP script that writes to mySQL. It is a pretty straight forward script. However, it is getting little complicated when I submit it. Since I have more than one form on my page (per WHILE PHP LOOP), thus when I submit - only the FIRST form gets submitted. Furthermore, any other subsequent forms that I submit - data is being copied from the first form. Is there any jQuery functions that clear the data? - or is there a better solution. Thanks, Nick

    Read the article

  • Why won't my PHP script work?

    - by sadicool
    I have a script that reports the following error: Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'admin'@'localhost' (using password: YES) in C:\wamp\www\bits\includes\connect.inc.php on line 10 Notice: Undefined variable: l_error in C:\wamp\www\bits\includes\connect.inc.php on line 12 Notice: Undefined variable: l_cannotconnecttodatabase in C:\wamp\www\bits\includes\connect.inc.php on line 12 Why would this be?

    Read the article

  • Loop through Array with conditional output based on key/value pair

    - by Daniel C
    I have an array with the following columns: Task Status I would like to print out a table that shows a list of the Tasks, but not the Status column. Instead, for Tasks where the Status = 0, I want to add a tag <del> to make the completed task be crossed out. Here's my current code: foreach ($row as $key => $val){ if ($key != 'Status') print "<td>$val</td>"; else if ($val == '0') print "<td><del>$val</del></td>"; } This seems to be correct, but when I print it out, it prints all the tasks with the <del> tag. So basically the "else" clause is being run every time. Here is the var_dump($row): array 'Task' => string 'Task A' (length=6) 'Status' => string '3' (length=1) array 'Task' => string 'Task B' (length=6) 'Status' => string '0' (length=1)

    Read the article

  • MySQL, PHP, and Apache errors while connecting to DB

    - by cypherdelton
    I'm having two errors when I test the "mysql_connect()" function in php. I just installed PHP and MySQL from scratch. These errors may be related, so I will post them both here: Warning: mysql_connect() [function.mysql-connect]: Headers and client library minor version mismatch. Headers:50158 Library:50518 in /usr/local/apache2/htdocs/index.php on line 6 Warning: mysql_connect() [function.mysql-connect]: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) in /usr/local/apache2/htdocs/index.php on line 6 Many websites say to start the mysql server if you are getting error #2. Whenever I execute the command mysqld start --user=mysql I get the error "mysqld: Too many arguments (first extra is 'start'); Adding the "&" to the end of the command makes no difference (I don't know if it is supposed to). Thanks, Cypher Delton

    Read the article

  • "Distance" between colours in PHP

    - by Phil
    I'm looking for a function that can accurately represent the distance between two colours as a number or something. For example I am looking to have an array of HEX values or RGB arrays and I want to find the most similar colour in the array for a given colour eg. I pass a function a RGB value and the 'closest' colour in the array is returned

    Read the article

  • javascript send one way message to php

    - by user360322
    How can I use javascript to send a one way message to php? I would like to get the browser information from javascript and just send it to php in the background. I know I can get some of this from php, but I'd rather use javascript. Is there a way to do this without a framework like jquery?

    Read the article

  • Broken php/localhost/something

    - by ghego1
    I was trying to install the mcrypt libraries following this tutorial (http://www.glenscott.co.uk/blog/2011/08/29/install-mcrypt-php-extension-on-mac-os-x-lion/), but something must have gone wrong and now when I load a php page on my localhost I see this: query="SELECT DISTINCT ".$field." as a,".$field2." as b FROM ".$tab." ".$where. " Group by ".$field." order By ".$orderBy; return $this->query; } And all the remaining code of the php page that should get loaded. I've retrieved the previous versions of the private/etc folder and usr/lib/php folder with time machine but it didn't help. And now if I execute sudo pachectl restart it gives me this error: sudo: no valid sudoers sources found, quitting (while before it worked. PS I'm on a mac with Mountain Lion

    Read the article

  • I want the actual file name that is returned by a PHP script

    - by Aymon Fournier
    I am writing a python script that downloads a file given by a URL. Unfortuneatly the URL is in the form of a PHP script i.e. www.website.com/generatefilename.php?file=5233 If you visit the link in a browser, you are prompted to download the actual file and extension. I need to send this link to the downloader, but I can't send the downloader the PHP link. How would I get the full file name in a usable variable?

    Read the article

  • Possibly simple PHP/MYSQL issue with retrieving and showing data

    - by envoys
    I have been racking my brains over this for a while now. Here is the data i have in the sql data base as an example: ID | TYPE | DATA 1 | TXT | TEST 2 | PHP | php 3 | JS | JAVASCRIPT That is just an example, there are multiple listing for TXT, PHP and JS throughout the table. What I want to do is retrive all the data and display it all into separate drop down/select boxes. Meaning, select box one would list all data with type TXT, select box two would list all data with type PHP and select box 3 would list all data with type JS. The only way I have came about doing this is doing individual sql queries for each different type. I know there is a way to do it all in 1 query and then display it the way I want to but I just can't seem to figure out how and I know its going to drive me nuts when someone helps and I see just how they did it. Thanks for the input.

    Read the article

  • Need help INSERT record(s) MySQL DB

    - by JM4
    I have an online form which collects member(s) information and stores it into a very long MySQL database. We allow up to 16 members to enroll at a single time and originally structured the DB to allow such. For example: If 1 Member enrolls, his personal information (first name, last name, address, phone, email) are stored on a single row. If 15 Members enroll (all at once), their personal information are stored in the same single row. The row has information housing columns for all 'possible' inputs. I am trying to consolidate this code and having every nth member that enrolls put onto a new record within the database. I have seen sugestions before for inserting multiple records as such: INSERT INTO tablename VALUES (('$f1name', '$f1address', '$f1phone'), ('$f2name', '$f2address', '$f2phone')... The issue with this is two fold: I do not know how many records are being enrolled from person to person so the only way to make the statement above is to use a loop The information collected from the forms is NOT a single array so I can't loop through one array and have it parse out. My information is collected as individual input fields like such: Member1FirstName, Member1LastName, Member1Phone, Member2Firstname, Member2LastName, Member2Phone... and so on Is it possible to store information in separate rows WITHOUT using a loop (and therefore having to go back and completely restructure my form field names and such (which can't happen due to the way the validation rules are built.)

    Read the article

  • Filling array with numbers

    - by Ockonal
    Hello, I have such situation: There is 8 div-blocks with ids like 'rateN_wrapper' where is 'N' is the number of div: <div id="rate1_wrapper"> <a href="#" id="0_1">...</a> <a href="#" id="0_2">...</a> <a href="#" id="0_3">...</a> </div> <div id="rate2_wrapper"> <a href="#" id="1_1">...</a> <a href="#" id="1_2">...</a> <a href="#" id="1_3">...</a> </div> ... var ratings = new Array(); for (i=0; i < 8; i++) { ratings[i] = -1; // Default is unrated } for (i=0; i < 8; i++) { $('#rate' + i + '_wrapper a').click(function() { ratings[i] = parseInt( $(this).attr('id').split('_')[1] ); console.debug(ratings); }); } My work is to fill array in need place with clicked link's id (parsed). But it's always changes only latest element of array (8). Why?

    Read the article

  • Remove array elements that are less than X

    - by GGio
    I have arrays: $arr1 = array(5, 3, 9, 11, 6, 15); $arr2 = array(11, 20, 1, 3, 8); Now I need to loop through $arr1 and find the largest number that is less than X: foreach($arr1 as $x) { //need element that is MAX in $arr2 but is less than $x } so for example for the first run when $x = 5, maximum in $arr2 is 3 that is less than 5. Is it possible to do this without having nested loop? I do not want to loop through $arr2. I tried using array_filter but didnt really work. Maybe I used it wrong. This is what I tried with array_filter: $results = array(); foreach($arr1 as $x) { $max = max(array_filter($arr2, function ($x) { return $x < $y; })); $results[$x] = $max; } The result should be this: 5 => 3, 3 => 1, 9 => 8, 11 => 8, 6 => 3, 15 => 11

    Read the article

  • Google app engine-php: script handler

    - by Eve
    I try to create php web app using GAE. In the GAE tutorial, "A script handler executes a PHP script to handle the request that matches the URL pattern. The mapping defines a URL pattern to match, and the script to be executed" Now I want to map the url with the file having same name in the folder, e.g. if the url is /hello.* , it will map the file name hello.php in the folder. And if it is /hello1.*, hello1.php in the folder will be responded to the server. I thought this should be done directly by mapping the name of the url with the name in the folder. But if I left empty for the handler in the app.yaml, I got an error. So I want to know how to set up the handler in app.yaml?

    Read the article

  • trying to use PHP extract() within a function

    - by samuelf
    Hi, I have the two following files: main.php include("functions.php") __EXTRACT(); echo $testvar; functions.php function __EXTRACT(){ extract($_POST, EXTR_SKIP); } However, having a form with a textbox called testvar I can't get the extract function to extract the data.. if I remove the function call and insert it the extract statement directly into main.php it works. The include is not a problem as other functions in it works. Any ideas? Cheers

    Read the article

  • Adding images to an array memory issue

    - by Friendlydeveloper
    Hello all, I'm currently facing the following issue: My app dynamically creates images (320 x 480 pixels) and adds them to a NSMutableArray. I need those images inside that array in order to allow users to browse through them back and forth. I only need to keep the latest 5 images. So I wrote a method like below: - (void)addImageToArray:(UIImage*)theImage { if ([myMutableArray count] < 5) { [myMutableArray addObject:theImage]; } else { [myMutableArray removeObjectAtIndex:0]; [myMutableArray addObject:theImage]; } } This method basically does what it's supposed to do. However, in instruments I can see, that memory usage is permanently incrementing. At some point, even though I do not have any memory leaks, the app finally crashes. The way I see it, XCode does remove the image from my array, but does not release it. Is there a way I can make sure, that the object I want to remove from my array will also get released? Maybe my approach is completely wrong and I need to find a different way. Any help appreciated. Thanks in advance

    Read the article

  • Execute PHP file in background

    - by Spyric
    I have some php code, that execute for a very long time. I need to realise next scheme: User enter on some page(page 1) This page starts execution of my large PHP script in background .(Every change is writting to database) We sent every N seconds query to database to get current status of execution. I don't want to use exec command because 1000 users makes 1000 php processes. It's not way for me...

    Read the article

  • PHP Localhost Application connect to server database

    - by Cross Vander
    I want to ask about how to connect my localhost application (C:xampp/htdocs/myproject) to database at my server host (www.someweb.somedomain)? Am I possible to do that? If it is, how to connect it at my php config? Right now my config (server.php) is: <?php $host = "my web IP public:3306"; $user = "root"; $pass = ""; $db = "dispatcherDB"; $conn = mysql_connect($host, $user, $pass) or die ("Cant connect to mySQL"); mysql_select_db($db); ?> what I got: Warning: mysql_connect(): No connection could be made because the target machine actively refused it. in C:\xampp\htdocs\XMS\server.php on line 7 So, what must I filled for $host? I'm trying using website IP, it still can't connect. Maybe there's someone here have experience at this problem? Sorry for my bad English

    Read the article

  • Substr from end of string php?

    - by Gorostas
    I have this kind of array, i will make it very simple to understand $picture = ( 'artist2-1_thumb.jpg', 'artist2-2.jpg' , 'artist2-3_thumb.jpg', 'artist2-4.jpg', 'artist2-5_thumb.jpg'); Now i want use substr to get new array that only have thumb, to have new array like this $picturethumbs = ( 'artist2-1_thumb.jpg', 'artist2-3_thumb.jpg', 'artist2-5_thumb.jpg'); Can some substr but where to start?

    Read the article

< Previous Page | 142 143 144 145 146 147 148 149 150 151 152 153  | Next Page >