How can you check if a resource is false in PHP`s pg query params?
I run the following code unsuccessfully
$row = pg_num_rows ( $result );
if ( $row !== 0 )
echo "hurray";
else
echo "argh";
It gives me the following warnings
Warning: pg_query_params() [function.pg-query-params]: Query failed: ERROR: invalid input ...
I know the title isn't very clear. I'm new to PHP, so there might be name for this kind of thing, I'll try to explain as best as I can. Sometimes in a URL, when using PHP, there will be a question mark, followed by data. I'm sorry, I know this is very noobish, but I'm not sure what it's called to look for a tutorial or anything. Here...
I'm using charles proxy to debug a zend amf response. The headers are coming back as:
HTTP/1.1 200 OK
Date: Sat, 29 Aug 2009 10:04:32 GMT
Server: Apache/2.2.11 (Unix) mod_ssl/2.2.11 OpenSSL/0.9.8k DAV/2 PHP/5.3.0
X-Powered-By: PHP/5.3.0
Content-Length: 33
Content-Type: text/html; charset=utf-8
Should the content type be application/x-a...
Hello! I wan't to search a filename for example like this string:
$filetype = "file.php.jpg";
And then i want to search if it finds php in that string, then return false;
Now if a filename is named php-logo.jpg i don't want it to be denied. Maybe we should consider searching for .php. in the string?
...
I'm building my own custom RSS feed in PHP. I want the tag to contain line breaks to make the text more readable. However, I can't seem to figure out how to do it correctly. No matter what I try some RSS reader interprets it incorrectly. Is there some standard best way to add a line-break in and RSS 2.0 feed?
I have tried "\n", which w...
I have a scheduling page that display a week (sunday to saturday) schedule.
They way I want to add employees to this schedule is with a series of popup menus that change based on the values selected.
For example the first menu will be Jobs with <option> values propagated from the jobs table in my db.
Now say a user selects 'Cook' in t...
I've posted a question yesterday but I just realized that the answer doesn't seem to be working for a certain situation. The post was http://stackoverflow.com/questions/1349159/php-string-variables-in-gettext/1349209#1349209 and here is what I asked about:
Hello,
How does gettext translate string
variables? It doesn't seem to...
When should you use the character ' in PHP pg queries?
When should you use the character " in PHP pg queries?
This question is based on this answer.
...
I am using php5. I am doing a form, a textarea, where user can send it to his/her friends. But currently, in my textarea form, if i type :
Hello XXX,
Its been a while. How are you?
But when I echo it, it displays
Hello XXX, Its been a while. How are
you?
How do I accept the enter button, so that when I display I can d...
I've reading the Google Checkout docs but I haven't found anything similar to PayPal IPN for Google Checkout.
Can anyone point me in the right direction to automatically process orders using Google Checkout?
...
Hello there!
If I have a code like this:
$file = basename($filename);
How do i get the file extension of $file? The variabel file could contain any kind of file, like index.php or test.jpeg.
...
Hi, is there any easy way to convert Procedural PHP to OOP PHP. I've a web application, and currently, only the login system is in OOP.
Thanks :)
...
I will try to explain the situation as it is a little bit more complicated.
I have created a multiple picture upload form. It works like this:
In the form there are 2 submit buttons. 1 normal HTML submit button and another one is generated by jQuery. It is a "Browse" button which allows you to browse pictures on your HDD and add them ...
Is there any reason why I should close the connection after a query or at the end of the script?
What are the benefits of doing/no doing do?
...
I am using this PHP code:
if (isset($_GET['c'])) {
$pages = array("home", "upload", "signup");
if (in_array(strtolower($_GET['c']), $pages))
include('pages/'.$_GET['c'].'.php');
else echo "Page not found =(";
}
How should I do to so that the default page will be home.php with this code?
...
I want to display the total number of comments for a particular post in my blog. I have 'posts' and 'comments' tables in my database. Now, I am a bit confused about using counterCache.
I first created a field in the 'posts database', namely, 'comment_count' and then I added the counterCache key in the post model.
var $hasMany = array('...
Hello!
I've got a problem concerning combinatorics. Unfortunately, I can't describe it abstractly so I try to explain it as a story. :)
Problem:
There are 100 children on the schoolyard.
They all have unique heights, assuming the values are 100-199cm.
You want to build 10 groups, each consisting of 1-99 children.
How can you build al...
I'm using Windows XP SP3 and I need to install libmemcached (NOT MEMCACHE), the php class, through PECL. However, every time I try to it tells me that it can't find memcached.dsp.
Is there a way to install libmemcached on windows through PECL?
...
I have a html_headers.inc.php script that I want to include in every script on the site, to drop in a style sheet, the headers of the page, etc.
It refers to main.css as the stylesheet to use, but when I get down into a subdirectory, i.e. /foo, the link obviously breaks because it's pointing to main.css and not ../main.css. What's the b...
There is a way to get the total memory PHP is using (memory_get_usage()) but how does one get the size in memory of an individual object?
I'm obviously not talking about count() as I want the number of bytes in a potentially complex data structure.
Is this even possible?
Thanks.
...