php

Re-notify user of account in Drupal

When a user signs up at a Drupal site, there is a configurable message that Drupal will send the user letting them know their username and password. I have about 1,000 users that I imported, but at the time, I didn't want to notify them - but now I do. Is there a way notify the users without reimporting them? I looked through some of t...

What is the cleanest way to design form processing to support AJAX-capable browsers and non-AJAX browsers?

I'm using PHP, and am wondering what the best way is to handle simple POSTs and AJAX POSTs without repeating code in the simplest way possible. Thanks! ...

What is the proper way to update all elements of a rendered page via AJAX?

I have a complicated page being rendered by PHP and would like to keep all elements of the page up to date via AJAX long polling. Is there some kind of general / clever way to design an infrastructure to support this without having to specify manually each element to update? Just looking for ideas. Thanks! ...

What data type would I use if I want to save a file from a user using PHP and MySQL?

I want users to be able to upload their CV in PDF, .txt, .doc, .docx; and allow potential employers to download the file. What data type should I use? In MS MSQL, I would use varbinary(max), right? But since I'm new to MySQL I'm a bit confused. :) ...

Need a little feedback about my database design, pretty straightforward.

I'm going to allow companies to register on my website and create job listings. I'm currently approaching the problem by creating a Company table with Name, Logo and Password fields. Then when a person registers he can say, "I belong to X company"; at this point, I'll request the password written in by the initial registrator. If she/he...

emailing with php

What's wrong with this...? I don't get an email back... Also, does the from address have to be a real address? If I run this on a computer that doesn't have Outlook Express, will it not work? How can I make it work on computers like that? <html> <head> <title>Test php</title> </head> <?php $to = "[email protected]"; $subject = "te...

highlight search keywords in text

I am using this class to highlight the search keywords on a piece of text: class highlight { public $output_text; function __construct($text, $words) { $split_words = explode( " " , $words ); foreach ($split_words as $word) { $text = preg_replace("|($wo...

In PhpDocumentor, is there a way to specify a default version number?

All the files in the code base I am documenting will always use the same version "string" Is there a way I can specific in a single place for the PhpDocumentor to use the same version for all files, regardless if it is specified or not (should auto-inherit) ...and what other tags would this be useful for off the top of your head? Edit:...

PHP calling a function with variable amount of parameters.

So I've run into a bit of an issue. I know of a solution but it doesn't seem very clean and I'm wondering if there's a better one. I'm writing a MySQLi wrapper for running prepared statements. As it's a wrapper and is meant to be reused (dynamic) the amount of columns returned depends on the query and isn't static. The one solution to ...

PHP/MySQL group results by column

Hello, in order to keep as few SQL statements as possible, I want to do select set from MySQL: SELECT * FROM products WHERE category IN (10,120,150,500) ORDER BY category,id; Now, I have list of products in following manner: CATEGORY - product 1 - product 2 CATEGORY 2 - product 37 ... What's the best and most efficent way to pr...

MySQL - Order by number of chars

I have the most simple SQL SELECT * FROM words It has 13000 words (varchar). I need to get the longest word first in my output. I guess it might be possible with the WHERE command? Alternative If it doesn't work like that, is there a smart way to sort my output array so it will order it by the longest word first (in the 'word'-colum...

Access denied for user 'speedycm_root'@'localhost' to database 'speedycms'

been trying to set up a webserver with uk2.net all day but i keep receiving the following error when i try to log in: Access denied for user 'speedycm_root'@'localhost' to database 'speedycms' what could it mean? <?php # FileName="Connection_php_mysql.htm" # Type="MYSQL" # HTTP="true" $hostname_speedycms = "localhost"; $database_spee...

Boolean value turns numeric in PHP

EDIT: I believe my confusion is probably created by this code at the top of the page in which I'm testing for the value of the option... This creates a shortcut method to refer to the option without using the get_option('option') method... global $options; foreach ($options as $value) { if (get_settings( $value['id'] ) === FALSE) { ...

PHP versions "market share"

Hi, Does anyone know where can I find recent data on PHP4 vs PHP5 "market share", that is, what percentage of servers on the Internet have PHP5 installed? I found this but it's from 2008: http://www.nexen.net/chiffres_cles/phpversion/18824-php_statistics_for_october_2008.php I also checked netcraft.com but I don't think they have some...

How to implement a read-only member variable in PHP?

When trying to change it,throw an exception. ...

jQuery Post to PHP to Redirect?

Hi all, I'm trying to figure out if I can do the following: User submits form to script via jquery post Depending on what was processed, script may or may not return errors If the script did not process any errors (i.e. SUCCESS), I want to redirect to a SUCCESS page I know it's possible to redirect the browser via javascript, but I'...

saving mySql row checkpoint in table ?

hello, I am having a wee problem, and I am sure there is a more convenient/simpler way to achieve the solution, but all searches are throw in up a blanks at the moment ! I have a mysql db that is regularly updated by php page [ via a cron job ] this adds or deletes entries as appropriate. My issue is that I also need to check if any...

In PHP, are there any advantages to using forward_static_call_array() instead of call_user_func_array() when dynamically calling a static method?

Specifically, is one more efficient than the other? ...

How to use Jquery ajax to set $_SESSION?

I am trying to create a simple log in system that uses ajax but the problem I am having it wont set the $_SESSION. login.js: $('#bt-login').click(function(){ var login = $('#login').serialize(); $.ajax({ type: "POST", url: 'widgets/Login/loginFunction.php', data: login, c...

Connecting to SQL Server in Php - Extension Err

<html> <head> <title>Connecting </title> </head> <body> <?php $host = "*.*.*.*"; $username = "xxx"; $password = "xxx"; $db_name = "xxx"; $db = mssql_connect($host, $username,$password) or die("Couldn't Connect"); $selected = mssql_select_db($db_name, $db) or die("Couldn't open database"); ?>...