php

Convert object to integer in PHP

The value of $total_results = 10 $total_results in an object, according to gettype() I cannot use mathematical operators on $total_results because it's not numeric Tried $total_results = intval($total_results) to convert to an integer, but no luck The notice I get is: Object of class Zend_Gdata_Extension_OpenSearchTotalResults could not...

PHP: Detect "undefined function"-type errors before runtime?

Is there any tool that will help detect potential errors like "undefined function" in a PHP script before runtime? For example, consider: <?php zarfnutz ( 'blah' ); ?> If you ask the PHP command line interface to check that for syntax errors, it responds that there are none. But of course the script will fail if you try to run it, b...

How do I create a PDO parameterized query with a LIKE statement in PHP?

Here's my attempt at it: $query = $database->prepare('SELECT * FROM table WHERE column LIKE "?%"'); $query->execute(array('value')); while ($results = $query->fetch()) { echo $results['column']; } ...

Website Query, php

Here is the website http://www.ip-adress.com/ip_tracer/ i want to get latitde and lognitude from there using php and pass it to mySQL DBase, how can i achieve that? ...

How do I build a parameterized PDO statement in PHP for a dynamic query?

Apologies if this has been asked already. I've seen answers regarding static SQLs, but in this case I'd like to use PDO->prepare() for a query string that is built dynamically at runtime. Breaking down into a simple example: $TempSQL = "SELECT field1, field2, field3 FROM table WHERE "; if ($numberParams == 1) { $TempSQL = $TempSQ...

Redirecting URLs (with specific GET parameters)

I have this old survey link that is has been superseded by another link, so basically I want anyone trying to access the URL: http://mywebsite.com/survey/view_survey.php?surveyID=1 To be redirected to: http://mywebsite.com/survey/view_survey.php?surveyID=2 Can I do this in the Apache configuration or htaccess file? I tried the foll...

I need a php regular expression that replaces one tag with another

Here is what I need to be able to do: I need to match the following tag: <SPAN style="TEXT-DECORATION: underline">text sample</SPAN> I need to replace the span with an html3 compliant tag, but keep the text in between. The final tag should look like this after replacement: <u>text sample</u> I'm just not good with regular express...

upgrade module from php 4.x to 5.x?

We have (finally) upgraded to php 5.x from 4.x . The problem is that one of the third-party modules we use doesn't load. vis: PHP Warning: PHP Startup: Unable to load dynamic library '/somewhere/ext/myapp.so' - /somewhere/ext/myapp.so: undefined symbol: compiler_globals Unfortunately, we do not have the source for the app, so are una...

Regex Basics: grab text between two constants

Stuck on a (rather simple) regex problem in PHP. Buried in a mess of text is this section: &lt;tr&gt; &lt;td id=&quot;descriptionArea&quot;&gt; Customer request to remove &quot;Intro - 01/13/09&quot; video clip. &lt;br/&gt; &lt;/td&gt; &lt;/tr&gt; I want whatever is between: description...

Can I merge two MySQL queries into one?

I had the following code <?php $getFriendQuery = "SELECT DISTINCT U.username FROM users as U INNER JOIN test_friends as F on U.Id = F.user_id WHERE F.friend_id = '{$userID}' && F.active=1"; $getFriendResult = mysql_query($getFriendQuery, $conn) or die (mysql_error()); $friendName = ""; while($getFriendFetch = mysql_fetch_assoc($ge...

How to make PDO run SET NAMES utf8 each time I connect, In ZendFramework.

How to make PDO adapter run SET NAMES utf8 each time I connect, In ZendFramework. I am using an INI file to save the adapter config data. what entries should I add there? If it wasn't clear, I am looking for the correct syntax to do it in the config.ini file of my project and not in php code, as I regard this part of the configuration c...

Scrape web page contents

I am developing a project, for which I want to scrape the contents of a website in the background and get some limited content from that scraped website. For example, in my page I have "userid" and "password" fields, by using those I will access my mail and scrape my inbox contents and display it in my page. Please help me to solve the p...

Fast Loading web pages

We are planning to develop a new website. Our goal is to load web pages quickly. What are all the techniques we need to follow. Can anyone give me good suggestions, forums links or articles. Our platform is PHP, MySQL, Javascript, and AJAX. ...

What's better at freeing memory with PHP: unset() or $var = null

I realise the second one avoids the overhead of a function call (update, is actually a language construct), but it would be interesting to know if one is better than the other. I have been using unset() for most of my coding, but I've recently looked through a few respectable classes found off the net that use $var = null instead. Is th...

how to make a drop down menu with a vertical scroll bar?

hi i need to put a vertical scroll bar in the drop down menu such that at first it will appear only size=1 but when we drop down it should have a vertical scroll bar , can anybody help me , i would really appreciate any help ...

problem with form submit

hi , i have a form that works perfectly fine with mozilla and IE but on google chrome there is a slight problem i am using ajax to submit my form that is there is no submit button ,in IE and Mozilla its working fine but in google chrome when i press enter the form submits and the page redirects to the main page( this is another problem ...

problem with ajax( page refresh)

hi im using ajax to extract all the pages into the main page but am not being able to control the refresh , if somebody refreshes the page returns back to the main page can anybody give me any solutions , i would really appreciate the help... ...

Session Management and cookies-- the interaction mechanism

I am interested in knowing how session management and cookies work in PHP. I want to know their underlying mechanism, like how the browser interacts with the cookies, and how the cookies are used to validate the session data in the server. Is there any web resources that allow me to learn that? ...

Can any one help me mail attachment script in php?

Duplicate: http://stackoverflow.com/questions/536838/php-attaching-an-image-to-an-email I need mail attachment script in php, and attachment should be multiple files can any one help me? ...

how to use rss feed ?

im new to this if somebody could help me .... ...