php

Wordpress: Get list of users ordered by post count.

I am trying to come up with a function that will output a list of usernames in wp_users ordered by their post count. Right now I am able to get all users, and I am able to get post counts for individual users, but I am having a difficult time combining those two sets of data. any help would be greatly appreciated! I'm thinking I will ne...

cURL Html output different from original page when rendered

Hi. I am working on a project that involves fetching pages with cURL or file_get_contents. The problem is that when i try to echo the html fetched, the output seem to be different from the original page, not all images show up. Please i would like to know if there is a solution. My code <?php //Get the url $url = "http://www...

Should I place variables in class or constructor? PHP

My question(s) is one of best practices for OOP. Im using Codeigniter framework/PHP. I have a class: class Test() { var $my_data = array(); function my_function() { //do something } } Is it ok to declare $my_data in the class like that? or should it go in the constructor? Basically every function will be writ...

How can I separate admin menus?

Hello guys I would like to separate administrator menus (the menus that appear after login as admin) from normal menus. I have to show admin menus in some other blocks. I don't like to use any modules for this, let me know how can done this with code, Thank you ...

is it possible to define a interface Singleton in PHP?

I want to define a Singleton base type from which the user will derive his classes, so this is what I thought: interface SingletonInterface { public static function getInstance(); } abstract class SingletonAbstract implements SingletonInterface { abstract protected function __construct(); final private function __clone() {...

PHP & MySQL display problem.

I have a script that displays categories but I want the script to display only certain categories that the user picked which can range from 1 to many categories. What do I need to do to my script to fix this problem? An example would help out a lot. Here is my PHP script. function make_list ($parent = 0, $parent_url = '') { global ...

uploading PDF files with codeigniter

Hi I'm very new to stackoverflow and codeigniter so I apologize if I'm breaking any rules or etiquette with this question (I did a search of the related questions and didn't see anything that related directly to my question). I'm trying to upload a PDF file, and I'm using the following code (codeigniter version 1.7.2): function tes...

PHP Extension : Module 'hello' already loaded in Unknown on line 0

Hi all. My development environment: Linux - Linux localhost.localdomain 2.6.9-42. apache:2.2.4 php:5.2.3 I wrote a php extension hello. when i make test it show me: PHP Warning: Module 'hello' already loaded in Unknown on line 0 PHP Warning: Module 'hello' already loaded in Unknown on line 0 I check the php.ini , there is just...

nodeapi insert and presave

I've got the weirdest glitch. I'm using nodeapi and targetting the story node type. I have insert case before the presave case, where presave is being used instead of update. switch ($op){ case 'insert': //do some stuff break; case 'presave': //do some stuff break; } The weird thing is that when a story n...

Can't Connect to MySQL Server on IPAddress (10061)

Hi, I need to connect to a remote MySQL database and have created the following connection code: <?php /* Set Variables */ $host="myipaddress"; $db="mydbname"; $username="dbuser"; $pass="mypass"; /* Attempt to connect */ $mysqli=new mysqli($host,$username,$pass,$db); if (mysqli_connect_error()){ die('Connect Error (' . mysqli_connect...

How to prevent a combo box from droppping down in HTML?

The user sees a web form with a bunch of controls. One of them is a combo box (drop down list) with several options. He selects one and hits the submit button. My PHP form action validates the input & shows the submission as a read-only version of the input form for confirmation. I would like to prevent the combobox from dropping down,...

Scrape unique image URLs from HTML

Using PHP to curl a web page (some URL entered by user, let's assume it's valid). Example: http://www.youtube.com/watch?v=Hovbx6rvBaA I need to parse the HTML and extract all de-duplicated URL's that seem like an image. Not just the ones in img src="" but any URL ending in jpe?g|bmp|gif|png, etc. on that page. (In other words, I don't ...

Add a project to a site step-by-step

I have web-site and I need to create that step-by-step adds: Selecting Country, city, etc more information about project Photos Message/etc How is correct to do these steps? Get paraemtrs like step/1/ and get info from DB on every step, use $_SESSION(Save step num, info from prev.) or.. ? in each step i need to get information from p...

PHP script to list total posts by users

I have a database with two tables, Users and Posts. I'd like to write a php script to list, in order, the top 20 usernames with the number of posts they've made. The username field is cUsername in the Users table. The Users table intUserID field and the Posts table's intPosterID field correspond to eachother. Any help would be much appr...

Trying to send mail using yahoo smtp in php.

Please can some one suggest me codes to send mails using yahoo smatp, and php.. require("class.phpmailer.php"); // be sure to change this to your location! $mail = new PHPMailer(); $mail->IsSMTP(); $mail->SMTPAuth = true; // enable SMTP authentication $mail->SMTPSecure = "ssl"; // sets the prefix to the servier $mail->Host = ...

Simulate an AJAX call in PHP for unit-testing

Background: I am attempting to do a couple of unit tests on AJAX requests which would call PHP functions on the server-side. As this involves database manipulation, I have decided to check the return of the calls using unit tests in PHP. Given the URL of an AJAX request, how do I call it and gets its response? *Added question:*If the ...

Collapsing parts of PHP code in an IDE (Eclipse)

Hi Guys, I am trying to find the best PHP IDE for me on the Mac, I like Eclipse and Netbeans but I for some reason I can't collapse PHP code, it only collapses the HTML parts, I'm guessing that I am missing an option somewhere? Both Coda and TextMate can collapse php code ok but I need code completion and realtime syntax checking. Any ...

PHP While Loop Question.

How can I turn the code below into a single array when its in the while loop? An example would help. Here is my PHP code. while($row = mysqli_fetch_array($dbc)){ $category = $row['category']; $url = $row['url']; } ...

Problem with special characters and multilanguages

Please i have asked this question before, hopin to get responses this time I created a simple comment wall that submits using ajax. Using javascript i collect user input: var sharetxt = encodeURIComponent(document.getElementById("cw_share_txt").value); then pass it to a php page, on the php page, i collect the passed data: $text=n...

MYSQL syntax error

HI everyone i tried for 3 days and i'm not able to solve this problem. This is the codes and i have went through it again and again but i found no errors. I tried at a blank page and it worked but when i put it inside the calendar it has the syntax error. Thanks a million for whoever who can assist. /** QUERY THE DATABASE FOR AN ENTRY F...