Search Results

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

Page 109/1708 | < Previous Page | 105 106 107 108 109 110 111 112 113 114 115 116  | Next Page >

  • Array not showing in Jlist but filled in console

    - by OVERTONE
    Hey there. been a busy debugger today. ill give ths short version. ive made an array list that takes names from a database. then i put the contents of the arraylist into an array of strings. now i want too display the arrays contents in a JList. the weird thing is it was working earlier. and ive two methods. ones just a little practice too make sure i was adding to the Jlist correctly. so heres the key codes. this is the layout of my code. variables constructor methods in my variables i have these 3 defined String[] contactListNames = new String[5]; ArrayList<String> rowNames = new ArrayList<String>(); JList contactList = new JList(contactListNames); simple enough. in my constructor i have them again. contactListNames = new String[5]; contactList = new JList(contactListNames); //i dont have the array list defined though. printSqlDetails(); // the prinSqldetails was too make sure that the connectionw as alright. and its working fine. fillContactList(); // this is the one thats causing me grief. its where all the work happens. // fillContactListTest(); // this was the tester that makes sure its adding to the list alright. heres the code for fillContactListTest() public void fillContactListTest() { for(int i = 0;i<3;i++) { try { String contact; System.out.println(" please fill the list at index "+ i); Scanner in = new Scanner(System.in); contact = in.next(); contactListNames[i] = contact; in.nextLine(); } catch(Exception e) { e.printStackTrace(); } } } heres the main one thats supposed too work. public void fillContactList() { int i =0; createConnection(); ArrayList<String> rowNames = new ArrayList<String>(); try { Statement stmt = conn.createStatement(); ResultSet namesList = stmt.executeQuery("SELECT name FROM Users"); try { while (namesList.next()) { rowNames.add(namesList.getString(1)); contactListNames =(String[])rowNames.toArray(new String[rowNames.size()]); // this used to print out contents of array list // System.out.println("" + rowNames); while(i<contactListNames.length) { System.out.println(" " + contactListNames[i]); i++; } } } catch(SQLException q) { q.printStackTrace(); } conn.commit(); stmt.close(); conn.close(); } catch(SQLException e) { e.printStackTrace(); } } i really need help here. im at my wits end. i just cant see why the first method would add to the JList no problem. but the second one wont. both the contactListNames array and array list can print fine and have the names in them. but i must be transfering them too the jlist wrong. please help p.s im aware this is long. but trust me its the short version.

    Read the article

  • php.ini not being read with windows 7 installation

    - by Kyle
    I have installed php successfully on a Windows 7 machine but I can not for the life of me get it to read the php.ini file. I have uncommented out the line for php to use mysql and when I run phpinfo(), it never shows up. I have checked to make sure there is only one php.ini file on my entire c:\ drive and it's sitting in my c:\windows folder. has anyone else run into this and know of a solution to get php to read the .ini so that I can enable some extensions (mysql etc)?

    Read the article

  • PHP: System Timezone Setting error

    - by marknt15
    Hi, I'm trying to use PHP in the terminal under MAMP but I got an error related to the system's timezone settings. How can I fix this error? $/Applications/MAMP/bin/php5/bin/php echo.php PHP Strict Standards: PHP Startup: It is not safe to rely on the system's timezone settings. Please use the date.timezone setting, the TZ environment variable or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Asia/Manila' for 'PHT/8.0/no DST' instead in Unknown on line 0 Thanks

    Read the article

  • Exploding a String In PHP

    - by streetparade
    How do i explode this string '||25||34||73||94||116||128' i need to have a array like this array ( 0 => '25', 1 => '34', 2 => '73', 3 => '94', 4 => '116', 5 => '128' ) explode("||", $array); didnt work for me i get this array array ( 0 => '', 1 => '25', 2 => '34', 3 => '73', 4 => '94', 5 => '116', 6 => '128', )

    Read the article

  • Posting to tumblr in PHP

    - by Sherif
    I am trying to make a test post to my tumblr blog with a php script (that will eventually be ran as a cron job) I have been browsing google and read many answers on here and the closest I found is explained in this post: Tumblr OAuth using PHP's OAuth class I am using the code in his tutorial here: http://vigrond.com/blog/2012/02/04/oauth-extension-php-and-the-tumblr-api/ Pretty much as is, replacing the blogurl with mine and of course the consumer and secret key. When I run the .php script via my browser however, nothing happens. Any ideas? EDIT: The only error I found in cPanel's error log is this: [Wed Oct 31 00:29:25 2012] [error] [client xx.xx.xx.xx ] PHP Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /path on line 14 But I fixed this and the error does not appear anymore.

    Read the article

  • Fast parsing of PHP in C#

    - by Jessica Shea
    Hello there, I've got a requirement for parsing PHP files in C#. We essentially require some of the devs in another country to upload PHP files and once uploaded we need to check the php files and get a list of all the methods and classes/functions etc. I thought of using a regex but I can't workout if a function belongs to a class etc, so I was wondering if theres already something 'out there' that will parse out PHP files and spit out its functions (I'm trying to avoid writing a full blow AST implementation). Does anyone have any idea? I looked at Coco/R but I couldn't find a PHP grammar file. I'm using .NET 2.0 and C#.

    Read the article

  • Force php through the .net engine in iis7

    - by Rippo
    I have converted a php to asp.net mvc and have it hosted with the Rackspace cloud. All works great apart from some php links are still linked from other sites and within search engines. My question is what do I need to add to my web.config to force php sites to go through the .net engine? These links work as expected as I can catch the 404 and redirect where need be:- http://www.securahome.net/myjunk.info http://www.securahome.net/myjunk.phpp However this one doesn't:- http://www.securahome.net/myjunk.php I have spoken to Rackspace cloud and they say "its not possible as IIS doesn't recognize php files. You can setup mime types to handle them" This however makes no sense and I think they did not understand the problem. Does anyone have a solution?

    Read the article

  • How to output JavaScript with PHP

    - by krishna
    Hi, I am new to PHP. I need to output the following JavaScript with PHP. This is my code: <html> <body> <?php echo "<script type="text/javascript">"; echo "document.write("Hello World!")"; echo "</script>"; ?> </body> </html> But it's showing the error: Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /var/www/html/workbench/person/script.php on line 4 Can anyone please help? I also need some simple tutorials on how to use PHP, HTML and JavaScript for an application.

    Read the article

  • textbox disappears in paging - php

    - by fusion
    i'm calling the search.php page via ajax to search.html. the problem is, since i've implemented paging, the textbox with the search keyword from search.html 'disappears' when the user clicks the 'Next' button [because the page goes to search.php which has no textbox element] i'd like the textbox with the search keyword to be there, when the user goes through the records via paging. how'd i achieve this? search.html: <body> <form name="myform" class="wrapper"> <input type="text" name="q" onkeyup="showPage();" class="txt_search"/> <input type="button" name="button" onclick="showPage();" class="button"/> <p> <div id="txtHint"></div> <div id="page"></div> </form> </body> search.php [the relevant part]: $self = $_SERVER['PHP_SELF']; $limit = 5; //Number of results per page $numpages=ceil($totalrows/$limit); $query = $query." ORDER BY idQuotes LIMIT " . ($page-1)*$limit . ",$limit"; $result = mysql_query($query, $conn) or die('Error:' .mysql_error()); ?> <div class="caption">Search Results</div> <div class="center_div"> <table> <?php while ($row= mysql_fetch_array($result, MYSQL_ASSOC)) { $cQuote = highlightWords(htmlspecialchars($row['cQuotes']), $search_result); ?> <tr> <td style="text-align:right; font-size:15px;"><?php h($row['cArabic']); ?></td> <td style="font-size:16px;"><?php echo $cQuote; ?></td> <td style="font-size:12px;"><?php h($row['vAuthor']); ?></td> <td style="font-size:12px; font-style:italic; text-align:right;"><?php h($row['vReference']); ?></td> </tr> <?php } ?> </table> </div> <?php //Create and print the Navigation bar $nav=""; if($page > 1) { $nav .= "<a href=\"$self?page=" . ($page-1) . "&q=" .urlencode($search_result) . "\">< Prev</a>"; $first = "<a href=\"$self?page=1&q=" .urlencode($search_result) . "\"><< First</a>" ; } else { $nav .= "&nbsp;"; $first = "&nbsp;"; } for($i = 1 ; $i <= $numpages ; $i++) { if($i == $page) { $nav .= "<B>$i</B>"; }else{ $nav .= "<a href=\"$self?page=" . $i . "&q=" .urlencode($search_result) . "\">$i</a>"; } } if($page < $numpages) { $nav .= "<a href=\"$self?page=" . ($page+1) . "&q=" .urlencode($search_result) . "\">Next ></a>"; $last = "<a href=\"$self?page=$numpages&q=" .urlencode($search_result) . "\">Last >></a> "; } else { $nav .= "&nbsp;"; $last = "&nbsp;"; } echo "<br /><br />" . $first . $nav . $last; }

    Read the article

  • PHP doesn't show any kind of errors

    - by iSenne
    Hello everybody I have a PHP server at home for development. It is running: Ubuntu 9.10 Apache 2.2.12 PHP 5.3.2-0.dotdeb.1 MySql 5.0.7-dev Currently the settings in the php.ini for displayiong errors are: display_errors = on error_reporting = E_ALL But I do not see any errors in my php script. Also very strange is that phpinfo() shows me this: display_errors Off I checked the php.ini file, and restarted the apache server many times, but with no luck. Does anybody knows how this is possible? edit: When I localy set this: ini_set('display_errors', 'on'); I do receive errors.

    Read the article

  • storing crontab php outputs in a log file

    - by vick
    * * * * * php /home/admin/public_html/domain.com/public/cron/route.php &>> /home/admin/public_html/domain.com/log/cron.log I have that cron running every minute. I want to store the errors that occur in route.php in cron.log This works wonderfully when I run : php /home/admin/public_html/domain.com/public/cron/route.php &>> /home/admin/public_html/domain.com/log/cron.log through the command line manually. But when crontab runs it no errors gets stored in cron.log the cron.log is owned by admin:admin and the permissions are set to 777 just to be sure. anyone?

    Read the article

  • execute javascript before return in php

    - by user354051
    I do have a custom php script that validates captcha code and sends an email. If php script is sending a mail successfully then it returns "true". This is done by: if(!$Error){ echo "true"; exit; } Before returning true, I would like to execute a jQuery command that should refresh the captcha image. I shouldn't be doing this is client side as it might be risky from spammers point of view. To refresh the captcha image, The command is: jQuery('#captcha').attr('src', ('php/captcha/captchaimage_show.php?' + Math.random())); I need to call this command from within php scripts before return any results by "echo" Prashant

    Read the article

  • Ruby function similar to parse_str in php?

    - by jolierouge
    Hi, I need to parse a string like this: a[metadata][][name]=dont|do|this&a[name]=Hello World&a[metadata][][value]=i|really|mean it CGI::parse gives me this: {"a[name]"=["Hello World"], "a[metadata][][name]"=["dont|do|this"], "a[metadata][][value]"=["i|really|mean it"]} I would like something like what PHP does with parse_str, which when given the same string does this: Array ( [a] => Array ( [metadata] => Array ( [0] => Array ( [name] => dont|do|this ) [1] => Array ( [value] => i|really|mean it ) ) [name] => Hello World )) Any help would be awesome. Thanks!

    Read the article

  • PHP Default Timezone issue on Fedora + Zend Server CE

    - by Dave Morris
    I have ZendServer CE (PHP 5.2) installed on a Fedora VM, and I have the system timezone set to 'America/Chicago'. I have date.timezone = 'UTC' in my php.ini file, and when I call date_default_timezone_get(), or display date('T') on a web page, it says 'CDT'. The documentation on php.net for date_default_timezone_get() says it follows this order when choosing a default timezone: - Reading the timezone set using the date_default_timezone_set() function (if any) - Reading the TZ environment variable (if non empty) - Reading the value of the date.timezone ini option (if set) - Querying the host operating system (if supported and allowed by the OS) If I change the system timezone through the 'setup' GUI, and reboot the server, date('T') returns whatever I changed the system timezone to, regardless of what php.ini says. I also don't have a TZ environment variable, and I am not currently using date_default_timezone_set() anywhere in my code. Any idea what might be going on? I realize I can always override the system timezone by calling date_default_timezone_set('UTC'), but I'd rather rely on the php.ini file if possible. Thanks for the help, Dave

    Read the article

  • PHP:Wrong Login info does not redirect to the specific page

    - by sdr
    <?php include 'lib/db_conn.php'; $uid=$_REQUEST['uid']; $pass=$_REQUEST['pass']; if(($uid==NULL && $pass==NULL) ||($uid==NULL) ||($pass==NULL)) { header("location:index.php?msg=Fields can't be left blank.."); } $pass=md5($pass); $sql1="SELECT * FROM `tb_user` WHERE `email`='$uid' AND `pass`='$pass'"; $rs1=mysql_query($sql1) or die (mysql_error()); $row1=mysql_fetch_array($rs1) or die (mysql_error()); $email=$row1['email']; if($uid==$email) { session_start(); $_SESSION['id']=$row1['id']; header("location:home.php"); } else { header("location:index.php?msg=Wrong Credentials.."); } ?>

    Read the article

  • php foreach as variable

    - by user167850
    I'd like to use foreach to loop though an array list and add an element to each array. $tom = array('aa','bb','cc'); $sally = array('xx','yy','zz'); $myArrays = array('tom','sally'); foreach($myArrays as $arrayName) { ${$arrayName}[] = 'newElement'; } Is the use of ${$arrayName}[] the best way to do this? Is there another option rather than using curly braces? It currently works but I'm just wondering if there is a better alternative. Thanks

    Read the article

  • need to run php script when form is submitted

    - by Brad
    I have a form that needs to run a php script once the submit button is clicked, it needs to be ajax. <form method="post" action="index.php" id="entryform" name="entryform"> <input type="submit" name="submit" value="Submit" onclick="JavaScript:xmlhttpPost('/web/ee_web/include/email-notification.php', 'entryform')" /> </form> In this situation, using if(form posted) { get results and run script } is not an option, I need to run the script externally, that is why I need it to execute the email-notification.php at onclick When I point my web browser to domain.com/include/email-notification.php - it runs perfectly. Any help is appreciated.

    Read the article

  • Can't echo jquery (with ajax) variable in php

    - by Lars Kerff
    I'm trying to post a variable through ajax. But it won't echo the variable in php. This are the variables (these are working, seen in the log): $("#slider").bind("valuesChanged", function(e, data){console.log("min: " + data.values.min + " max: " + data.values.max);}); The Ajax part: $("#slider").bind("valuesChanged", function (e, data) { $.ajax({ type: "POST", dataType: "text", url: "../test.php", data: { minValue: data.values.min, maxValue: data.values.max }, async: false, success: function(data){ alert('yeah') }, error: function(xhr) { alert('fail') // if your PHP script return an erroneous header, you'll land here } }); }); </script> And php echo: <?php if ( $_POST ) { echo $_POST[ 'minValue' ]; } ?> Now why does it not echo the post? Thanks!

    Read the article

  • PHP Javascript catch link.

    - by Jordan Pagaduan
    Javascript <script type="text/javascript"> function Edit(id) { if(confirm("Are you sure to edit?")==true) { location.href='employee_set.php&edit='+id; } } </script> PHP <?php if(isset($_GET["edit"])==false){ echo "no response"; }else{ echo "link success"; } ?> My problem is the Javascript is OK. The location href example. http://localhost/employee_set.php&edit=30 ... The PHP code is not working. Error is not found.

    Read the article

  • Redirecting image to php page.

    - by Searock
    Hi, Is it possible to redirect a user to a php page and then redirect to different image, if the user is requesting for the image ? For example if user requests for the image or if other website requests for the image, it should be redirected to the php page and then redirected to a different image. Like if other website requests for http://example.com/images/a.gif, the website will get a different image i.e. http://example.com/images/b.gif. Is it possible? Let me know if I am not clear with my problem. Thanks. Edit : I am trying to create avatar changer for a forum, but the problem is that I cannot add a php link to my avatar. So I think if I could add a image link and when the forum requests the image I could redirect it internally to a php page and then from the php page I would redirect it to a different image.

    Read the article

  • Displaying name instead of ID PHP MySQL

    - by Derek
    Hi, I need something simple; I have page where a user clicks an author to see the books associated with that author. On my page displaying the list of books for the author, I want a simple HTML title saying: 'The books for: AUTHORNAME' I can get the page to display author ID but not the name. When the user clicks the link in the previous page of the author, it looks likes this: <a href="viewauthorbooks.php?author_id=<?php echo $row['author_id']?>"><?php echo $row['authorname']?></a> And then on the 'viewauthorbooks.php?author_id=23' I have declared this at the start: $author_id = $_GET['author_id']; $authorname = $_GET['authorname']; And finally, 'The books for: AUTHORNAME, where it says AUTHORNAME, I have this: echo $authorname (With PHP tags, buts its not letting me put them in!) And this doesnt show anything, however if I change it to author_id, it displays the correct author ID that has been clicked, but its not exactly user friendly!! Can anyone help me out!

    Read the article

  • PHP to C# and Vice versa

    - by Daniel Sh.
    I'm in this project: A web page that's gonna be used by the front-end company people to query and update data from a SQL DB. I'm working with visual studio and the code behind (C#) is almost done, so the interactions between SQL and C# and ok. My original idea was to work with ASP.NET which is familiar to me, but that's not gonna be possible. I have to switch to PHP. So, today is my first day learning PHP, checking http://php.net/manual/en/index.php and a lot of things seem quite similar to ASP.NET so I guess it won't be that hard. Anyways, some questions popped up quite fast as I wanted to script something else than a "hello world" . Is there an easy way to get/send C# variables from my class using a php page? I've read soemthing about using XML in order to do so, but still I'm scratching my head, is there another, easier, way to do this?

    Read the article

  • web site in pure php with clean url

    - by Testadmin
    Hi I have enabled mod_rewrite in my Xampp apache. When I run my php info page, I saw mod_rewrite under Loaded Modules. So I think it's enabled. Then I create a folder clean-url under htdocs. Inside clean-url folder I have 3 files 1) index.php here I put Welcome 2) Test. php 3) .htaccess Here I put RewriteEngine On RewriteRule ^([a-z]+)/([a-z-]+)$ /$1/$2.php [L] I want to run the index page, and by clicking on that hyper link I want to display the test.php page with URL mydomain/clean-url/test I know I am in a wrong path. Does any one help me? Or correct me? ALso i don't know any idea about url rewriting and .htaccess. Please help me.

    Read the article

  • Executing functions parallelly in PHP

    - by binaryLV
    Hi! Can PHP call a function and don't wait for it to return? So something like this: function callback($pause, $arg) { sleep($pause); echo $arg, "\n"; } header('Content-Type: text/plain'); fast_call_user_func_array('callback', array(3, 'three')); fast_call_user_func_array('callback', array(2, 'two')); fast_call_user_func_array('callback', array(1, 'one')); would output one (after 1 second) two (after 2 seconds) three (after 3 seconds) rather than three (after 3 seconds) two (after 3 + 2 = 5 seconds) one (after 3 + 2 + 1 = 6 seconds) Main script is intended to be run as a permanent process (TCP server). callback() function would receive data from client, execute external PHP script and then do something based on other arguments that are passed to callback(). The problem is that main script must not wait for external PHP script to finish. Result of external script is important, so exec('php -f file.php &') is not an option.

    Read the article

  • How to assign a PHP variable that contains a mixed of PHP and html elements?

    - by Rick
    I have a PHP page that contains html and tags and PHP codes and I am using AJAX to manipulate some data and now I need to spit out the response but I am not sure if it is possible to put the mixed content into a string variable to pass through... Is this possible? For example I need to: $response = "<p>some text--<?php echo $something; ?>"; Thanks... To clear things up, I am not trying to send raw PHP code to clientside as that would be silly and won't be evaluated as it is a server side script. I am just looking for a fast way to put everything into a variable without manually re-doing the whole page stripping out the php open and close tags and echos...etc

    Read the article

< Previous Page | 105 106 107 108 109 110 111 112 113 114 115 116  | Next Page >