php

how can i show actual source code in a div

i want to show a part of my source code with color coding in a div for allowing users to get reference of code..now how can i show the actual php jquery or any other language source code with colors in a div. ...

PHP DOM: change doctype of existing DOMDocument

When creating a DOMDocument with DOMImplementation::createDocument(), you can specify a doctype as the third argument in the constructor. This doctype then gets "tied" to the document and you can retrieve it later with $document->doctype. However, this is a read-only attribute (unlike encoding and version!). Is there any way to change...

PHP error driving me crazy

Fatal error: Call to undefined method CI_DB_mysql_driver::num_rows() in C:\Development\Zend\Apache2\htdocs\system\application\controllers\signup.php on line 47 Can anyone help me out, this error is driving me crazy. Using latest CodeIgniter. function isUniqueUsername($string) { $query = $this->db->select('username') ...

How to validate phone number using PHP?

How to validate phone number using php ...

php dynamic creation nested divs

hi i would like to create nested divs dynamically, preferably without javascript so if you have n divs, div1 contains div2 which contains div3 which etc ... how could I code that in php ? Tom ...

Searching a mySQL database

Hi guys, I am storing a bunch of user ID's inside of a mySQL database along with other data relative to each uid, but now I would like to implement a check in the beginning of the program which basically goes like so, if the user already exists, get the specified fields for that specific user and assign them to variables, else return nul...

Check if a key exists in Memcache

Hey! How do I check in PHP if a value is stored in Memcache without fetching it? I don't like fetching it because the values I have set are all 1MB in size and after I fetch it, I have no use for it, so I'm wasting resources. I'm using this in a script that checks if certain keys are cached in memcache and if not, it reads them from a s...

php curl for facebook post tweet

hi i want post tweets into facebook using php curl , this is my snippet i used for posting tweet into FB , FB CURL SNIPPET But i am not find any updated tweet in my facebook , am not sure but i thing somthing goes wrong, can u tell me, snippet is correct one or not , Thanks ...

Copy DOMNodes from one DOMDocument to another

Hi everybody, I've been trying to combine two XML documents like this: $def = new DOMDocument( '1.0' ); $rdef = new DOMDocument( '1.0' ); $def->load( $path ); $rdef->loadXML( $info ); $r = $def->getElementsByTagName( 'repository' )->item( 0 ); $s = $rdef->getElementsByTagName( 'repository' )->item( 0 ); try { $r->appendChild( $s );...

Making a row inactive in MySQL

Is it possible to make a row in MySQL inactive? So this row isn't used in the results of queries anymore? My client wants to keep the deleted members exists in the database, but I don't want to edit all the queries to check if the member is deleted or not. Or is there an easy way to move the entire row data into another "inactive" tabl...

How to do PHP matrix operation easily and gracefully?

I've a $max which is essentially a two dimensional array. Each element in $max is eithor 1 or 0, can be denoted by $max[$x][$y], where $x is an integer within 0~WIDTH,similar for $y My purpose is to find rows and columns in the $maxthat sums up greater than a CONSTANT, and get the average distance between rows/columns that qualify. ...

Testing controller with Zend_Test

Hi there, I asked the same question in another forum, but I don't yet have any luck there. So please allow me to ask the same question here. I want to setup Zend_Test to test my controller code (I am using PHP, Zend Framework). Everything seems to be correct and according to the official documentation, but I kept getting an error. For...

better image quality for gif with gd library in PHP

Hello, i create a transparent gif with text with the gd library but the output quality of the Text isn't good. Has anybody an idea how can i improve the quality? Here is the code: $req = explode('|', $_REQUEST['r']); $text = $req[0]; header ("Content-type: image/gif"); $font = getFont($req[2]); $font_size = $req[1]; ...

Doing a URL re-write while using PHP GET method

Hello, When I click on a comment section for a given entry on a site I have, the URL looks like this: http://www...com/.../comments/index.php?submission=Portugal%20Crushes%20North%20Korea&submissionid=62&url=nytimes.com/2010/06/22/sports/soccer/22portugalgame.html?hpw&countcomments=3&submittor=johnjohn12&submissi...

MySQL: applying a random sort on multiple columns

Hello. In order to have a well scrambled table (for a psychological experiment), I'd like to sort each column of my array by RAND(). Althrough this code works: SELECT Sort.Variable1, Sort.Variable2 FROM Sort ORDER BY Variable1, Variable2 ASC LIMIT 0 , 30 replacing "ASC" by "RAND()" make the query fail. Can someone give me an advice (e...

Integrating Checkout by Amazon in Magento

I am using Magento 1.3.2. I have entered all the details which are needed for Checkout by Amazon in the admin back-end. But the problem is when I log into user side to do the payments I cant see the Checkout by Amazon Payment option. Checkout by Amazon option is not visible in the front end during the checkout process.Can anyone figure i...

How to get average distance between array values in PHP?

For the array below, it's ~20 but how to get it programatically? array(12) { [0]=> int(29) [1]=> int(50) [2]=> int(72) [3]=> int(93) [4]=> int(114) [5]=> int(136) [6]=> int(157) [7]=> int(178) [8]=> int(199) [9]=> int(221) [10]=> int(242) [11]=> int(263) } ...

How to check if php-fpm is installed and running correctly?

As in title, how to check fpm status? running? serving how many requests? Thanks. ...

Numerical equivalent of nameValuePair array list?

Hi Guys, I'm dealing with doubles and looking for the "double" equivalent of this... ArrayList<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(); nameValuePairs.add(new BasicNameValuePair("lat",lat)); nameValuePairs.add(new BasicNameValuePair("lng",lng)); edit// I'm making a HTTP request, I think need to map the lat val...

Zend problem with a form

Hi every one first of all im new in zend and i need some help to start. My problem is I have a login for like this <form action="<?php echo $this->baseUrl ?>/user/login" method="post" id="login"> <input type="text" name="username" value=""/> <input type="password" name="password" value=""/> <input type="submit" name="submit...