php

Prestashop Newsletter Module

Hi, I'm looking for the best prestashop newsletter module, that allows me to manage custom newsletter layout and newsletter sending. Has anyone ever used one? Wich one would you recomend? Thanks! ...

Query for props list with or without values

Hi, I'm trying to make a SELECT on three relational tables like these ones: table_materials -> material_id - material_name table_props -> prop_id - prop_name table_materials_props - row_id -> material_id -> prop_id - prop_value On my page, I'd like to get a result like this one but i have some problem with the query: material pr...

PHP analog of mysql like function

Suppose it's a nub question, but is there an analog of mysql's LIKE function in php? So, e.g. : like('goo*','google.com');//is true like('*gl*','google.com');//true like('google.com','google.com')//also true I know regex rullez, but don't know any solution to reach this ...

interactive sessions through web page

Is it possible to use HTML form to start an executable in the server, and allow user to input further information into the same executable? from a web form, input executable name with one parameter missing. the executable starts, and post question for the missing parameter. user enter the value for the missing parameter, the informatio...

Zend Framework Custom Validation Class Error Message

The validation fails as it should but does not return the error message. $form->addElement('text', 'phone_number', array( 'required' => true, 'validators' => array( array('NotEmpty', true, array('messages' => 'Enter a valid Phone Number')), array('regex', false, array('pattern' => '/\([0-9]{3}\)\s[...

Do I use fopen or curl to load an XML file given a URL in PHP

I have an XML file I can get via a URL. I know I can get the file using fopen, but sometimes I've seen scripts use curl. Is there an advantage to using curl over fopen to get XML files? ...

Need help with Ubercart invoice template

I want to display the price adjustment of an attribute on the customer's invoice. so, for example the customer's invoice would contain this; Products on order: 1 x Blue Sweater - $15 SKU: 22810R Weave: coarse $1.95 Wool: Marino $3.00 Weave and Wool would be the attributes with their price adjustments. I know this is controlled in t...

php - How do I convert a string to an associative array of its keywords

take this string as an example: "will see you in London tomorrow and Kent the day after tomorrow". How would I convert this to an associative array that contains the keywords as keys, whilst preferably missing out the common words, like this: Array ( [tomorrow] => 2 [London] => 1 [Kent] => 1) Any help greatly appreciated. ...

When does a PHP <5.3.0 daemon script receive signals?

I've got a PHP script in the works that is a job worker; its main task is to check a database table for new jobs, and if there are any, to act on them. But jobs will be coming in in bursts, with long gaps in between, so I devised a sleep cycle like: while(true) { if ($jobs = get_new_jobs()) { // Act upon the jobs } else { //...

Include not functioning like I am expecting

The below gives me a fatal error saying that "mymail" was not found. Any ideas why? Looks right to me. mailreq.php include("mail.php"); $r = mymail("test","test"); mail.php function mymail($body, $reqtype) { //blah blah } EDIT: For some reason, this version of php doesn't see <? ?> as valid shorthand tags. I changed it to <?php ...

$this->Session->setFlash displays in wrong timings

Hi, I am using $this->Session->setFlash to flash the error messages to the browser and its working fine. But, unfortunately, it is displaying the messages when it shouldn't display also. It is seems like, its getting the information's from cache and displaying. Please let me know, is there any way to solve it? ...

Is it possible to cast a SimpleXML object to a DOMDocument object in PHP?

As a follow up to my earlier question, I'm thinking of using simplexml_load_file to load an XML file from a URL. Would it be possible for me to turn that SimpleXML object to a DOMDocument object via (DOMDocument)$my_simplexml? ...

Rolling back file moves, folder deletes and mysql queries

This has been bugging me all day and there is no end in sight. When the user of my php application adds a new update and something goes wrong, I need to be able to undo a complex batch of mixed commands. They can be mysql update and insert queries, file deletes and folder renaming and creations. I can track the status of all insert comm...

Trying to collect email analytics

I've written an email application in PHP that handles very large mailing lists. Is there a way to find out what emails are opened and by who? Any solution will do as long as it can tell me if the user has actually received and opened the email. I do not want to use email receipts either as it may put off recipients. If it's relevant, I'...

php, for each, syntax error

. Hi, this is my code, don't know why but I have a stupid syntax error,on the marked line. Please bring some light for a php nob. Parse error: syntax error, unexpected ')', expecting ';' in /var/www/stats/upd_tr_stats.php on line 38 ...

mysql query the latest date

I am running this query SELECT sh.*, u.initials AS initals FROM database1.table1 AS sh JOIN database2.user AS u ON u.userID = sh.userid WHERE id = 123456 AND dts = ( SELECT MAX(dts) from database1.table1 ) ORDER BY sort_by, category In the table1 I have records like this dts status ...

Parse error: expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' in ..?

I tried to put an if statement inside an echo but this parse error came up, is it not possible to do that? should I use heredoc instead? echo "<input name='main_branch' type='radio' value='1' <?php if($restaurant['main_branch'] == 1) { echo "checked"; } ?> />Yes <input name='main_branch' type='radio' value='0' <?php if($restaurant['main...

Send email from webpage without postback/refresh

Hi all. Long time reader, first time writer. Quick query i hope someone can help me with. I have a webpage (php, javascript) which has a small contact form for a user to fill in and email us. Not a problem in itself, i have a working form already. Nothing noteworthy, just a form posting to a php page which sends an email. <form id="my...

PHP/MySQL: Check if something 'belongs-to' something else?

I have two tables: Stores and Items. The relationship is: Stores 1---* Items In PHP/MySQL what would be the best (fastest/simplest) way to check if a particular item belongs to a particular store. In other words given for example: $store_id = 1; $item_id = 12; I want to check if item 12 belongs to store 1 (and not some other store)...

Store GZIP:ed text in mysql?

Hi! Is it a common thing for bigger applications and databases to GZIP text data before inserting it to the database? I'll guess that any full-text search on the actual text field will not be working before unzipping it again? Thansks ...