php

Deploy to multiple instances

I have been looking at a couple of systems (Phing, ControlTier) and have also read all relevant questions on this site however I'm not sure I have found the best solution for my requirements. I have a PHP website which is essentially a codebase for a price comparison shopping site. This is then deployed to many different servers, each ...

PHP: form validation "Full name"

Right now i have this for full name: if(empty($_POST['full_name']) || strlen($_POST['full_name']) < 4) { $errormessage[] = "ERROR.\n"; } How can i make a validation for full name, so the entered name should contain space? So like if person enter: John Andersson Its ok, but if he enter: JohnAndersson its not ok, error. So you woul...

Replace a string in JavaScript and PHP

How can I replace this character | in JavaScript? <html> <body> <script type="text/javascript"> var str="data|data|data"; document.write(str.replace(/|/g,"<br />")); </script> In the output of given code, every character has the "< br />" I don't know what is wrong with my code.. :) Also, for PHP, I want the function to us...

php capture group

Hi, Im kind of stuck capturing a group with preg_match() in php. This is my pattern: <ns2:uniqueIds>(.*)<\/ns2:uniqueIds> And this is the source: <env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"&gt;&lt;env:Header/&gt;&lt;env:Body&gt;&lt;ns2:ListResponse xmlns:ns2="http://censored"&gt;&lt;ns2:uniqueIds&gt;censored&l...

how to get value inside an array without knowing the key of that multidiensional array

i have below array structure $movieCast=Array ( [1280741692] => Array ( [moviename] => twlight [movie_cast] => Array ( [0] => 0000000083 [1] => 0000000084 ) [userid] => 62 [country_id] => 00...

How to get the class that created the current object?

I would like to prevent foo() from being executed by any other class than B. How can I check which class created object A? <?php class A { public function foo() { if (.... B ) // what should be on the dotts? echo 'I\'m created by class B, which is fine'; else echo 'Execution of foo() is n...

php.ini: what i must change, to write <? instead <?php?

in my local hosting the script doesn't work, if i wrote <? instead of <?php. what i must change in php.ini to correct it? Thanks ...

Convert English numbers to Arabic numerals

How can i convert English numbers being retrieved from the database to Arabic numeral symbols in PHP. EDIT: Here're some examples of what Arabic numerals look like. I live in an Arab country, so please don't go around explaining to me what Arabic numerals look like. If you can help, good and well. I don't need bogus ideas. http://uploa...

PHP DOMDocument: inserBefore, how to make it work ?

Hi, I would like to place a new node element, before a given element. I'm using insertBefore for that, without success! Here's the code, <DIV id="maindiv"> <!-- I would like to place the new element here --> <DIV id="child1"> <IMG /> <SPAN /> </DIV> <DIV id="child2"> <IMG /> <SPAN /> </DIV> //$div is a ne...

How to display converted time zones in a 'generic week' (Sunday thru Saturday)?

Hi, We are building a scheduling application wherein one user may set his "general availability" for all weeks like the following: Sunday | Monday | ... | Friday | Saturday When we ask a person A in India to indicate his "availability", we ask him to select from a drop down of values something like this: 12:00am 12:30am 01:00am ... ...

PDO select query error

I am trying to run this simple SELECT query using PDO::MySQL, but it does not return a value, as you can see from the dump $row returns false, which means there was an error. The database connection works, as I'm writing to the database a few lines further down Sql query is correct Can someone see the bug in this code? If you can I'd ...

Correct syntax to get my Ajax function to work

The following code will not do what I hoped, that is run the Ajax function when the div ="dist" li created by the PHP code's is clicked. Guidance please. <?php // ... $result = mysql_query($sql); echo "<div class=\"dist\">"; echo "<ul>"; while ($row = mysql_fetch_array($result)) { echo "<li><a href=\"devplan....

How set a htmlarea to some specific textarea ,instead of all textarea

I have a drupal site. And i have intsalled a htmlarea module and it worksfine. Now all textarea in the form changed into htmlarea. How is possible to change only some particular textarea to htmlarea. ...

Cannot modify header information - headers already sent by error

my code- if ($result) { $row = $result->fetch_object(); $filename = $row->src; $q = "delete from photos WHERE id=$fileid"; $result = $mysqli->query($q) or die(mysqli_error($mysqli)); if ($result) { $filepath = "./images/"; if(fileDelete($filepath,$filename)) { echo "success"...

Wordpress Database with custom table

I am trying to pull data from a table I have imported into my wordpress database. My php code works for all the default wp_ tables but when try and target the tables I actually want I get bugger all back. My code (currently echoing all post titles and it works) $liveposts = $wpdb->get_results( $wpdb->prepare("SELECT * FROM $wpdb->posts...

Getting MDB2 to work with sqlite3 via pdo

I am using MDB2_Driver_pdoSqlite to access a sqlite3 database with PEAR. I am able to connect to the database and display a list of tables with listTables(), but when I try to run the mdb2 function tableInfo() I get an error. MDB2 Error: not found [Error message: primary is not an existing table constraint] I am running the following sys...

php report generator

I was wondering is there any report making tools in php for MYSQL database? Threr are crystal reports for MS-SQL server and Oracle has its own report making tools. But i am finding difficulty making reports in php where i want to show header and footer for every page and it will show total pages and nevigation keys to show reports page b...

php send text/ images in mail

how to send text and images in mail ...

SWFUpload: How to cancel an upload in Classic Form

Hi all, I am using the classic form demo. The link is: link text If you try out the demo & try to upload a file, you can see once you click on the "Submit Application" button, the cancel (cross image) button does not show up in the top right hand corner of the blue box (that indicates the progress). How can I manipulate the existing co...

Best way to store Hijri dates in mysql ?

I am developing a web application using CakePHP and mysql and all the dates in the system use the Islamic/Hijri calendar(http://en.wikipedia.org/wiki/Islamic_calendar) . I was wondering what is the best way to store Hijri dates in mysql? Note: I already use Keith Wood's jQuery DatePicker(http://keith-wood.name/datepick.html). ...