Include PHP Scripts which run functions?

I am looking to create a plugin manager like program which starts a loop that searches for .php files in the ‘plugins’ folder. I need this to somehow run a function called main() in each file which will then run other functions. How could i accomplish this without the other main() functions clashing and would [...]

Writing data to file using PHP and AJAX not working

I am trying to save json data to a file using AJAX and PHP but the resulting file is empty. Why is it not working?
Here is the HTML:
<!DOCTYPE html>
<html>
<head>
<script src=”http://code.jquery.com/jquery-latest.js”></script>
</head>
<body>
<script>

var dataset = {“value1″: 2, “value2″: 1000};

$.ajax({
url: ‘save.php’,
type: ‘POST’,
data: dataset,
success: function() {
[...]

Mongo DB installation not working with PHP

I am trying to install mongodb with php 5.2 on CentOS, I run phpinfo(), says mongo is not installed. PHP is working fine. I installed mongodb, and can enter the shell. I did “pecl install mongo”, says it was completed and installed properly. I add a mongo.ini file which is “extension=mongo.so”. I can go to [...]

drupal 7 modify custom field markup

I added a field on the page content type called ‘Page Title’ (machine name field_machine_name).
I want to modify the markup for this field on the page. The default markup is something like this:
<div>
<div>
<div>FIELD VALUE</div>
</div>
</div>

I want it the markup to be
<div>
[...]

Looping through $_POST

I have a MySQL database with the table “chapters”. The table “chapters” has three columns: (1) id, (2) name, (3) password.
I am using PHP to dynamically output the data from “chapters” into text boxes. The result looks something like this:
<form name=”current_chapters” method=”post” action=”UpdateChapters.php”>
<input type = ‘text’ name=’id’ value=’{$row['id']}’>
<input type = [...]

Magento Fatal Error: Call to member function getSku() on a non-object

I have come across a bizarre error in the Magento shop I’m developing and despite my inquiries online, it appears no one else has ever seen this exact error under the same circumstances. Lemme ‘splain.
The full text of the error message is this:
Fatal error: Call to a member function getSku() on a non-object in /path/on/server/app/code/core/Mage/Catalog/Model/Product/Option/Type/Select.php [...]

Trying to make a forum – are there any good tutorials?

For the past few days I’ve been trying to create my own personal forum (for practice/exercise). I first started in pure PHP but I found that kind of dull and I found out that today’s trend is 1-page-websites using Backbone.js and some sort of backend (Django, Rails, Slim).
Thing is, I have no idea whatsoever where [...]

PHP MYSQL Update query

I currently have the following update statement but is there anyway that I can make it retain the current values but insert and new values that are not in the db?
If not what would be the best way to achieve this?
UPDATE INTO {refocus_candidate_category} SET canid=?, categoryid=? WHERE canid=? AND categoryid=?”,array($emailCheck['id'], $id, $emailCheck['id'], $id));
Function:
$catParams = array_merge(array($emailCheck['id']), [...]

PHP – warning – Undefined property: stdClass – fix?

I get this warning in my error logs and wanted to know how to correct this issues in my code.
Warning:
PHP Notice: Undefined property: stdClass::$records in script.php on line 440
Some Code:
// Parse object to get account id’s
// The response doesn’t have the records attribute sometimes.
$role_arr = getRole($response->records); // Line 440

Response if records [...]

What is the best/simplest way to do multi-tiered sorting?

I’m working on a function to do multi-leveled sorting (sort within a sort, for a lack of better term) for a client. Say we have a list of objects with different attributes such as:

name – object’s name
type – object type
date – some date attribute

Let’s say I wanted to sort the list first chronologically, then by [...]

Hire Me
Follow Me!
Search
Most Popular Articles & Pages
Because your vote is Important
Sorry, there are no polls available at the moment.
Categories