php

PHP losing data for two variables

I have two scripts that I'm working on. The first receives $agentID via GET (as well as some other data via other GET variables), then looks up $firstName and $lastName in a database by $agentID. Once done, it displays $firstName, $lastName and $agentID on the screen, as text in a form (not in a form input). After the form is submitte...

PHP image generator/handler

I'd like to create a PHP image generator that takes several query string parameters and generates an image on the fly. I've done this before in ASP.NET via a handler but now I'd like to in PHP. For example, I'd like a call to image.php?img1=foo.jpg&img2=bar.jpg to render the concatenation of foo.jpg horizontally next to bar.jpg. Later on...

Email list filter

Hi, I'm not even sure how to ask the question or even how to search for it. I've browsed around and what i've got was some really hardcore regex Basically, I have this textarea where I can input my list of emails like how google does it. Filter should be able to just ignore anything within a double quote and only picks up the email wi...

How to display two table columns per row in php loop

Hi, I would like to display data, two columns per row during my foreach. I would like my result to look like the following: <table> <tr><td>VALUE1</td><td>VALUE2</td></tr> <tr><td>VALUE3</td><td>VALUE4</td></tr> <tr><td>VALUE5</td><td>VALUE6</td></tr> </table> Any help would be greatly appreciated. Thanks ...

Php explode then get the name row from a MySql Table

I know this has been talked about here before. However, my situation is a bit different and I'm so close. I would like to explode an array of category id's from a news data table then get the category name from the category table. Right now I am able to get the id's out and explode them just fine inside the while loop for the news da...

PHP: Array to variable function parameter values

I have a variable length array that I need to transpose into a list of parameters for a function. I hope there is a neat way of doing this - but I cannot see how. The code that I am writing will be calling a method in a class - but I will not know the name of the method, nor how many parameters it has. I tried this - but it doesn't w...

What DB extension PHP has (mysqli, PDO etc) is the best for enterprise level application?

What DB extension PHP has (mysqli, PDO etc) is the best for enterprise level application? The important features that comes to my mind are: under active maintenance A lot of documentation and examples. Probably endorsed by the Mysql people themselves. Robust scalable ...

Get Diffrence Between Two Times (Unix Epoc)

You know when it's late in the night and your brain is fried? I'm having one of those nights right now, and my function so far is not working as it should, so please take a look at it: (I should note that I'm using the PHP 5.2.9, and the function / method DateTime:Diff() is not available until PHP 5.3.0. <?php function time_diff($ts...

PHP Max Execution Time: Incorrect Reporting?

Hello all, Is there any reason for a PHP script to return a fatal error of: Fatal error: Maximum execution time of 60 seconds exceeded in H:\xampplite\htdocs\mlm\tera.php on line 1 When my PHP ini is set to "300000" and further more I set set_time_limit(300000); in the script itself. Safemode is off. In addition, Apache's timeout ha...

Split string into equal parts using PHP

I'd like to get a string, for example 'sdasdasdsdkjsdkdjbskdbvksdbfksjdbfkdbfksdjbf' and split that up every six charaters. I don't think explode or strtok will work for that? Any ideas? ...

PHP underscore in filename variable?

Why is there an underscore for data_? Is there a simpler way of writing this, so that it makes more sense in terms of code readability? My analysis: data_ is supposed to take whatever data_ is, request a message via the variable postmessage from the form and make sure it's text and concatenate all this: $filename = 'data_'.$_REQUEST...

What is a good db schema and method to query a "Facebook Wall" feature

I'm writing a simple "Facebook Wall" type feature where a user can post on another person's wall and people can simply reply to that Wall post, or post a new wall post. Users cannot reply to a reply, you may only reply to the original wall post (just like facebook) My original mySQL db schema that I had thought of goes like this: pos...

Memcache vs APC for a single server site data caching

I have a single server site thats pushing 200k unqiues per day, and the traffic doubles roughly every 40 days (for the last 5 months anyway). I pretty much only plan to cache the output of mysql_query functions for an hour or so. If cache is older than that, run query, put result back into the cache for another hour. My mysql DB is ab...

Where can I get future/average weather data based on a city and time of year

I am trying to build a weather module that doesn't only show the current weather in any given city but shows average weather data for a city given a time of year (e.g. first week of august). Currently I'm looking at scraping http://uk.weather.com/climate/climate but I'm hoping I can find a more convenient solution paid or free. ...

add value to array in for loop will not work, why ?

Take a look: for ($i=1; $i<=$nr_of_pics; $i++) { ${'image_src' . $i} = $image_id.'_'.$i; $img_array = imageSize(${'image_src' . $i}, $i, $category); } and here is the imageSize function (simplified): $myarr = array(); $myarr['thumb_image_' . $nr . '_width'] = $thumb_width; $myarr['thumb_image_' . $nr . '_heigh...

Using switch to compare multiple values in an array in PHP

I recently found a situation in which I had two related variables that had several permutations upon which I wanted to do an action if the two variables were one of half a dozen permutations. As an example of what the data range the variables were: $months = array('January', 'February', 'March', 'April', 'May', 'June', 'July', 'Aug...

Can't get this array working, new to arrays

I want the array ($img_array) to increase every time it's looped, but it wont. The length of the array is 0 when I echo it 'echo count(array);' function imageSize($name, $nr, $category, $myarr){ $path = 'ad_images/'.$category.'/'.$name.'.jpg'; $path_thumb = 'ad_images/'.$category.'/thumbs/'.$name.'.jpg'; list($width, $height...

Calling PHP in html page

Hello, Let say, i can only use html codes in a page ( call it index.html ). So now, i want to check something using php ( call it userCheck.php ). So it is possible i want the html to communicate with php files. For example, something like when users access index.html, it will check the userCheck.php, so userCheck says yes, then can...

Switching databases in PHP

I'm new to PHP, so this question might best be answered by a brief explanation of fundamentals of PHP rather than addressing what I'm trying to do (although that would be useful too). I want to set up multiple databases for my application, based on user. When the user logs in, it would authenticate them against DB-1, and retrieve from t...

how to create a table with javascript ?

I have this php function, which I want to convert to javascript function, but I don't know how to create a table in javascript. I guess I have to have a container (DIV) to insert the table into with javascript. Here is the php function simplified: (it counts height and width and repeats a 1px shadow to create a drop-shadow effect) fun...