php

PHP intersect vs MySQL intersect

I have a column of data in a table (1) which I have to check against the column of data in several hundred (or thousand) other tables. Would it be faster to do this as a mysql query intersecting both tables, or to get the data from table (1) into an array, and then set the other columns of data as arrays and intersect? It's MySQL and P...

Does the word "object" have any special meaning in PHP?

Adobe Dreamweaver highlights the word object in PHP sources and I'm wondering why. It's definitely not the name of the generic class, which is generic (Edit: sorry, it's actually stdClass not generic, which I always define myself in all projects). And as you might have guessed it's not easy to google for answers to this question. ...

score board php/Mysql

I have a database which stores the username score timestamp (i use the Unix time() function) Whenever user does a specific task the score is increased and corresponding time stamp updated. I want to retrieve the score board with usernames and scores.Ordering the scores with respect to the scores is easy (iam using ORDER BY score...

Php redirect and seo

I have a client that uses Google Base with their eCommerce store. They want to redirect all of their specific product links (i.e. white-large-shirt.htm, red-medium-shirt.htm) to the configurable url (i.e. shirt.htm). This is so the customer when clicking on the white-large-shirt link in Google Base can be redirected to the page where t...

PHP strpos(), echoing instances found

Using the strpos() function in PHP, how can I echo what strpos() has found? All items that it has found. Thanks ...

Using php://input and file_put_contents

I'm receiving files (images) uploaded with Ajax into my PHP script and have got it to work using this: $input = fopen("php://input", "r"); file_put_contents('image.jpg', $input); Obviously I will sanitize input before this operation. One thing I wanted to check was the file size prior to creating the new file, as follows: $input = f...

PHP CURL: Complete manipulation of HTTP Headers not allowed?

I've been working on writing a script which automatically logs me into my school's network, checks if the classes I'm trying to get into are no longer completely full, and if a spot has opened up, registers the class for me. However, I've hit a big snag in just the logging-in process. Basically, I've been looking at the headers that are...

Replace mysql->php->mysql with nested query

Hello all, I have a table with columns 'customer' and 'location' and I need to check top 10 locations visited by unique customers. I'm ready to do the following: SELECT location FROM myTable GROUP BY location load results to an array (maybe a hundred of few hundreds of locations) SELECT COUNT(*) AS total, tbl.location AS LOCATION FROM...

jeditable and spam

Has anyone ever used google reCAPTCHA with jEditable? I'm using PHP as a back-end. When data is sent (and validated) from jEditable via AJAX: I show the the reCAPTCHA widget, but as soon as the user clicks on it: it inevitably turns into the textbox for editing. All I'm basically asking is how would you use reCAPTCHA with jEditable? Sho...

What is the more effective dev/test/prod environment setup for PHP development..?

Unfortunately, I've never had a senior developper or mentor to show me some of the best practices. So I develop sites (php/mysql) on my Windows machine with WAMP, I test in hidden (password restricted) folders on the production server and finally move sites to production folder. I would like to have a more fluid/practical/error-proof se...

Export from PHP to Excel

I need to export data from php to Excel, and be able to format various items in the excel spreadsheet. So far, the best library that I have found is PHPExcel (http://phpexcel.codeplex.com/). However, it seems very heavy, and somewhat slow. Granted, it is very powerful. Is there anything a bit more lightweight and faster, that allows me...

php syntax..giving error

$sql='UPDATE Reg_Stud SET Result=$perc WHERE RegID="$_SESSION['id']"'; Whts wrong with this syntax ...

Cannot change php session cookie name

I copied an existing and successfully running site to a new development server. The login on the new server is now broken, and I tracked it down to the fact that although the session cookie is renamed ... ini_set('session.name', 'DOMAIN1'); ... the browser keeps storing the sesssion cookie as PHPSESSID. When I remove the above line...

popular search statistics

Does anyone know a script or API I can use in my website to display search statistics (from popular search engines) for various keywords? e.g Google Tv, Black Ops.. ...

How to limit items from while loop

This is my while loop from my project : <?php $select = "SELECT * FROM nk_showcase"; $query = $db->rq($select); while ($user = $db->fetch($query)) { ?> <div class="index"> <a href="details.php?id=<?php echo $user['id']; ?>"><img width="200" height="171" alt="<?php echo $user['title']; ?>" src="<?php echo $url; ?>/i...

Is it necessary to use PHP in order to create an automated form for a web page?

Hi all, Is there an easy way to set up an automated form on a web page that sends info to a specific email address after being filled out? I don't know much about php, but someone mentioned it as a possibility. I would like to create a form that gets filled out and sent to a server email address automatically. Preferably without having ...

php memory overflow multi curl

Hi all, I have a PHP routine that I call shell_exec to traverse my own website and build an index. However since I do this multi-threaded I have been running into problems with memory storage...server memory spikes to 250MB then back down to 100MB randomly. I am constantly accessing the mysql database during this time; and the php sl...

What can be the best Practice for a Rapid Web Application Development?

Hello friends, I am coming up with a web application which will be primarily based on PHP. I would like to know some of the best practices and technologies that I can make use of to come out with the app as fast as possible. My team will be working remotely, so I want to know the best ways of collaborating through web resources too. I'm ...

Magento - Passing data between a controller and a block

Really quick and simple question but I can't find a decent answer to this - What is the best way to pass data from a controller to a block in Magento. Incase it makes a difference, I am loading the layout as follows: $this->loadLayout(array('default', 'myModule_default')); $this->_initLayoutMessages('customer/session') -...

Facebook "Like" produces "There was an internal error when updating the Page."

I added a like button to my blog a few months ago and things have been working perfectly. Suddenly I added a new post this morning, and for whatever reason, the like button is now broken. Everytime I click "Like" I receive this error: There was an internal error when updating the Page. There is no additional information. I used F...