Search Results

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

Page 59/1708 | < Previous Page | 55 56 57 58 59 60 61 62 63 64 65 66  | Next Page >

  • Get node content from xml file and transform it into php array?

    - by Kirzilla
    Hello, I'm looking for solution to extract some node from large xml file (using xmlstarlet http://xmlstar.sourceforge.net/) and then parse this node to php array. elements.xml <?xml version="1.0"?> <elements> <element id="1" par1="val1_1" par2="val1_2" par3="val1_3"> <title>element 1 title</title> <description>element 1 description</description> </element> <element id="2" par1="val2_1" par2="val2_2" par3="val2_3"> <title>element 2 title</title> <description>element 2 description</description> </element> </elements> To extract element tag with id="1" using xmlstarlet I'm executing this shell command... xmlstarlet sel -t -c "/elements/element[id=1]" elements.xml This shell command outputs something like this... <element id="1" par1="val1_1" par2="val1_2" par3="val1_3"> <title>element 1 title</title> <description>element 1 description</description> </element> How could I parse this shell output into php array? Thank you.

    Read the article

  • Include error in writing html file from php

    - by Grozav Alex Ioan
    I seem to have some problem with my code here. It creates a file from the php file, but I get an error on the include path. include('../include/config.php'); $name = ($_GET['createname']) ? $_GET['createname'] : $_POST['createname']; function buildhtml($strphpfile, $strhtmlfile) { ob_start(); include($strphpfile); $data = ob_get_contents(); $fp = fopen ($strhtmlfile, "w"); fwrite($fp, $data); fclose($fp); ob_end_clean(); } buildhtml('portfolio.php?name='.$name, "../gallery/".$name.".html"); The problem seems to be here: 'portfolio.php?name='.$name Any way I can replace this, and still send the variable over? Here's the error I get when I put ?name after the php extension: Warning: include(portfolio.php?name=hyundai) [function.include]: failed to open stream: No such file or directory in D:\Projects\Metro Web\Coding\admin\create.php on line 15 Warning: include(portfolio.php?name=hyundai) [function.include]: failed to open stream: No such file or directory in D:\Projects\Metro Web\Coding\admin\create.php on line 15 Warning: include() [function.include]: Failed opening 'portfolio.php?name=hyundai' for inclusion (include_path='.;C:\php\pear') in D:\Projects\Metro Web\Coding\admin\create.php on line 15

    Read the article

  • Unable to render php files in browser

    - by p1
    Hello, I am very new to php, and I am trying to develop a facebook application using php. I am using Joyent as my hosting platform. Currently, I am trying to do some simple scripts in php and then build on them. However I am unable to see any php files being rendered properly in my application. For eg: I have a simple script called phpinfo.php: If I execute this on terminal like php phpinfo.php , I can see all the configurations. However if I try to access the same file as http://xxxxxx.facebook.joyent.us/phpinfo.php, I get : Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request. Even if I rename this file to index.php its still the same. However I am able to access other html files [index.html] on the same location . These are some of my php settings: These are some of the settings: [fbkusoni:~/web/public] aafhe7vh$ php phpinfo.php | grep On allow_url_fopen = On = On auto_globals_jit = On = On enable_dl = On = On file_uploads = On = On ignore_repeated_errors = On = On ignore_repeated_source = On = On implicit_flush = On = On log_errors = On = On register_argc_argv = On = On report_memleaks = On = On y2k_compliance = On = On Multibyte regex (oniguruma) backtrack check = On mysql.allow_persistent = On = On session.bug_compat_warn = On = On session.use_cookies = On = On suhosin.cookie.cryptdocroot = On = On suhosin.cookie.cryptua = On = On suhosin.mt_srand.ignore = On = On suhosin.protectkey = On = On suhosin.server.encode = On = On suhosin.server.strip = On = On suhosin.session.cryptdocroot = On = On suhosin.session.cryptua = On = On suhosin.session.encrypt = On = On suhosin.srand.ignore = On = On suhosin.stealth = On = On The answer might be very naive, but I am just trying to get started and looking for any suggestions regarding this and also using Joyent and cakephp to develop facebook applications. Thanks.

    Read the article

  • PHP foreach loop through multidimensional array

    - by Muiter
    I have an multidimensional array, how can I use it? I want to use each seperate array in an for loop. I have this code <?php foreach ($calculatie_id[$i] as $value) { echo $value; } ? print_r($calculatie_id); gives Array ( [0] = Array ( [0] = 4 [1] = 6 ) [1] = Array ( [0] = 1 [1] = 5 ) [2] = Array ( [0] = 5 [1] = 6 ) [3] = ) But when using the foreach I only get 46

    Read the article

  • Wear and tear on server hard drive from filesystem polling by PHP script

    - by jackie
    So I'm working on a discussion platform, and various clients will visit http://host/thread.php, which will render the discussion thread to date in addition to a form to submit a new post. When a new post is submitted, I would like all of the other clients with browser windows open to have it appear in near-real-time. One of the constraints of my script is that it may not use a DBMS and it must stay in the filesystem. Additionally, I can't use any PECL/PEAR extensions like inotify or anything like that for IPC. The flow will look like this: Client A requests thread.php and the thread is so far empty, but nonetheless it opens a Server-Side Event at eventPusher.php. Client B does the same. Client A fills out a post in the form and and submits (POSTs) it to subHandler.php. ??? (subHandler stores the new submission into the main thread storefile which gets read from when a fresh, new client requests thread.php, in addition to somehow signalling to the continually-running eventPusher event-source that a new comment was posted and that it should echo the event-json to the client. How, exactly, it will send this signal I'm yet unsure of, but there are a few options that I've thought of -- this is the crux of the question, so see below for more clarification) eventPusher.php happily pushes the new event to the client and it shows up soon after it was originally submitted on all clients who have the page open's screens. Now for the #4 missing-link mystery-step, I see a few problems. I mean, either way, eventPusher is gonna be doing a while loop of some sort -- it's gonna be polling something, I think that much is clear. (If that's a bad assumption please do let me know.) Now, the simplest way would be subHandler gets invoked on the form submission, writes it to the main store in addition to newComments.xml, then exits without doing anything else. Then eventPusher checks in newComments.xml every X seconds (by the way, what would be a reasonable time interval here?) and if it finds something then it emits an event to the client. Now, my fear with this is that the server's hard drive will have to constantly start spinning up. Maybe this isn't the case, perhaps it would just get cached in RAM and the linux kernel would take care of this transparently such that filesystem access doesn't actually engage the device because the kernel knows that that particular file hasn't changed since last read. * idea #2: I have no idea how to go about this, but perhaps there is a variable scope that gets stored in general RAM on the system which can be read by any process. Like if we mega-exported a bash variable so that $new_post is normally false but it gets toggled to true by subHandler, and then back to flase once it's pushed to the client. I doubt there's such a variable scope in PHP directly, but I struggle with the concept of variable scope, I just can't seem to understand it no matter what I read on it. * idea #3: eventPusher queries ps in its whileloop for another instance of itself. If there's not another eventPusher active then it's highly unlikely that new comments will be getting submitted. It's okay if this only works =90% of the time, it doesn't need to be completely foolproof. * idea #4: eventPusher queries DMESG to see if that file's been written to recently. So to sum everything up, I need to have inter-php-script-communication in near-real-time that will work on a standard mod_php shared hosting setup without any elevated privileges, PHP addon modules, or other system adjustments that can't be done from the PHP script itself at runtime. With*out* spinning up the drive more than a few times. No SQL servers either. Apologies if my english isn't the best, I'm still trying to improve on it.

    Read the article

  • define keys in multidimensional array from csv

    - by mourique
    I want to compare two arrays, one coming from a shoppingcart and the other one parsed from a csv-file. The array from the shopping cart looks like this: Array ( [0] => Array ( [id] => 7 [qty] => 1 [price] => 07.39 [name] => walkthebridge [subtotal] => 7.39 ) [1] => Array ( [id] => 2 [qty] => 1 [price] => 07.39 [name] => milkyway [subtotal] => 7.39 ) ) The array from my csv-file however looks like this Array ( [0] => Array ( [0] => 1 [1] => walkthebridge [2] => 07.39 ) [1] => Array ( [0] => 2 [1] => milkyway [2] => 07.39 ) ) and is build using this code $checkitems = array(); $file = fopen('checkitems.csv', 'r'); while (($result = fgetcsv($file)) !== false) { $checkitems[] = $result; } fclose($file); how can i get the keys in the second array to match those in the first one? ( So that 0 would be id, and 1 would be name and so on) thanks in advance

    Read the article

  • imageconvolution leaves black dot in the upper left corner

    - by Peter O.
    I'm trying to sharp resized images using this code: imageconvolution($imageResource, array( array( -1, -1, -1 ), array( -1, 16, -1 ), array( -1, -1, -1 ), ), 8, 0); When the transparent PNG image is sharpened, using code above, it appears with a black dot in the upper left corner (I have tried different convolution kernels, but the result is the same). After resizing the image looked OK. 1st image is the original one 2nd image is the sharpened one EDIT: What am I going wrong? I'm using the color retrieved from pixel. $color = imagecolorat($imageResource, 0, 0); imageconvolution($imageResource, array( array( -1, -1, -1 ), array( -1, 16, -1 ), array( -1, -1, -1 ), ), 8, 0); imagesetpixel($imageResource, 0, 0, $color); Is imagecolorat the right function? Or is the position correct? EDIT2: I have changed coordinates, but still no luck. I've check the transparency given by imagecolorat (according to this post). This is the dump: array(4) { red => 0 green => 0 blue => 0 alpha => 127 } Alpha 127 = 100% transparent. Those zeroes might cause the problem...

    Read the article

  • New to php and need to format a php page from html statement

    - by Peter D
    My problem is the page shows a vertical line of options. I want to put them into a 4 column table to display instead of just down lhs of page. The code I want to change is as follows: </tr> <tr> <td>{LOOP: JOBTYPE} IF("{JOBTYPE.parent_id}"!="0"){&nbsp; {:IF} IF("{JOBTYPE.catcount}"=="0"){<input type="checkbox" name="jobtype[{JOBTYPE.id}]" value="{JOBTYPE.id}" {JOBTYPE.selected}>{JOBTYPE.title}<br>{:IF} IF("{JOBTYPE.catcount}"!="0"){<strong>{JOBTYPE.title}</strong><br>{:IF} {/LOOP: JOBTYPE}</td> </tr> <tr> <td>&nbsp;</td> </tr> As you can see I have another column there and can split cell further but i would like the job list to be displayed accross the page not vertically. Thank you in advance, Peter

    Read the article

  • In C, as free() knows an array size, why isn't there a function that gets the array size? [closed]

    - by user354959
    Possible Duplicate: If free() knows the length of my array, why can’t I ask for it in my own code? Searching around (including here at stackoverflow), I got that malloc() allocates an array and also creates a header to control the array info. In this header, there's also the array size. free() use such information to know how to deallocate that array. So, if the array size info is "there" (somewhere in the memory), why there isn't a function that returns an array size, looking for this at the array header? Or am I missing something?

    Read the article

  • How to retreive a array value in magento

    - by Fero
    For example i need to retrieve a value from this session. How should i do ? Exactly i need to get the "customer_log_id". > Array ( > [core] => Array > ( > [_session_validator_data] => Array > ( > [remote_addr] => 127.0.0.1 > [http_via] => > [http_x_forwarded_for] => > [http_user_agent] => Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.5) Gecko/2008120122 Firefox/3.0.5 > ) > > [session_hosts] => Array > ( > [127.0.0.1] => 1 > ) > > [messages] => Mage_Core_Model_Message_Collection > Object > ( > [_messages:protected] => Array > ( > ) > > [_lastAddedMessage:protected] => > ) > > [visitor_data] => Array > ( > [] => > [server_addr] => 2130706433 > [remote_addr] => 2130706433 > [http_secure] => > [http_host] => 127.0.0.1 > [http_user_agent] => Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.5) Gecko/2008120122 Firefox/3.0.5 > [http_accept_language] => > en-us,en;q=0.5 > [http_accept_charset] => > ISO-8859-1,utf-8;q=0.7,*;q=0.7 > [request_uri] => /currentproject/magento/index.php/customer/account/ > [session_id] => 34989ee1673caefec0d887dd41198587 > [http_referer] => http://127.0.0.1/currentproject/magento/index.php/customer/account/login/ > [first_visit_at] => 2009-12-04 11:20:24 > [is_new_visitor] => > [last_visit_at] => 2009-12-04 11:32:26 > [visitor_id] => 208 > [last_url_id] => 1399 > [catalog_compare_items_count] => 0 > [do_customer_login] => > [customer_id] => 1 > [customer_log_id] => 8 > ) > > [last_url] => http://127.0.0.1/currentproject/magento/index.php/customer/account/index/ > [just_voted_poll] => > ) > > [_cookie_revalidate] => 1259926524 > [customer_base] => Array > ( > [_session_validator_data] => Array > ( > [remote_addr] => 127.0.0.1 > [http_via] => > [http_x_forwarded_for] => > [http_user_agent] => Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.5) Gecko/2008120122 Firefox/3.0.5 > ) > > [session_hosts] => Array > ( > [127.0.0.1] => 1 > ) > > [messages] => Mage_Core_Model_Message_Collection > Object > ( > [_messages:protected] => Array > ( > ) > > [_lastAddedMessage:protected] => > ) > > [id] => 1 > ) > > [checkout] => Array > ( > [_session_validator_data] => Array > ( > [remote_addr] => 127.0.0.1 > [http_via] => > [http_x_forwarded_for] => > [http_user_agent] => Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.5) Gecko/2008120122 Firefox/3.0.5 > ) > > [session_hosts] => Array > ( > [127.0.0.1] => 1 > ) > > [quote_id_1] => > ) > > [catalog] => Array > ( > [_session_validator_data] => Array > ( > [remote_addr] => 127.0.0.1 > [http_via] => > [http_x_forwarded_for] => > [http_user_agent] => Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.5) Gecko/2008120122 Firefox/3.0.5 > ) > > [session_hosts] => Array > ( > [127.0.0.1] => 1 > ) > > [messages] => Mage_Core_Model_Message_Collection > Object > ( > [_messages:protected] => Array > ( > ) > > [_lastAddedMessage:protected] => > ) > > ) > > [newsletter] => Array > ( > [_session_validator_data] => Array > ( > [remote_addr] => 127.0.0.1 > [http_via] => > [http_x_forwarded_for] => > [http_user_agent] => Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.5) Gecko/2008120122 Firefox/3.0.5 > ) > > [session_hosts] => Array > ( > [127.0.0.1] => 1 > ) > > ) > > ) Thank n advance FEro

    Read the article

  • Finding a list of indices from master array using secondary array with non-unique entries

    - by fideli
    I have a master array of length n of id numbers that apply to other analogous arrays with corresponding data for elements in my simulation that belong to those id numbers (e.g. data[id]). Were I to generate a list of id numbers of length m separately and need the information in the data array for those ids, what is the best method of getting a list of indices idx of the original array of ids in order to extract data[idx]? That is, given: a=numpy.array([1,3,4,5,6]) # master array b=numpy.array([3,4,3,6,4,1,5]) # secondary array I would like to generate idx=numpy.array([1,2,1,4,2,0,3]) The array a is typically in sequential order but it's not a requirement. Also, array b will most definitely have repeats and will not be in any order. My current method of doing this is: idx=numpy.array([numpy.where(a==bi)[0][0] for bi in b]) I timed it using the following test: a=(numpy.random.uniform(100,size=100)).astype('int') b=numpy.repeat(a,100) timeit method1(a,b) 10 loops, best of 3: 53.1 ms per loop Is there a better way of doing this?

    Read the article

  • How to handle array element between int and Integer

    - by masato-san
    First, it is long post so if you need clarification please let me know. I'm new to Java and having difficulty deciding whether I should use int[] or Integer[]. I wrote a function that find odd_number from int[] array. public int[] find_odd(int[] arr) { int[] result = new int[arr.length]; for(int i=0; i<arr.length; i++) { if(arr[i] % 2 != 0) { //System.out.println(arr[i]); result[i] = arr[i]; } } return result; } Then, when I pass the int[] array consisting of some integer like below: int[] myArray = {-1, 0, 1, 2, 3}; int[] result = find_odd(myArray); The array "result" contains: 0, -1, 0, 1, 0, 3 Because in Java you have to define the size of array first, and empty int[] array element is 0 not null. So when I want to test the find_odd() function and expect the array to have odd numbers (which it does) only, it throws the error because the array also includes 0s representing "empty cell" as shown above. My test code: public void testFindOddPassValidIntArray() { int[] arr = {-2, -1, 0, 1, 3}; int[] result = findOddObj.find_odd(arr); //check if return array only contain odd number for(int i=0; i<result.length; i++) { if(result[i] != null) { assert is_odd(result[i]) : result[i]; } } } So, my question is should I use int[] array and add check for 0 element in my test like: if(result[i] != 0) { assert is_odd(result[i] : result[i] } But in this case, if find_odd() function is broken and returning 0 by miscalculation, I can't catch it because my test code would only assume that 0 is empty cell. OR should I use Integer[] array whose default is null? How do people deal with this kind of situation?

    Read the article

  • How to loop 3 dimension array using foreach PHP

    - by vzhen
    Below is foreach and the 3 dimension arrays, no problem with the looping but i cannot sepcify which array to echo, they must me the whole arrays like echo $subvalue, any better solutions with looping 3 dimension array? i actually feel weird with this looping. Thanks in adv foreach ($stories as $key => $story){ //echo "<br />"; foreach($story as $subkey => $subvalue){ echo $subvalue."<br />"; foreach($subvalue as $key => $subsubvalue){ echo $subsubvalue."<br />"; } } } Array ( [270] => Array ( [uid] => 36 [user_email] => [email protected] [sid] => 270 [story_name] => Story C [photo_url] => Array ( [0] => story_photos/2012/0322/361332381418153311.jpg [1] => story_photos/2012/0322/361332393792911587.jpg ) [photo_added_date] => Array ( [0] => 1332381418 [1] => 1332393792 ) ) [269] => Array ( [uid] => 36 [user_email] => [email protected] [sid] => 269 [story_name] => Story B [photo_url] => Array ( [0] => story_photos/2012/0322/361332381406580761.jpg ) [photo_added_date] => Array ( [0] => 1332381406 ) ) [268] => Array ( [uid] => 36 [user_email] => [email protected] [sid] => 268 [story_name] => Story A [photo_url] => Array ( [0] => story_photos/2012/0322/361332381393552719.jpg ) [photo_added_date] => Array ( [0] => 1332381393 ) ) )

    Read the article

  • PHP Array problems....if anyone can assist!

    - by Homer_J
    First off, the code which brings back my data into an array: function fetch_questions($page) { global $link; $proc = mysqli_prepare($link, "SELECT * FROM tques WHERE page = $page"); mysqli_stmt_bind_param($proc, "i", $page); mysqli_stmt_execute($proc); $rowq = array(); stmt_bind_assoc($proc, $rowq); // loop through all result rows while ($proc->fetch()) { // print_r($rowq); } mysqli_stmt_close($proc); mysqli_clean_connection($link); return($rowq); } Now, when I `print_r($rowq);' I get the following, which is all good: Array ( [questions] => q1 [qnum] => 1 [qtext] => I find my job meaningful [page] => 1 ) Array ( [questions] => q2 [qnum] => 2 [qtext] => I find my job interesting [page] => 1 ) Array ( [questions] => q3 [qnum] => 3 [qtext] => My work supports ABC's objective [page] => 1 ) Array ( [questions] => q4 [qnum] => 4 [qtext] => I am able to balance my work and home life [page] => 1 ) Array ( [questions] => q5 [qnum] => 5 [qtext] => I am clear about what is expected of me in my job [page] => 1 ) Array ( [questions] => q6 [qnum] => 6 [qtext] => My induction helped me to settle into my job [page] => 1 ) Array ( [questions] => q7 [qnum] => 7 [qtext] => I understand the ABC vision [page] => 1 ) Array ( [questions] => q8 [qnum] => 8 [qtext] => I know how what I do fits into my team's objectives [page] => 1 ) Now, in my php page I have the following piece of script: $questions = fetch_questions($page); And when I print_r $questions, as below: print_r($questions); I only get the following back from the array, 1 row: Array ( [questions] => q8 [qnum] => 8 [qtext] => I know how what I do fits into my team's objectives [page] => 1 ) Any ideas why that might be? Thanks in advance, Homer.

    Read the article

  • how to display a array value in view page

    - by udaya
    Hai I am using codeigniter...I my function phpcalview()... This is my function function phpcalview() { $year = $this->input->post('yearvv'); $data['year'] = $this->adminmodel->selectyear(); $data['date'] = $this->adminmodel->selectmonth(); print_r($data['date'] ); $this->load->view('phpcal',$data); } I am printing the values with print_r($data['date'] ); I get values like Array ( [0] => Array ( [dbdatenum] => 1 ) [1] => Array ( [dbdatenum] => 2 ) [2] => Array ( [dbdatenum] => 3 ) [3] => Array ( [dbdatenum] => 4 )) I want to display the array seperately as array[0],array[1] in my view page how can i do that

    Read the article

  • Pass javascript array to php by using curly braces key name

    - by user7031
    My js code: $(function(){ var arr = new Array('jj', 'kk', 'oo'); $.post('test12.php', {'arr[]': arr}, function(data){ alert(data); }); }); PHP code: <?php echo print_r($_POST['arr']); The thing is,$.post receive a key named 'arr[]',it should be used in PHP as 'arr[]' instead of 'arr',but '$_POST['arr[]']' doesn't work,'arr' works.Which seems that Jquery might do something with curly braces '[]' before sending something to PHP. Secondly,when I remove the single quotas around 'arr[]',PHP can not receive anything by using $_POST['arr'];,I don't know why? Doing this task in a traditional way with no curly braces: $.post('test12.php', {arr: arr}, function(data){ alert(data); }); It works fine. So when sending javascript array to PHP,why bothering using single quote and curly braces like 'arr[]' instead of using a concise way like arr:arr My return result is Array( [0]=>jj [1]=>kk [2]=>oo ) 1 Notice there is a 1 under the array,why?

    Read the article

  • Selecting Date Range on a PHP form and displaying results from MySQL database

    - by Sarah HSL
    This may be something simple but I cant understand why this wouldn't work.. I have a php form where you can select a date range from drop downs. I've given the field names day, month year, and day1, month1, year1. When clicking submit it takes you to a second php form. Here is the code for second form: <?php $username="***"; $password="***"; $database="****"; mysql_connect('localhost',$username,$password); @mysql_select_db($database) or die( "Unable to select database"); $day = $_GET['day']; $month = $_GET['month']; $year = $_GET['year']; $day1 = $_GET['day1']; $month1 = $_GET['month1']; $year1 = $_GET['year1']; $date1 = "$year-$month-$day"; $date2 = "$year1-$month1-$day1"; $query = "SELECT * FROM main_stock WHERE curr_timestamp BETWEEN '$date1' AND '$date2'"; $result=mysql_query($query); $num=mysql_num_rows($result); ?> <table border="1" cellspacing="2" cellpadding="2"> <tr> <td><b><font face="Arial, Helvetica, sans-serif">Product Description</font></b></td> <td><b><font face="Arial, Helvetica, sans-serif">Category</font></b></td> <td><b><font face="Arial, Helvetica, sans-serif">Master Category</font></b></td> <td><b><font face="Arial, Helvetica, sans-serif">Barcode</font></b></td> <td><b><font face="Arial, Helvetica, sans-serif">Status</font></b></td> <td><b><font face="Arial, Helvetica, sans-serif">TimeStamp</font></b></td> <td><b><font face="Arial, Helvetica, sans-serif">New Own</font></b></td> <td><b><font face="Arial, Helvetica, sans-serif">Serial No.</font></b></td> </tr> <?php $i=0; while ($i < $num) { $f1=mysql_result($result,$i,"product_desc"); $f2=mysql_result($result,$i,"category"); $f3=mysql_result($result,$i,"mastercategory"); $f4=mysql_result($result,$i,"barcode"); $f5=mysql_result($result,$i,"status"); $f6=mysql_result($result,$i,"curr_timestamp"); $f7=mysql_result($result,$i,"newown"); $f8=mysql_result($result,$i,"serial"); ?> <tr> <td><font face="Arial, Helvetica, sans-serif"><?php echo $f1; ?></font></td> <td><font face="Arial, Helvetica, sans-serif"><?php echo $f2; ?></font></td> <td><font face="Arial, Helvetica, sans-serif"><?php echo $f3; ?></font></td> <td><font face="Arial, Helvetica, sans-serif"><?php echo $f4; ?></font></td> <td><font face="Arial, Helvetica, sans-serif"><?php echo $f5; ?></font></td> <td><font face="Arial, Helvetica, sans-serif"><?php echo $f6; ?></font></td> <td><font face="Arial, Helvetica, sans-serif"><?php echo $f7; ?></font></td> <td><font face="Arial, Helvetica, sans-serif"><?php echo $f8; ?></font></td> </tr> <?php $i++; } $num_rows = mysql_num_rows($result); echo "$num_rows Rows\n"; mysql_close(); ?> Is there any reason this wouldn't work? I'm not sure where I am going wrong. It displays results when there is another option as well as the date such as 'status' but when this is taken out and I just want to display all the results between the date range it doesn't work.. This works: <?php $username="+++"; $password="+++"; $database="+++"; mysql_connect('localhost',$username,$password); @mysql_select_db($database) or die( "Unable to select database"); $day = $_GET['day']; $month = $_GET['month']; $year = $_GET['year']; $day1 = $_GET['day1']; $month1 = $_GET['month1']; $year1 = $_GET['year1']; $status = $_GET['status']; $date1 = "$year-$month-$day"; $date2 = "$year1-$month1-$day1"; $query = "SELECT * FROM main_stock WHERE status = '$status' AND curr_timestamp BETWEEN '$date1' AND '$date2'"; $result=mysql_query($query); $num=mysql_num_rows($result); ?> <table border="1" cellspacing="2" cellpadding="2"> <tr> <td><b><font face="Arial, Helvetica, sans-serif">Product Description</font></b></td> <td><b><font face="Arial, Helvetica, sans-serif">Category</font></b></td> <td><b><font face="Arial, Helvetica, sans-serif">Master Category</font></b></td> <td><b><font face="Arial, Helvetica, sans-serif">Barcode</font></b></td> <td><b><font face="Arial, Helvetica, sans-serif">Status</font></b></td> <td><b><font face="Arial, Helvetica, sans-serif">TimeStamp</font></b></td> <td><b><font face="Arial, Helvetica, sans-serif">New Own</font></b></td> <td><b><font face="Arial, Helvetica, sans-serif">Serial No.</font></b></td> </tr> <?php $i=0; while ($i < $num) { $f1=mysql_result($result,$i,"product_desc"); $f2=mysql_result($result,$i,"category"); $f3=mysql_result($result,$i,"mastercategory"); $f4=mysql_result($result,$i,"barcode"); $f5=mysql_result($result,$i,"status"); $f6=mysql_result($result,$i,"curr_timestamp"); $f7=mysql_result($result,$i,"newown"); $f8=mysql_result($result,$i,"serial"); ?> <tr> <td><font face="Arial, Helvetica, sans-serif"><?php echo $f1; ?></font></td> <td><font face="Arial, Helvetica, sans-serif"><?php echo $f2; ?></font></td> <td><font face="Arial, Helvetica, sans-serif"><?php echo $f3; ?></font></td> <td><font face="Arial, Helvetica, sans-serif"><?php echo $f4; ?></font></td> <td><font face="Arial, Helvetica, sans-serif"><?php echo $f5; ?></font></td> <td><font face="Arial, Helvetica, sans-serif"><?php echo $f6; ?></font></td> <td><font face="Arial, Helvetica, sans-serif"><?php echo $f7; ?></font></td> <td><font face="Arial, Helvetica, sans-serif"><?php echo $f8; ?></font></td> </tr> <?php $i++; } $num_rows = mysql_num_rows($result); echo "$num_rows Rows\n"; mysql_close(); ?> But when the 'status' field is taken out (and obviously the serial drop down in the first form) it stops working...

    Read the article

  • comparing multidimensional array

    - by John K
    Hello everyone, I have the following array: Array ( [0] => Array ( [0] => 87 [1] => 55 [2] => 85 [3] => 86 ) [1] => Array ( [0] => 58 [1] => 84 ) [2] => Array ( [0] => 58 ) ) This array above is an example. The actual array is of variable size, but structured like this. Basically, I'd like to run array_intersect on each second level array and grab the value (number) that is common between them. In this case, it would be 58. I'm not quite sure where to start on this. Any advice?

    Read the article

  • PHP Pass Dynamic Array name to function

    - by Brad
    How do I pass an array key to a function to pull up the right key's data? // The array <?php $var['TEST1'] = Array ( 'Description' => 'This is a Description', 'Version' => '1.11', 'fields' => Array( 'ID' => array( 'type' => 'int', 'length' =>'11', 'misc' =>'auto_increment' ), 'DATA' => array( 'type' => 'varchar', ' length' => '255' ) ); $var['TEST2'] = Array ( 'Description' =? 'This is the 2nd Description', 'Version' => '2.1', 'fields' => Array( 'ID' => array( 'type' => 'int', 'length' =>'11', 'misc' =>'auto_increment' ), 'DATA' => array( 'type' => 'varchar', ' length' => '255' ) ) // The function <?php $obj = 'TEST1'; print_r($schema[$obj]); // <-- Fives me output. But calling the function doesn't. echo buildStructure($obj); /** * @TODO to add auto_inc support */ function buildStructure($obj) { $output = ''; $primaryKey = $schema["{$obj}"]['primary key']; foreach ($schema["{$obj}"]['fields'] as $name => $tag) // #### ERROR #### Invalid argument supplied for foreach() { $type = $tag['type']; $length = $tag['length']; $default = $tag['default']; $description = $tag['description']; $length = (isset($length)) ? "({$length})" : ''; $default = ($default == NULL ) ? "NULL" : $default; $output .= "`{$name}` {$type}{$length} DEFAULT {$default} COMMENT `{$DESCRIPTION}`, "; } return $output; }

    Read the article

  • PHP - How to retrieve session in php

    - by Klaus Jasper
    I created a table that contains id - names - jobs and page that shows the names only and beside each name there is button Job and session that contains the id. this is my code $query = mysql_query("SELECT * FROM table"); while($fetch = mysql_fetch_array("$query")){ $name = $fetch['names']; $id = $fetch['id']; echo '</br>'; echo $name; $_SESSION['name'] = $id; echo "<button>Job</button>"; } I want when the user click on button Job redirect to a page that contains the job of that session. so how can I do it?

    Read the article

  • Parsing array data

    - by Sam
    I am trying to parse this array data that way generated from JQuery and JSON. Array ( [d] = Array ( [0] = Array ( [order] = 1 ) [1] => Array ( [order] => 2 ) [2] => Array ( [order] => 3 ) [3] => Array ( [order] => 4 ) [4] => Array ( [order] => 5 ) ) ) I am trying to save the above date into a mysql table, but cannot seem to parse the data properly to be inserted into the database. Can anyone help?

    Read the article

  • how to get key value of array with curl (php)

    - by Vierri
    Hello I want to make use of an API but it print alot of info and i don't know how i can get a few key values of the array. <?php $query = "SELECT * FROM kvk WHERE adres='Wit-geellaan 158'"; $host = "http://api.openkvk.nl/php/"; $url = $host ."/". rawurlencode($query); $curl = curl_init(); curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_HEADER, 0); curl_exec($curl); curl_close($curl); ?> Is my php script and it shows array(array("RESULT"=>array("TYPES"=>array("int","bigint","varchar","varchar","varchar","varchar","varchar","int","int","smallint","smallint","int"),"HEADER"=>array("id","kvk","bedrijfsnaam","adres","postcode","plaats","type","kvks","sub","bedrijfsnaam_size","adres_size","verhuisd"),"ROWS"=>array(array("1303095","271242250000","Schoonmaakbedrijf Regio","Wit-geellaan 158","2718CK","Zoetermeer","Hoofdvestiging","27124225","0","23","16","0"))))) Thanks in advance Greetings, Vierri

    Read the article

  • populating on the basis of array elements in php

    - by Avinash
    This is my code. if(in_array("1", $mod)){ $res=array('First Name','Insertion','Last Name','Lead Country');} if(in_array("2", $mod)){ $res=array('Landline No:','Mobile No:','Lead Country');} if(in_array("3", $mod)){ $res=array('City','State','Country','Lead Country');} if(in_array("4", $mod)){ $res=array('Email','Lead Country');} return $res; Upto this it works fine. But if the array contains more than one value say (1,3) I need to return both results of 1 and 3. eg: if the array is like this array([0]=>1 [1]=>3) then $res=array('First Name','Insertion','Last Name','City','State','Country','Lead Country') But if there are 2 lead country only one should be displayed how to do this? Pls help me.

    Read the article

  • Execute a command using php under ssh2 in php

    - by Mervyn
    Using Mint terminal my script connects using ssh2_connect and ssh2_auth-password. When am logged in successfully I want to run a command which will give me the hardware cpu. Is there a way I can use to exec the command in my script then show the results. I have used system and exec for pinging. if i was in the terminal i do the login. then type "get hardware cpu" in the terminal it would look like this: Test~ $ get hardware cpu

    Read the article

< Previous Page | 55 56 57 58 59 60 61 62 63 64 65 66  | Next Page >