Search Results

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

Page 135/1708 | < Previous Page | 131 132 133 134 135 136 137 138 139 140 141 142  | Next Page >

  • Loading c libraries from php

    - by Thomas Ahle
    Hi, in a recent project I've come really need the lib tre matching library. However the project is in php, and there are no php bindings for the library. I've tried to google how to create an interface for c libs, but all I found was the dl function which seams to load only php extensions. What am I missing?

    Read the article

  • Debug the PHP interpreter with GDB.

    - by The Rook
    I would like to use GDB to step though the C++ code that makes up the php.so Apache extension. I want to see what PHP is doing while its running a PHP application. Preferably i would use an IDE like Netbeans or Eclipse on a LAMP system.

    Read the article

  • PHP protected classes and properties, protected from whom?

    - by Andrew Heath
    I'm just getting started with OOP PHP via PHP Object-Oriented Solutions and am a little curious about the notion of protection in OOP. The author clearly explains how protection works, but the bit about not wanting others to be able to change properties falls a bit flat. I'm having a hard time imagining a situation where it is ever possible to prevent others from altering your classes, since they could just open up your class.php and manually tweak whatever they pleased seeing as how PHP is always in plaintext. Caution: all of the above written by a beginner with a beginner's understanding of programming...

    Read the article

  • Using a php://memory wrapper causes errors...

    - by HorusKol
    I'm trying to extend the PHP mailer class from Worx by adding a method which allows me to add attachments using string data rather than path to the file. I came up with something like this: public function addAttachmentString($string, $name='', $encoding = 'base64', $type = 'application/octet-stream') { $path = 'php://memory/' . md5(microtime()); $file = fopen($path, 'w'); fwrite($file, $string); fclose($file); $this->AddAttachment($path, $name, $encoding, $type); } However, all I get is a PHP warning: PHP Warning: fopen() [<a href='function.fopen'>function.fopen</a>]: Invalid php:// URL specified There aren't any decent examples with the original documentation, but I've found a couple around the internet (including one here on SO), and my usage appears correct according to them. Has anyone had any success with using this? My alternative is to create a temporary file and clean up - but that will mean having to write to disc, and this function will be used as part of a large batch process and I want to avoid slow disc operations (old server) where possible. This is only a short file but has different information for each person the script emails.

    Read the article

  • Initiate a PHP class where class name is a variable

    - by ed209
    I need some help with an error I have not encountered before and can't seem to find anywhere. In a PHP mvc framework (just from a tutorial) I have the following: // Initiate the class $className = 'Controller_' . ucfirst($controller); if (class_exists($className)) { $controller = new $className($this->registry); } $className is showing the correct class name (case is also correct). But when I run it I get this in the apache error log (no php error) [Wed Mar 31 10:34:12 2010] [notice] child pid 987 exit signal Segmentation fault (11) Process id is different on every call. I am running PHP 5.3.0 on os x 10.6. This site seems to work on 5.2.11 on another Mac. Not really sure where to go next to debug it. I guess it could be an apache setting as much as a php bug or a problem with the code... any suggestions on where to look next?

    Read the article

  • Keeping php script seperate from UI

    - by Jonathan
    I have php scripts that do things like register, login, upload. I would like to keep the HTML in a seperate file so that say I make a desktop client I can just use the php files to do the login register etc. Basically to have say a front end, the HTML or desktop client and then only one backend, the php. Is that possible?

    Read the article

  • Intermittent "No Database Selected" in PHP/MySQL?

    - by ANE
    Have a PHP/MySQL form with a dropdown box containing a list of 350 names. When any random name is selected, sometimes it works & displays info about that name from the database, and sometimes the form gives the error "No Database Selected". Here's what I've tried, pretty much grasping at straws as I'm not a programmer: Increasing max_connections in /etc/my.cnf from 200 to 2000 (even though only 4-5 connections are made and it's a lightly used server) Changing mysql_pconnect to mysql_connect Adding the word true to this connection string: $mysql = mysql_pconnect($hostname_mysql, $username_mysql, $password_mysql, true) or trigger_error(mysql_error(),E_USER_ERROR); Changing the word require_once to require on this line: [?php require('/home/user/Connections/mysql.php'); ?] Enabling MySQL & PHP query & error logging. (no errors logged) Here is the code: [removed old bad code] Update: Working answer from Rob Apodaca below.

    Read the article

  • PHP is there a true() function?

    - by Gremo
    I'm writing a function to check all elements inside an array, returning a single boolean value. is there a true() function? function all($f, array $arr) { return empty($arr) ? false : array_reduce($arr, function($v1, $v2) use ($f) { return $f($v1) && $f($v2); }, true); } $test = array(1, 6, 2); $gte0 = function($v) { return $v >= 0; } var_dump(all($gte0, $test)); // True $test = array(true, true, false); $id = function($v) { return $v; } // <-- this is what i would avoid var_dump(all($id, $test)); // False all(true, $test); // NOT WORKING because true is not a function

    Read the article

  • Please help with passing multidimensional arrays

    - by nn
    Hi, I'm writing a simple test program to pass multidimensional arrays. I've been struggling to get the signature of the callee function. void p(int (*s)[100], int n) { ... } In the code I have: int s1[10][100], s2[10][1000]; p(s1, 100); This code appears to work, but it's not what I intended. I want to the function p to be oblivious whether the range of values is 100 or 1000, but it should know there are 10 pointers. I tried as a first attempt: void p(int (*s)[10], int n) // n = # elements in the range of the array and also: void p(int **s, int n) // n = # of elements in the range of the array But to no avail can I seem to get this correct. I don't want to hardcode the 100 or 1000, but instead pass it in, but there will always be 10 arrays. Obviously, I want to avoid having to declare the function: void p(int *s1, int *s2, int *s3, ..., int *s10, int n) FYI, I'm looking at the answers to a similar question but still confused.

    Read the article

  • PHP include by name

    - by Adrian M.
    Hello, I have "content" folder which is full of other sub-directories named in the following way: "id1_1","id1_2", "id1_3" and other "id2_1", "id2_2" etc. Each of these folders contains a file "template.php", same name in all sub-directories. The number of folders is dynamic so I need to find a way to import in "index.php" only the "template.php" from all the folders starting with "id_1_". How can I do it? Thanks!

    Read the article

  • SQL to CodeIgniter Array Missing Data Issue

    - by SamD
    $query = $this->db->query("SELECT t1.numberofbets, t1.profit, t2.seven_profit, t3.28profit, user.user_id, username, password, email, balance, user.date_added, activation_code, activated FROM user LEFT JOIN (SELECT user_id, SUM(amount_won) AS profit, count(tip_id) AS numberofbets FROM tip GROUP BY user_id) as t1 ON user.user_id = t1.user_id LEFT JOIN (SELECT user_id, SUM(amount_won) AS seven_profit FROM tip WHERE date_settled > '$seven_daystime' GROUP BY user_id) as t2 ON user.user_id = t2.user_id LEFT JOIN (SELECT user_id, SUM(amount_won) AS 28profit FROM tip WHERE date_settled > '$twoeight_daystime' GROUP BY user_id) as t3 ON user.user_id = t3.user_id where activated = 1 GROUP BY user.user_id ORDER BY user.date_added DESC"); return $query->result_array(); The query works fine running it in phpMyAdmin and returns complete results (in image attached). However, printing the array in CodeIgniter, it has no value for one field ,seven_profit, where it is there in the SQL query ran in phpMyAdmin, just the discrepancy in this one field, from sql to php array... I just can’t see why, when printing the array, that one field, which should have value of 26, contains nothing? Any ideas? I changed the field name from starting with a number in attempt to fix it, but no difference. I know this is complex and looks horrible, any help or just people coming across something similar would be great to know about, thanks. Sam

    Read the article

  • Facebook - using an external flash application to connect via PHP

    - by Anonymous
    So, I have this application that needs to connect to facebook. It uses php for all of its data access, in older examples of the facebook API, i see people get the UID, and sessionkey from the iframe page, then send them to php and run a function called $facebook-setUser($UID, $sessionKey). This is how the majority of the tutorials online are doing it. That would be great, except the newest facebook API doesn't have any function like that. I have been scouring the web for 2 hours and have found nothing relating to the disappearance of this seemingly critical function. So, I have a flash application that needs to authenticate via a stateless php resource. I would love it if my PHP code could be completely uncaring if the request originated from flash, or iphone, or another application altogether-it should just need userId and and sessionKey. Is this still possible? Thank you in advance for your help! :)

    Read the article

  • Calling Excel from PHP 5 through COM fails on Windows 7 when Apache started through Task Planner

    - by Stefan Pantke
    I currently write an application, which controls Excel through COM: The app creates a COM-based Excel instance, opens some XLS files and reads their contents. Scenario I On Windows 7, I start Apache and mySQL using xmapp-control with system administrator rights. All works as expected. The PHP-based controller script interacts with Excel as expected. Scenario II A problem appears, if I start Apache and mySQL as 'background jobs'. Here is how: I created two jobs using Windows 7 Task Planner. One runs apache_start.bat, the other runs mysql_start.bat. Both tasks run as SYSTEM with elevated privileges when Windows 7 boots. Apache and mySQL work as expected. Specifically, Apache serves HTTP request from clients and PHP is able to talk to mySQL. When I call the PHP controller, which calls and interacts with Excel using COM, I do receive an error. The error seems to come from Excel [not COM itself] and reads like this: Excel can't read the XLS-file Excel failed to save the file due to an ill-name worksheet Interestingly, during the first run of the PHP-based controller script, it takes a few seconds to render the error message. Each subsequent run immediately renders the error message. Windows system logs didn't show a single problem report entry. Note, that the PHP program and the Apache instance didn't change - except the way Apache was started. At least the PHP controller script is perfectly able to read the file-system, since it provides the pathes to the XLS-file through scandir() of a certain directory. Concurrency issues can't be the cause of the problem. A single instance of the specific PHP controller interacts with Excel. Question Could someone provide details, why this happens?

    Read the article

  • Porting some PHP to ColdFusion

    - by Oscar Godson
    OK, I'm working with converting some very basic PHP to port to a dev server where the client only has CF. Ive never worked with it, and I just need to know how to port a couple things: <?php $pageTitle = 'The City That Works'; $mainCSSURL = 'header_url=../images/banner-home.jpg&amp;second_color=484848&amp;primary_color=333&amp;link_color=09c&amp;sidebar_color=f2f2f2'; require('includes/header-inc.php'); ?> I know: <cfinclude template="includes/header-inc.cfm"> but how to i get the var to be passed to the include and then how do I use it on the subsequent included file? Also in my CSS (main.php) I have (at the top): <?php header('Content-type: text/css'); foreach($_GET as $css_property => $css_value) {define(strtoupper($css_property),$css_value);} ?> and im using those constants like this: #main-content a {color:#<?= LINK_COLOR ?>;} How can I get that to work also with CF? Never thought I'd be working with CF :)

    Read the article

  • Problem with running the Nutch command from PHP exec()

    - by Annibigi
    My Nutch directory lies in /home/myserv/nutch/nutch-1.0/ My php applictaion is in the diretcory /home/myserv/www/ Theres a a php file in my /home/myserv/www/ diretcory that runs a exec command to run a nutch command.PHP code is like : $output = exec("bin/nutch all"); When I run the command from the command line I need to be in the "/home/myserv/nutch/nutch-1.0/" directory When i'm trying to run it through the php exec() ,I just can seems to make it execute. I have tried giving the ful path like (below) but nothing works :( $output = exec("/home/myserv/nutch/nutch-1.0/bin/nutch all"); Desperately looking for help

    Read the article

  • Segmentation fault when accessing a PHP page

    - by Justin Ethier
    Sometimes when one of our Apache web servers is restarted, we experience segmentation faults when any PHP page is subsequently accessed. The following line is printed in the httpd error_log: [Wed Jun 16 10:59:33 2010] [notice] child pid 31513 exit signal Segmentation fault (11) There will be one of these lines for each PHP page that is accessed. This appears to happen randomly - the "workaround" to-date is to restart httpd, which eventually fixes the problem (almost always after a single restart). Although we only see this happen rarely, it still happens frequently enough to be of concern. So my question is, why is this happening in the first place? Is this a known bug with the version of Apache / PHP / Linux / etc that we are using? Any ideas? The environment is: Fedora 11 Apache 2.2.15 (Default settings) PHP 5.2.13 I can provide more information if that would help narrow things down, since this error message is rather generic... Any help is appreciated.

    Read the article

  • Extremely basic PHP and Mysql

    - by fighella
    Background: I am more of a designer than a programmer, but have hacked templates for many open source CMS's (Drupal, Joomla, Wordpress) I want to start from scratch in regards to the relations of php and a mysql database. Lets assume I have a working database and php engine locally. What would be my first step to connecting to my database and creating a table... (im happy to be led to an appropriate tutorial...) Many of the tutorials I have seen start with basic php, but I would rather explore the connection between the db and the php.

    Read the article

  • php shuffle() returns one item

    - by mike
    Anyone have any idea why shuffle() would only return 1 item? when using: $array2 = shuffle($array1); with the following array($array1): Array ( [0] => 1 [1] => 5 [2] => 6 [3] => 7 [4] => 8 [5] => 10 [6] => 11 [7] => 12 [8] => 13 [9] => 14 ) The output of: print_r($array2); is simply: 1 Any idea as to why it would not only not shuffle the array, but knock off the remaining 9 items in the array? thanks!

    Read the article

< Previous Page | 131 132 133 134 135 136 137 138 139 140 141 142  | Next Page >