Hey everyone!
I'm building a webapp in PHP that uses a MySql DB. What I want to do is for example when someone tries to access to a page, but the DB throws an error, to display a HTML (or redirect) page with the HTTP code 500. Something like the "fail whale" in Twitter.
Is that possible?
...
I'm trying to dynamically generate a csv file with some cells that will contain multiple lines, the address field for example will need to be grouped into a single "address" cell instead of address,city,state etc. All is going well and but for the last two days i've tried to insert \r, \r\n, \n, chr(10),chr(13), as well as a carriage ret...
I'm very new to PHP, SQL I've worked with using Coldfusion but only with very simple queries. In coldfusion to access a specific database
<cfquery dbname="blah">
I know in PHP I have to use mysql_query() and mysql_connect(), and here is the code I have, so I understand how to access a server and a table, but not the database. How can ...
I'd like to implement a forgot password function for my website. I hash the passwords using sha1. How would I recover this for the user?
What's the best method for implementing this?
...
Out of tons of questions and answers here about manipulating PDF's with PHP, but none of them seem to fit my requirement.
Programmatically, I want to be able to update the content of editable fields. Preferably with PHP. If it matters, the PDF files will be initially hand crafted (as sort of 'template' files that will be copied and fi...
The . character in a php regex accepts all characters, except a newline. What can I use to accept ALL characters, including newlines?
...
Example:
I need to manage users in a website,'manage' means: register and allow them to send comments.
user registration will use: username, email, password and user_id
comments will have: date, link, text and user_id
Now, I have several projects with similar structure - give or take a table/field or two..
I hate writing it all again a...
I manage a website which houses several pieces of Seller and Buyer(member) information. In order to cut costs, we decided we wanted to launch an all-web-based CRM system which allows us to look into customer information, update that information, perhaps process payments/change payment schedules, etc.
Similarly, our site houses several p...
Is it possible to create HTML output from the contents of an HTML snippet that has been extracted via PHP's DOM tools (e.g. $div = $dom->getElementsByTagName('table')->item(0);) such that the HTML created contains just the elements with specified tag name, and their descendants?
Otherwise, are there perhaps any other ways to easily ext...
I save my array of integers in a custom fields with the function:
update_post_meta($post->ID, "images", array(1, 2, 50));
How can I load this array now?
I try to use something like this, but without any luck:
global $post;
$custom = get_post_custom($post->ID);
$myarray = $custom["images"][0];
echo $custom["images"];
It returns som...
For this Wordpress site, I need to generate 24 variables each of which contains a number between 1 and 24. The problem is that two variables cannot have the same value. So I basically need to generate 24 variables each of which contains a number between 1 and 24.
Here's the code that I am using to generate a random number.
$mirza = ran...
I've got this query so far:
if(!empty($_SESSION['s_property_region'])) {
$sqlWHERE .= " AND $wpdb->postmeta.meta_key = 'property_region' AND $wpdb->postmeta.meta_value = '".$_SESSION['s_property_region']."'";
}
if(!empty($_SESSION['s_property_bedrooms'])) {
$sqlWHERE .= " AND $wpdb->postmeta.meta_key = 'property_bedrooms' AND $...
So I hadn't done any regexps for a while, so I thought I'd brush up on my memory. I'm trying to convert a string like a*b*c into a<b>b</b>c. I've already gotten that working, but now I want to keep a string like a\*b\*c from turning into a\<b>b\</b>c, but rather, into a*b*c. Here's the code I'm using now:
$string = preg_replace("/\...
I have a php file which prints an xml based on a MySql db.
I get an error every time at exactly the point where there is an & sign.
Here is some php:
$query = mysql_query($sql);
$_xmlrows = '';
while ($row = mysql_fetch_array($query)) {
$_xmlrows .= xmlrowtemplate($row);
}
function xmlrowtemplate($dbrow){
return "<AD>
...
PHP's range function work like this in php :
$leap_years = range(1900, 2000, 4);
creates array like 1900, 1904, 1908, ...
Is there something simple like this in Java?
...
I have a domain and CPanel account with a host from which I can create email accounts.
I want to write a PHP script to connect to any of the created email accounts provided the username and password and view all the emails sent to this email inbox.
If this is possible I would like to have a guide in creating this kind of script.
...
I was reading somewhere that PHP is a templating language. What is exactly a templating language? What makes PHP one? What are the other templating languages?
...
I'm using these libraries for an email application I'm building.
$storage = new Zend_Mail_Storage_Imap($imap);
if (strpos($storage->getMessage($i),'chocolate') !== FALSE )
{
//Move to chocolate folder here
}
Also, is there a way to put incoming emails from this sender to automatically go into the chocolate folder from now...
Back-Story
On a current project, I am using MySQL and SQLite in combination with each other. I'm currently giving each user their own SQLite database to get around my provider's 1GB MySQL DB limit. It's worked out alright and the performance is good, but I know for a fact that continual maintenance of these flat-file databases will be a...
Environment: Linux / MySQL / PHP
Problem: While connected to a webservice, I am getting a response that is compressed with the SharpZipLib .NET library. As of yet, I have not been able to find a way to decompress these responses outside of a .NET environment.
Does anyone know a way to decompress this in a linux/php environment? Thanks!...