php

PHP DOM - accessing newly added nodes

Hi! I use the following to get a html document into DOM: $dom = new domDocument('1.0', 'utf-8'); $dom->loadHTML($html) and then I add some new content to an element in the html: $element = $dom->getElementById('mybox'); $f = $dom->createDocumentFragment(); $f->appendXML('<div id="newbox">foo</div>'); $element->appendChild($f); But...

Using SimplePie with CodeIgniter and XAMPP

I am using CodeIgniter 1.7.2 with XAMPP 1.7.2 on a Windows computer. I am trying to make use of SimplePie. I followed all the instructions I could find: a copy of simplepie.inc is in my applications/libraries folder, renamed to simplepie.php I enabled curl on Apache. I attempt to load SimplePie as follows: this->load->library('simplep...

Google maps hide marker (and info) and only show when you click on an area that has info.

I want to add a transparent png into google maps instead of using the default icon. Where in my sample code would I change the default icon to a png named transparent.png? Thanks! function onLoad() { map = new GMap(document.getElementById("div_map")); map.addControl(new GSmallMapControl()); map.addControl(new GMapTy...

PHP and MYSQL: Why does A work and B not work?

First of all, I am using the DATE_ADD function for MySQL. When trying to use $sqlA in php, it saids syntax error for some reason (mainly the area after WHERE). Why? $sqlA = "SELECT $column_name FROM $table_name WHERE Date >= DATE_ADD(CURDATE(), - INTERVAL 3 DAY)"; However, it works without DATE_ADD: $sqlB = "SELECT column FROM table...

php javascript permissions problem

Kind of a weird problem... not something ive ever run into before. So, i am using CKeditor, and am creating the upload and browse functions for users to upload and use images in the rich text editor. So, everything works great in firefox, they can upload images, and place them into the rich text editor, and save whatever they are doing ...

Check session from a view in CodeIgniter

What is the best way to check session from a view in CodeIgniter, it shows no way in their user guide, otherwise I will have to make two views on everything, which is kinda weird...still a newbie to CodeIgniter... Please Help! Thanks... ...

Checking string for whitespace

Is there a way I can check for whitespace?For example, I DO NOT want to check for whitespace such as this... $string = "The dog ran away!"; and have it output Thedogranaway! I want to check if there if the entry is ALL whitespace and whitespace only? and have it output the error! Basically, I don't want to be able to enter all whit...

Differentiating between P tags wrapping images and P tags wrapping text nodes in Wordpress?

Hey all, I need a good solution to be able to style <p> tags differently in a wordpress post. More specifically I need to differentiate between paragraphs and images. Wordpress just wraps all new lines in <P> tags. Here are some possibilities: Strip all <p> tags and add <P> tags where appropriate (around text) Add a class on <P> tags...

How do I only descend this part for my loop?

Okay guys! Right now, I am using Descending for my data because i want the dates from newest to oldest, but I want the entries from that data to be oldest to newest. So how can I do this, especially since I am using DESC in my query. Basically descend the <li> portions $sql = "SELECT $column_name, DATE(DATEandTIME) as Date FROM Cod...

How to Find Missing Value Between Two Mysql Tables

select userid from cw_users where NOT EXISTS(Select userid from cw_users_data) The previous query won't do the job of course. Trying to find only a missing 'userid' from tableb by doing a comparison. Both tables contain 'userid' and there should be one similar on each. I'm trying to find which one is missing on second table. ...

Wrap stray text in <p> tags

Hey all, Wordpress issue.. how do I wrap stray text in P tags? Example: Before- <div class = "content"> <img src = "hello.jpg"/> <h1>Introduction</h1> Hello! this is stray text that I want to wrap with p tags Hello! This is another set of stray text </div> After- <div class = "content"> <img src = "hello.jpg"/>...

Element.text is not a function

I know this has been asked plenty of times before and I already went through a bunch of posts as well as googled for the answer but I just can't figure it out... here's my php $connect = mysql_connect("localhost", $usuario, $password) or die(mysql_error()); $select_db = mysql_select_db($dbname) or die(mysql_error()); //query the data...

PHP - forms loading forms loading forms?

Currently I've got a PHP page query.php with a form that presents a list of countries with a submit button: Countries [] nation1 [] nation2 [] nation3 [] nation4 SUBMIT they're checkboxes to the same array, and the form references the page <form method="post" action="query.php"> When the submit button is pressed, a query is run on th...

PHP scraping problem with Google "I'm feeling lucky"

I'm trying to scrape using Google "I'm Feeling Lucky" button. For small query like 'iteminfo.ca' it works, because it redirects me to iteminfo.ca. This is the query url: http://www.google.com/search?hl=en&amp;source=hp&amp;q=iteminfo.ca&amp;btnI=I%27m+Feeling+Lucky But for the query like '061754020164 site:iteminfo.ca' it doesn't wo...

PHP str_replace with for loop from array

Ok I have a str_replace and what I want to do, is take values from an array, and take the next piece to replace the word "dog" with. So basically I want the $string to read: "The duck ate the cat and the pig ate the chimp" <?php $string = 'The dog ate the cat and the dog ate the chimp'; $array = array('duck','pig'); for($i=0;$i<count($...

What does this mean exactly? $_SESSION['sessionName '][$item['rowName ']]

And how does it translate to in C#? $item holds the results from mysql_fetch_array() I'm not really familiar with PHP so this is all new to me. Thanks. ...

Is it a bad idea to rely on PHP 5 features when writing an application you expect to be portable?

If I'm building a PHP system which I expect to port to many different servers, should I avoid relying on PHP 5 features such as exceptions and final methods? How widespread is PHP 5 by now? Should I be worried about compatibility and ditch exceptions and other features not available in PHP 4? ...

how to import mails/contacts from gmail /yahoo etc???

Its like i want to import my all mails at one place. php is my end. Can anybody tell me how to implement this.I just want need the basic funda.. what are various libraries i should use. Any suggestions and things not to do.Thnks.. ...

Pass functions to a class

PHP mysql database I have created a follow on question to this one here that is specifically about pagination I need to call a method from one class in another, and be able to change the method that is called. Like so class db{ function a(){ echo 'I run a query';} function b(){ echo 'im the other query';} } class YourClass...

Preg_match Alpha numeric -_' ", and white space

I have had a few cracks at this but can't seem to get it right. Anyone have a regex to allow alphanumerics and -_",' as well as white spaces. Thx ...