php

php dom get all attributes of a node

is there any easy way of getting all attributes of a node without checking if it has that attribute? short, here's an example of what i'm trying to do: i have this short domdocument: <p align=center style="font-size: 12px;">some text</p> <a href="#" target="_blank">some link<a/> okay.. now if i check p tag with getAttribute('align') i...

Using autotools for a LAMP application

I have a LAMP (Linux/Apache/MySQL/Php) application that I should release soon. Even if I've never used it, I'm thinking about using autotools for it, to make the configuration and installation process easier (for the customer and for me, in the future). Have you ever done (or thought) such a thing? Are there any drawbacks? Does it make...

How to run a PHP script continuously on webhost?

I have a PHP script that retrieves list of urls from a site and stores them in a MYSQL table. I want to run the script again and again [with some time delay] and update the table. I am using codeigniter framework. How can I do it? Should I run a cron job? Or should I make a start/stop page with infinte loop? P.S my webhost is GoDadd...

Timeline from 2 related tables

Let's say I have a screenshots table and a replies table. So: every screenshot can have multiple replies (one-to-many). Now, I want to create a combined timeline of the two, but in reality, they're pretty unrelated (in structure). How can I select data from both tables, ordering by their publish time, descending; when for example, I can...

Tree to generate for jsTree

function createJsonTree($array, $currentParent, $currLevel = 0, $prevLevel = -1) { foreach ($array as $categoryId => $category) { if ($currentParent == $category['parent']) { if ($currLevel > $prevLevel) $output .= ' , "children":[ '; if ($currLevel == $prevLevel) $output .= " }, "; $output .= '{ "data" :'.'"'.$c...

Can $_session data be set in a function

hello I have this code in a function $_SESSION['id'] = $id; $_SESSION['pineapple'] = $hashbrown; $_SESSION['username'] = $username; However, the session data never gets set, even on the initial page. Can sessions be edited though a function or not? info on cookies/ect this is the code for starting the session <!-- a bunch of info ...

JQuery image overlay (and get rid of imagecopymerge)

Hi friends, In my project site I am merging a base image (a map) with markers (the same marker always but repeated) according to a table in MySQL using the php function imagecopymerge. I want to migrate this to jQuery since the refreshing of the image flicks, which is very ugly. Could you please guide me to the best solution? Thanks...

Parsing XML with PHP's simpleXML

I'm learning how to parse XML with PHP's simple XML. My code is: <?php $xmlSource = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?> <Document xmlns=\"http://www.apple.com/itms/\" artistId=\"329313804\" browsePath=\"/36/6407\" genreId=\"6507\"> <iTunes> myApp </iTunes> </Document>"; $xml = new SimpleXMLElement($xmlS...

Conditional expression in SQL

Hello! I am using MYSQL and PHP. I have a table called item. Two of its attributes are price and discounted price.I have SELECT statement as below: $sql = 'SELECT C.cart_id,I.item_id,C.quantity, I.discounted_price,I.price FROM cart C, item I WHERE I.item_id = C.item_id'; I want to modify this sql statement and include a conditional ...

Is there a place I can find all the extensions of PHP?

Now I'm seeking of php_pdo_mysql.dll version 5.2.5.5, only found this: http://dllcentral.com/php_pdo_mysql.dll/5.2.5.5/ But my zend studio 5.5 says it's invalid! Is there any other place I can try my luck? ...

Error handling with PHPMailer

I'm trying to use PHPMailer for a small project, but I'm a bit confused about error handling with this software. Hoping someone has experience with it. When I've set up an email and I use: $result = $mail->Send(); if(!$result) { // There was an error // Do some error handling things here } else { echo "Email successful"; } ...

Isolate a single item from XML feed with PHP

Hi and thanks for looking. I'm trying to get just the value in brackets after 1 GBP = USD from the following link, how do I do this with SimpleXML? http://www.sloomedia.com/currency/feeds/GBP.xml Thanks, Ben. ...

Compiling PHP 5.1.6 from source - php -v and phpinfo() version discrepancy

Hi, I have just bought a VPS running Ubuntu and I need to install the LAMP stack with PHP 5.1.6. The VPS came with no PHP installed (checked this from the shell with php -v) and with Apache/2.2.12 installed. I installed PHP 5.1.6 from source and compiled it with Apache 2.2 (using libapache2-mod-php5), tried a phpinfo() test which worked ...

create custom LAMP distribution like XAMPP

I wish to make a self contained LAMP distro software package from source with at least the following: * php must have mysqli, ldap and GD support * all required .so's must be included (like libpng needed by GD) (self contained) I managed to make one but i keep patching quirks to it, SO i thought to start from a wide-used one like XAM...

The PDO extension is required for this adapter but the extension is not loaded

I am getting the following exception when i try to use the fetchall method of the Zend_Db_Table_Abstract class... An error occurred4545 EXCEPTION_OTHER Exception information: Message: The PDO extension is required for this adapter but the extension is not loaded Stack trace: #0 D:\www\TestProject\library\Zend\Db\Adapter\Pdo\Mysql.php(...

php Regex remove text from rel attribute within links

Hi, is there a really easy way to grab the text of a rel attribute i.e <a href='#' rel='i want this text here'></a>. I have tried this morning with regex but am having no luck. ...

Zend_Mail bug emailing with $mail->setReplyTo

Why does setReplyTo($reply_to_mail) send email to $reply_to_mail? Shouldn't it just add email adress to reply-to field in the email message? Currenyly if sending mail from website form and filling reply-to field, message sends to reply-to email and to our admin email. Why does it duplicates email? Should send only to our admin email. ...

php script that reloads the page

I'm having difficulty with pages that does not show the updated data immediately Here's my current one: <?php $con = mysql_connect("localhost","root",""); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("hospital", $con); $result = mysql_query("SELECT * FROM t2"); echo"<br>"; echo"<big>All In Patien...

jQuery and $_GET

Let's say I have this url: www.example.com/test.php?page=4 How do i retrieve the value of $_GET['page'] with jQuery? o_O ...

Drupal Imagfield/Filefield in custom form

Hi, i have created a module with this among others this function in it: <?php function ils_ladda_upp_form() { $form['upload'] = array( '#method' => 'post', '#attributes' => array( 'enctype' => 'multipart/form-data', ) ); $form['upload']['album_name'] = array( '#type' => 'textfield'...