I've a user form where I take a phone number as input in one of my fields. I have two seperate RegEx statements checking on the input.
First one is:
preg_match('/^([\(]{1}[0-9]{3}[\)]{1}[\.| |\-]{0,1}|^[0-9]{3}[\.|\-| ]?)?[0-9]{3}(\.|\-| )?[0-9]{4}$/', $phone);
and it works great. It can identify many different formats i.e. 222-333-44...
Assuming I have a string
$str = "abc*efg*hij*";
and an array
$arr = array("123","456","789");
Now I want to replace the *s in $str with the elements in $arr according to the positions.The first * replaced with $arr[0],the second replaced with $arr[1] etc.I check the function str_replace,though it accepts arrays as parameters but I...
We are looking at doing a 'version 2' of our web application that is currently written in PHP with a MySQL database. Since it has been in a constant state of development for about 5 years with numerous developers, over time you look at it as a whole and think 'we could do this so much better if we started again'.
So we are looking at do...
Hello,
I want to implement multiple language in my site using zend framework.
I need step by step solution, i got some solution but not able to understand.
Thanks in advance.
Kanji
...
Hi Friends,
I am working with Social Engine which is based on Zend Framework and Smarty Templates.
I need to make custom functionality for profile page, where I need Ajax based Dynamic Country / State / City selections like
Dropdown for Country -> on selection of some country, State will display belonging to selected country and Stat...
This has been probably asked a lot of times, but couldn't find anything like this from searching, possible that I used wrong keywords - have no idea what is this called.
Basicly, I've seen people using @ before their function calls, not for every function, but some kind of extension functions like file_get_contents(), mysql_connect() an...
Hi guys,
I have about 50.000 of records to import in a Magento store. What I have already tested:
The file is about 50 MB.
Splitted files
API
Magento Classes
Splitting the file doesn't improve the speed of the importing of the products.
Api are very slow.
Magento Classes are slow.
This is a snipped of code using the Magento Classes...
I am trying to use jquery to grab the contents of a div and pass it to a php script that emails it. So I need to use a $('#div').html() and send that to a $_POST[''] value. Any ideas?
...
We need to generate a unique URL from the title of a book - where the title can contain any character. How can we search-replace all the 'invalid' characters so that a valid and neat lookoing URL is generated?
For instance:
"The Great Book of PHP"
www.mysite.com/book/12345/the-great-book-of-php
"The Greatest !@#$ Book of PHP"
www.my...
I'm coding a project that generates two arrays containing data. One array contains data for a specific country and the other contains data for all countries.
For example, if a user from the US makes a request, we will generate two arrays with data. One with data only for the US and the other with data for worldwide, including the US. I ...
hey guys,
i'm working on a very simple breadcrumb-path solution, however i have one little thing that kind of bugs me.
PATH is e.g. folder/subfolder/subsubfolder
i'm simply splitting the PATH and i'm creating links to it. really simpel.
// breadcrumb path
$crumb = explode("/", PATH);
if (PATH != 'root' && realpath(PATH)) {
print "...
I have a couple of preliminary goals:
choose a framework for small in-house projects that other developers (with less experience in PHP) could use
choose a framework that, once I've learned it, I can develop with quickly
Overall, the whole goal is to save development time. Though there are other developers in our organization, I tend...
Hello,
I am working on an inventory system.
Basically here is how I imagine it would work. If you have a better solution, please don't hesitate to let me know.
I get daily inventory update from my supplier in the following format: sku, inventory_count, status
sku is the unique identifier here. inventory_count is integer and status is...
Hi, I am running mysql select queries 3500 times in a for loop and perform operations on the values returned by the queries in PHP. that process takes 16 seconds to execute for loop. any suggestion to reduce the execution time and improve the performance. thanks!
...
Good Morning People!
i have an array of products id's:
$product_ids = array(10,14,15,...);
and i want to find all the corresponding products on the DB using Cakephp's ORM. I'm using Mysql so the query would be something like:
SELECT *
FROM products
WHERE id
IN ( 10, 14, 15,... )
I could use the query() function, but it's seems lik...
I am always thinking about validation in any kind on the webpage (PHP or ASP, it doesn't matter), but never find a good and accurate answer.
For example, a I have some GET-Parameter, which defines a SQL query like DESC oder ASC. (SQL-Injection?)
Or I have a comment-function for user, where the data is also saved in a database.
Is it e...
$sql = "SELECT * FROM table";
$result = mysql_query($sql);
while($row = mysql_fetch_row($result)){
// PRINT COLUMN NAMES WITH EMPTY VALUE
}
how can i do this?
thanks
...
I have two tables - incoming tours(id,name) and incoming_tours_cities(id_parrent, id_city)
id in first table is unique, and for each unique row from first table there is the list of id_city - s in second table(i.e. id_parrent in second table is equal to id from first table)
For example
incoming_tours
|--id--|------name-----|
|---1--|...
I try to send a photo and GPS location to server via PHP
here is the PHP part:Copy from here
Saving the Uploaded File
The examples above create a temporary copy of the uploaded files in the PHP temp folder on the server.
The temporary copied files disappears when the script ends. To store the uploaded file we need to copy it to a diff...
Currently I fetch rows with the help of mysql_fetch_array() (and the LIMIT/OFFSET) (ie. while ($row = mysql_fetch_array($res)) { ... }); but the last row is not needed as it was to be fetched in order to make sure there is at least one more row left - it is not for display.
...