Search Results

Search found 3120 results on 125 pages for 'php5 oop'.

Page 80/125 | < Previous Page | 76 77 78 79 80 81 82 83 84 85 86 87  | Next Page >

  • Renaming a DOMNode in PHP

    - by python
    <?xml version='1.0' encoding='UTF-8' standalone='no'?> <Document xmlns='urn:iso:std:iso:20022:tech:xsd:pain.001.001.02'> <books> <book> <qty>12</qty> <title>C++</title> </book> <book> <qty>21</qty> <title>PHP</title> </book> </books> <books> <book> <qty>25</qty> <title>Java</title> </book> <book> <qty>32</qty> <title>Python</title> </book> <book> <qty>22</qty> <title>History</title> </book> </books> </Document> How Can I Rename ? <Document xmlns='urn:iso:std:iso:20022:tech:xsd:pain.001.001.02'> TO <Document>

    Read the article

  • convert Bash command to php

    - by Keverw
    This is the bash command echo -n x && (echo 618cf954-6576-491d-8ac6-a1b888c4705d |xxd -r -p |openssl base64|tr '/+' '_-') This is my php <? $uuid = "618cf954-6576-491d-8ac6-a1b888c4705d"; $voiceid = "x" . $uuid; $voiceid = base64_encode($voiceid); $voiceid = str_replace("+", "-", $voiceid); $voiceid = str_replace("/", "_", $voiceid); echo $voiceid; ?> The bash gives the right output, the php one isn't. I'm not sure what i need to do deferent in php.

    Read the article

  • How to get user data in form in Symfony 1.2?

    - by James Inman
    I'm using Symfony 1.2 in a standard Propel form class. public function configure() { $this->setWidgets(array( 'graduate_job_title' => new sfWidgetFormInput( array(), array( 'maxlength' => 80, 'size' => 30, 'value' => '' ) ) )); //etc } However, I want the value of this field to come from the user information, which I'd normally access using $this->getUser()->getAttribute( '...' ). However, this doesn't seem to work in the form. What should I be using?

    Read the article

  • Some help needed with a SQL query

    - by Psyche
    Hello, I need some help with a MySQL query. I have two tables, one with offers and one with statuses. An offer can has one or more statuses. What I would like to do is get all the offers and their latest status. For each status there's a table field named 'added' which can be used for sorting. I know this can be easily done with two queries, but I need to make it with only one because I also have to apply some filters later in the project. Here's my setup: CREATE TABLE `test`.`offers` ( `id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY , `client` TEXT NOT NULL , `products` TEXT NOT NULL , `contact` TEXT NOT NULL ) ENGINE = MYISAM ; CREATE TABLE `statuses` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `offer_id` int(11) NOT NULL, `options` text NOT NULL, `deadline` date NOT NULL, `added` datetime NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1

    Read the article

  • MySQL connection attempt works fine in 5.2.9 but not in 5.3.0 - Help?

    - by Rich
    Hi, I'm having trouble making a secondary MySQL connection (to a separate, external DB) in my code. It works fine in PHP 5.2.9 but fails to connect in PHP 5.3.0. I'm aware of (at least some) of the changes needed to make successful MySQL connections in the newer version of PHP, and have succeeded before, so I'm not sure why it isn't working this time. I already have a db connection open to a local database. This function below is then used to make an additional connection to a separate, remote directory. The included config file simply contains the external database details (host, user, pass and name). I have checked and it is being included correctly. function connectDP() { global $dpConnection; include("secondary_db_config.php); $dpConnection = mysql_connect($dp_dbHost, $dp_dbUser, $dp_dbPass, true) or DIE("ERROR: Unable to connect to Deployment Platform"); mysql_select_db($dp_dbName, $dpConnection) or DIE("ERROR 006: Unable to select Deployment Platform Database"); } I then attempt to make this new connection simply by calling this function externally: connectDP(); But when loading the page (in 5.3.0), I get the message: ERROR: Unable to connect to Deployment Platform I'm using the optional new_link flag boolean as the fourth argument in the mysql_connect() function and it's still not working. I've been wracking my brain this morning trying to figure out why this connection doesn't work (while I've done something very similar elsewhere to a separate second database that does work). Any help would be appreciated. Thanks! Rich

    Read the article

  • Call from a singleton class to a function which in turn calls that class's method

    - by dare2be
    Hello, I am still looking for a way to phrase it properly (I'm not a native speaker...). So I have this class SQL which implements the singleton pattern (for obvious reasons) and I also have this function, checkUsr(), which queries the database using one of SQL's methods. Everything works fine as long as I don't call checkUsr() from within the SQL class. When I do so, the scripts just exits and a blank page is displayed - no errors are returned, no exception is thrown... What's happening? And how do I work around this problem? EDIT: class SQL { public static function singleton() { static $instance; if(!isset($instance)) $instance = new SQL; return $instance; } public function tryLoginAuthor( $login, $sha1 ) { (...) } } function checkUsr() { if (!isset($_SESSION['login']) || !isset($_SESSION['sha1'])) throw new Exception('Not logged in', 1); $SQL = SQL::singleton(); $res = $SQL->tryLoginAuthor($_SESSION['login'], $_SESSION['sha1']); if (!isset($res[0])) throw new Exception('Not logged in', 1); }

    Read the article

  • Magic Method __set() on a Instanciated Object

    - by streetparade
    Ok i have a problem, sorry if i cant explaint it clear but the code speaks for its self. i have a class which generates objects from a given class name; Say we say the class is Modules: public function name($name) { $this->includeModule($name); try { $module = new ReflectionClass($name); $instance = $module->isInstantiable() ? $module->newInstance() : "Err"; $this->addDelegate($instance); } catch(Exception $e) { Modules::Name("Logger")->log($e->getMessage()); } return $this; } The AddDelegate Method: protected function addDelegate($delegate) { $this->aDelegates[] = $delegate; } The __call Method public function __call($methodName, $parameters) { $delegated = false; foreach ($this->aDelegates as $delegate) { if(class_exists(get_class($delegate))) { if(method_exists($delegate,$methodName)) { $method = new ReflectionMethod(get_class($delegate), $methodName); $function = array($delegate, $methodName); return call_user_func_array($function, $parameters); } } } The __get Method public function __get($property) { foreach($this->aDelegates as $delegate) { if ($delegate->$property !== false) { return $delegate->$property; } } } All this works fine expect the function __set public function __set($property,$value) { //print_r($this->aDelegates); foreach($this->aDelegates as $k=>$delegate) { //print_r($k); //print_r($delegate); if (property_exists($delegate, $property)) { $delegate->$property = $value; } } //$this->addDelegate($delegate); print_r($this->aDelegates); } class tester { public function __set($name,$value) { self::$module->name(self::$name)->__set($name,$value); } } Module::test("logger")->log("test"); // this logs, it works echo Module::test("logger")->path; //prints /home/bla/test/ this is also correct But i cant set any value to class log like this Module::tester("logger")->path ="/home/bla/test/log/"; The path property of class logger is public so its not a problem of protected or private property access. How can i solve this issue? I hope i could explain my problem clear.

    Read the article

  • Strip H1 tag and its contents

    - by Andy
    How can i remove <h1>and its contents</h1> from the following line strip_tags(substr($article->content(),0,255) from this complete code <?php $last_articles = $this->children(array('limit'=>5, 'order'=>'page.created_on DESC')); ?> <?php foreach ($last_articles as $article): ?> <div class="entry"> <h3><?php echo $article->link($article->title); ?></h3> <?php echo strip_tags(substr($article->content(),0,255).'...', '<p><a>'); ?> </div> <?php endforeach; ?> Any help would be appreciated.

    Read the article

  • Regular Expression to get the size value of a CSS property?

    - by thiesdiggity
    I wrote a regular expression to get the size from a CSS property: /(([+-]?\d*\.?\d+(\s)*(px|em|ex|pt|in|pc|mm|cm)?)|thin|medium|thick)(\s|;|$)/i but for some reason its not working as intended. For example, when I run the following: preg_match_all('/(([+-]?\d*\.?\d+(\s)*(px|em|ex|pt|in|pc|mm|cm)?)|thin|medium|thick)(\s|;|$)/i', "border-bottom:1px solid #99999;", $matches); It outputs: 1px 99999; But I only want the 1px value returned. I understand why its returning the above but can't seem to figure out how to only return the size and not the color value. I tried using the following negative lookbehind but it's not working either: /(((?<!#\d{3}|#\d{6})[+-]?\d*\.?\d+(\s)*(px|em|ex|pt|in|pc|mm|cm)?)|thin|medium|thick)(\s|;|$)/i I want to use preg_match_all for those CSS properties that can have multiple size values (i.e. margin). Anyone have any ideas how to get this regex to return only the size values? Thanks for your help!

    Read the article

  • Concate String In MYSQL

    - by streetparade
    How can i concate this string in mysql desc=desc+$desct what i want is each time i insert a variable from PHP that the string is added to the string which was already in db and seperated with || the field desc should look like this desc 10||30||90||710 say i want to add the value 20 desc 10||30||90||710||20 then the desc field should look like this How can i implement this?

    Read the article

  • Force memcached to write to all servers in pool

    - by Industrial
    Hi everyone, I have thought a bit on how to make sure that a particular key is distributed to ALL memcached servers in a pool. My current, untested solution is to make another instance of memcached, something like this: $cluster['local'] = array('host' => '192.168.1.1', 'port' => '11211', 'weight' => 50); foreach ($this->cluster() as $cluster) { @$this->tempMemcache = new Memcache; @$this->tempMemcache->connect($cluster['host'], $cluster['port']); @$this->tempMemcache->set($key, $value, $this->compress, $expireTime); @$this->tempMemcache->close(); } What is common sense to do in this case, when certain keys need to be stored on ALL servers for reliability?

    Read the article

  • MySQL Query Where Column Like Column

    - by shmeeps
    I'm working on a small project that involves grabbing a list of contacts which are stored for each group. Essentially, the database is set up so that each group has a primary and secondary contact stored as, unsurprisingly, Group.Primary and Group.Secondary. The objective is to pull every Primary and Secondary contact for each Group and display them in a sortable table. I have the sortable table all worked out, but I have come across a small problem. Each primary and secondary field can have more than one contact separated by a comma. For instance, if Primary contained 123,256 , it would need to pull both Contacts with IDs 123 and 256. I had intended to use a query formatted like this: SELECT * FROM Group G, Contacts C WHERE G.Primary LIKE %C.ID% OR G.Secondary LIKE %C.ID% so that I could just skip the comma part, but I can't seem to find a working query for this. My question to you is, am I just overlooking something here? Is there a simple query that would let me do this? Or am I better off getting the groups and contacts separately, and combine the two later. I think the former is a little easier to understand when read, which is a plus as this is a shared project, but if that is not possible I will do the latter. This code is simplified, but it gets the point across.

    Read the article

  • Fast check if an object will be successfully instantiated in PHP?

    - by Gremo
    How can I check if an object will be successfully instantiated with the given argument, without actually creating the instance? Actually I'm only checking (didn't tested this code, but should work fine...) the number of required parameters, ignoring types: // Filter definition and arguments as per configuration $filter = $container->getDefinition($serviceId); $args = $activeFilters[$filterName]; // Check number of required arguments vs arguments in config $constructor = $reflector->getConstructor(); $numRequired = $constructor->getNumberOfRequiredParameters(); $numSpecified = is_array($args) ? count($args) : 1; if($numRequired < $numSpecified) { throw new InvalidFilterDefinitionException( $serviceId, $numRequired, $numSpecified ); }

    Read the article

  • A strange bug, is Mysql asynchronous?

    - by Farf
    Hello, I have a strange bug. I launch a PHP Unit test Suite. At the beginning, it executes a big query to initialize the database. If I put a breakpoint just after the execution of the sql, there is no problem and my tests pass. If I don't put any break point, they don't pass and say that the tables don't exist! It works as if the sql query was asynchronous! Do you have an idea of the bug? Or how to debug that? Thanks a lot in advance for your help, I'm lost! Farf

    Read the article

  • What is the below code

    - by Priyanka
    Hello, I am getting an issue wherein I am using FCKEditor, and once I type in something, in the source of FCKEditor, something like below is getting iserted automatically. <input type="hidden" id="gwProxy" /><!--Session data--><input type="hidden" id="jsProxy" /> <div id="refHTML">&nbsp;</div> Some hidden tag is getting inserted, which isnot getting diplayed here in my question. Can anyone tell me about this. Thanks in Advance

    Read the article

  • ctype_alpha but allow spaces(php)

    - by helloo
    I was wondering if one can allow spaces in a textfield when checking it with ctype_alpha. Since ctype_alpha only allows alphabetical letters, I don't know how to let the user enter space in the field. I did try using ctype_space but that didn't work. I simply want the user to be able to type only alphabets and they have a choice to include spaces if they "wish." I hope I will not have to use regexp as I am very new to all of this and hope to learn it at a later date. Below is some of the code...Thank you. elseif (!ctype_alpha($fname)) { echo "Your name may only contain alphabetical letters"; }

    Read the article

  • PHP preg_match Math Function

    - by Matt
    I'm writing a script that will allow a user to input a string that is a math statement, to then be evaluated. I however have hit a roadblock. I cannot figure out how, using preg_match, to dissallow statements that have variables in them. Using this, $calc = create_function("", "return (" . $string . ");" ); $calc();, allows users to input a string that will be evaluated, but it crashes whenever something like echo 'foo'; is put in place of the variable $string.

    Read the article

  • Using curl to submit/retrieve a forms results

    - by Jason
    I need help in trying to use curl to post data to a page and retrieve the results after the form has been submitted. I created a simple form: <form name="test" method="post" action="form.php"> <input type="text" name="name" size="40" />e <input type="text" name="comment" size="140" /> <input type="submit" name="submit" value="submit" /> </form> In addition, I have php code to handle this form in the same page. All it does is echo back the form values. The curl that I have been using is this: $h = curl_init(); curl_setopt($h, CURLOPT_URL, "path/to/form.php"); curl_setopt($h, CURLOPT_POST, true); curl_setopt($h, CURLOPT_POSTFIELDS, array( 'name' = 'yes', 'comment' = 'no' )); curl_setopt($h, CURLOPT_HEADER, false); curl_setopt($h, CURLOPT_RETURNTRANSFER, 1); $result = curl_exec($h); When I launch the page with the curl code in it, I get the form.php page contents but it doesn't not show the variables that PHP should have echo'd when the form is submitted. would appreciate any help with this. Thanks.

    Read the article

  • How can I "flip" an image using PHP?

    - by learner
    Here's what I've tried: $image = "images/20100609124341Chrysanthemum.jpg"; $degrees = 40; // Content type header('Content-type: image/jpeg'); // Load $source = imagecreatefromjpeg($filename); // Rotate $rotate = imagerotate($source, $degrees, 0); // Output imagejpeg($rotate); ...But I get no output. Can anyone tell me what's wrong with this?

    Read the article

  • php joomla session lifetime settings

    - by jtanmay
    I have searched through the google and also joomla forums but didn't got what exactly I was looking for. My main purpose is to set the joomla session live for ever. Many forums says its not good to keep a higher value (security issues) but I don't want to consider that right now. My question is : What if I set the session lifetime value to "0" (Zero), will the session be active for ever? or the user will NOT be able to login completely? Thanks, Tanmay

    Read the article

< Previous Page | 76 77 78 79 80 81 82 83 84 85 86 87  | Next Page >