I have two arrays of values that I would like to combine - but the only methods that PHP provides seem to combine by key instead of value. Here is a hack that I was able to use to get this to work, but I am wondering if there is a better method or a native function that I have missed. It's been a while since I last used arrays and it see...
I'm looking to integrate some email features into my system, and I'm not too impressed by using mail() to send mails, as the function is quite limited in what it can do.
Ideally, I'd like a framework or something I can integrate into my system, that would allow me to generate the messages in my own way, and then send them off.
A coupl...
I need to collect data (text and radio button / dropbox / checkbox selections) on a web form, store it somewhere, then provide the ability for users to display similarly collected data from other users, as well as search, sort, and filter the aggregate data. I can probably handle building the web form via PHP, but I'm not sure how to do...
By default, phpMyAdmin shows me 30 rows whenever I load a table (the query contains "LIMIT 30"). I generally want to see (up to) a few hundred rows.
Is there a way to change that default setting?
...
So far I have simple "numbers" only ...
/^[0-9]+$/
How can it be done to not allow leading zero (not start with zero) or preg_replace that would remove all spaces and leading zero ?
Thank You
...
I was told in a previous question that my query is prone to SQL injections.
get_stats = mysql_query("SELECT *
FROM visitors
WHERE site='$_GET[site]'
AND date BETWEEN '$start_date' AND '$end_date' ");
What would be the easiest way to approac...
I want to learn how to make a website with C#. I know PHP, but I like the C# language better. I have tried learning how to make a website in ASP.NET which so far has really frustrated me because I really don't like ASP at all (even less than I like PHP). Something about it drives me completely insane to the point where I am having a hard...
I have a directory full of hundreds, if not thousands, of html and PHP files that I'm hosting for a client. They currently include no google analytics tracking tags, but we'd like to add them -- ideally without actually modifying the files themselves.
What's the best way to do this?
I'd imagine I'd want to redirect all requests for *....
i have a form with a textarea and a button. if the button is clicked while the textarea is empty, the form will reload and generate an error message. otherwise, the form will redirect to another page. now, i integrated a jquery dialog box. when the button is clicked the dialog box should appear and ask a yes or no question. the problem i...
Hello,
I wrote a small app that turns out to be using a lot of memory when used by a few users simultaniously. This is leading to some Fatal PHP errors and some mySQL (errcode 12) errors.
My Plesk QoS page shows frequent 'kmemsize' black zone errors.
My question is: What's the best method to monitor PHP script runs to pin-point which ...
I'm outputting a list of purchases, and I want to automatically highlight the presence of duplicate orders.
Here's what the array looks like. The first two orders are duplicate orders place by mistake. You'll notice that the orderid for each is different, while the email and userid remain the same. So the duplication will need to match ...
Say I have an array of key/value pairs in PHP:
array( 'foo' => 'bar', 'baz' => 'qux' );
What's the simplest way to transform this to an array that looks like the following?
array( 'foo=bar', 'baz=qux' );
i.e.
array( 0 => 'foo=bar', 1 => 'baz=qux');
In perl, I'd do something like
map { "$_=$hash{$_}" } keys %hash
Is there some...
I am going over/studying the facebook code that was leaked in 2007,
I notice 1 function they call several times on on all the pages is this tpl_set(param1,param2) function
I am going to assume this is something to do with templates, The function has 2 parameters/variables passed into it, it looks like the first 1 is the name of the t...
Hi
I am doing some automation for a client and was planning on running some php scripts via cURL in the process. However URLs that work fine in a browser are coming up 404 when hit by cURL. I have seen mention elsewhere that some servers are configured to block cURL in this manner.
Is this a setting I could edit in httpd.conf? Doesn...
I want to save my countries local time(new zealand) in my database. I am using php but i dont know how to do it.
Please guide me out.
...
I'm trying to build a blog/messageboard that uses static HTML files to serve content. I know MovableType used to manage their blog engiene this way, but using Perl CGI scripts. How do I edit/append to HTML files preferebly using PHP? What other methods would people reccommend?
...
I am creating an image via a php script using imagepng.
This works fine and displays well on the website.
even saving-as gives me a valid .png file
header( "Content-type: image/png" );
imagepng($my_img);
$save = "../sigs/". strtolower($name) .".png";
//imagepng($my_img, $save, 0, NULL);
imagepng($my_img, $save);
This is the end part o...
HI Guys,
I'm using DOM to parse an xml file.
And I am having trouble catching an error that throws when the XML tag is empty and self closed.
eg.
<Title />
$xml=("http://www.exampleUrl.com/xmltoparse.xml");
$xmlDoc = new DOMDocument();
$xmlDoc->load($xml);
$x=$xmlDoc->getElementsByTagName('Root');
for ($i=0; $i<=10; $i++)
{
$id=...
Yesterday I had a few question about OO and classes in PHP here but I have a couple new questions.
1a)
In the example snippet below you will see the 3 variables set at the top of the class and then used in a method in the class. Notice how the 3 variable declared in the beginning are not set to anything, so is it required to set/list...
I have a PHPUnit Test class that I'd like to be ignored from a test run. I know I can do it by renaming it so that it doesn't contain the word Test in its filename, but I'd rather not do that since it muddies up the source control waters more than I'd like.
Does anyone have a suggestion?
...