I am building a ranking system that takes data(totals) from the database and ranks them from the highest to the lowest.Here is the code:
$data = array(
'A'=>19,'B'=>18,'C'=>17,'D'=>17,'E'=>16,'F'=>15
);
//Populate the arrays with data from mysql
/*
--
-- Table structure for table `data`
--
CREATE TABLE IF NOT EXISTS `data` (
`id` i...
I have two arrays
$data1 = array()
$data1 = array( '10','22','30')
and also another array carries
$data2 = array()
$data2 = array( '2','11','3');
I need to divide these two arrays(ie,$data1/$data2) and store value to $data3[].
I need to get it as follows
$data3[] = array('5','2','10')
If someone knows of an easy way to do this ...
hi i have to upload a video.but i want to gives permission only authenticate user to download .but i have a problem in that.because if any body type the video detail in browser.(ex http://sitename/folder_name/videoname) then browser download that video.but i don't want this .please suggest me how can i resolve this problem.either i shoul...
For example: an youtube embed code
<object width="480" height="385">
<param name="movie" value="http://www.youtube.com/v/TFlzeO267qY&hl=en_US&fs=1&"></param>
<param name="allowFullScreen" value="true"></param>
<param name="allowscriptaccess" value="always"></param>
<embed src="http://...
i have around (1,049,906 total, Query took 0.0005 sec) in my x table ,
If i simply retrieve trying to retrive the particular field records ,
Its tooks hardly 6 mins ,
This is my query
SELECT CUSTOMER_CODE FROM X_TBL ;
CUSTOMER_CODE => UNIQUE
THE ABOVE QUERY TOOK 6MIN ,
Tel me optimization tips for this ,
Also in some situatio...
This is the code I have:
<?php
$start = memory_get_usage();
$table = new Zend_Db_Table('user');
for ($i = 0; $i < 5; $i++) {
$row = $table->createRow();
$row->name = 'Test ' . $i;
$row->save();
unset($row);
echo (memory_get_usage() - $start) . "\n";
}
This is what I see:
90664
93384
96056
98728
101400
Isn't it a memory le...
Actually I am looking for the best HTML editor for my CMS. With support for PHP and jQuery.
I found TinyMCE but it doesn't have image upload functionality. Then I found phpimage, but every time I go to http://sourceforge.net/tracker/?func=detail&aid=2844769&group_id=103281&atid=738747 and click on "files", I get the normal T...
Hi,
I am developing pages in php dynamically i.e data gets filled up from mysql DB. how do i assign a proper meta data and description for these dynamic pages so that google recognises it properly.
What needs to be passed in page so that google takes description properly. when i search a page in google. it takes the data in page as des...
Hi
How to find my code execution time ,
Am using the below snippet,
am not happy with that ?
list ($msec, $sec) = explode(' ', microtime());
$microtime = (float)$msec + (float)$sec;
Regards
...
$httpsock = @socket_create_listen("9090");
if (!$httpsock) {
print "Socket creation failed!\n";
exit;
}
while (1) {
$client = socket_accept($httpsock);
$input = trim(socket_read ($client, 4096));
$input = explode(" ", $input);
$input = $input[1];
$fileinfo = pathinfo($input);
switch ($fileinfo[...
This has been driving me mental, for hours and hours now..
There don't seem to be any concise tutorials/walk throughs for installing ImageMagick on WAMP for use with PHP.
I've tried dozens of combinations of their binary releases with different php extension dll files. I can get imagemagick working fine from the command line and i can ...
PHP has many built-in functions to validate numbers but they all expect input in computer format: 1234.56. I need to validate stuff like 1,234.56 (English) or 1.234,56 (Spanish), together with some typical attributes (accepted range, max number of decimals, etc.).
I started writing my own function but I soon got lost. It's easy to read ...
I have to validate that maximum 3 checkboxes are clicked. There are 11. How could I do this efficiently and without testing every possible situation?
...
Hey,
I want to include a file to be accessible to any method/function in a PHP class. The file just contains a base-64 encoded variable. How do I do this?
Thanks.
...
I'm trying to make a blogging system but obviously certain users in certain groups should only be able to edit/delete their own posts/comments. How would I go about doing this in CakePHP? I followed the manual's basic Acl guide to setup my current Auth system.
...
I want to sort the properties of an object so I can loop through them in a defined order.
for example: I have an object 'book' with the following properties: 'id', 'title', 'author', 'date'.
Now i want to loop through these properties like this:
foreach($book as $prop=>$val)
//do something
now the order of the loop has to be 'title...
Hello,
I am using a login system that works well. I am also using a comment system. The comment function does not show up unless the user is logged in (as shown in commentformonoff.php below).
When a user makes a comment, the info is passed from the function "show_commentbox" to the file comments2a.php. Then, the info is passed to t...
i ahave a form in which i need to upload the files of 50 mb, for which I want to use Uber uploader as it supports upload more than 10mb , but I am unaware of how to integrate the uber uploader in my project.. I am new to this and PECL and APC things used in project, I also cam to know that it needs linux server, which my client dont have...
Why $_SERVER['HTTP_REFERER'] (PHP) and Request.ServerVariables("HTTP_REFERER") (ASP) return different result if query string has non english characters?
php return correct value but asp will not:
php: сабака
asp: ׁ׀°׀±׀°׀÷׀°
...
I am trying to create folder like this
$destination = "../enumesis.com/_pcode/../_compile";
mkdir($destination);
But this gives error
UPDATE
What i am doing is, taking ../enumesis.com/_pcode as input from user and I want to create a folder outside the _pcode Directory
Here is my error
Warning: mkdir() [function.mkdir]: No such file...