Hi all,
i was just looking for a bit of advice, currently my DB design is that one user has many blog postings. Now i have a user class and a blog class.
However im not sure about the proper way to get all blog posts for that user. Do i create a getAllBlogs() function in the user class which returns blog objects or do i create a main...
If we have date range such As:
1st October 2009 - 20th October 2009
Can we calculate how many Mondays have occured during
The answer to this would be (3)
M T W T F S S
*1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 *20 21 22 23 24 25
26 27 28 29 30 31
Can we do this...
I want to send my RSS/Atom feeds with the correct Content-type header, can I do this without access to PHP or any other server-side language? The goal is for the browser to treat the file as a feed and not just a plain XML file.
...
I would like to display the page numbers in index.php, search.php and archive.php
As far as I'm aware, the variable $page contains the current page number, this works, but I just need the number of pages.
Also is there an easy way to get the URL for the next page and previous page for use any way you wish? next_posts_link(); and previo...
Hello Everyone,
Can someone help me with this. I'm feeling like I've been hitting my head against a wall for over 2 hrs now.
I've got Apache 2.2.8 + PHP 5.2.6 installed on my machine and the .htacces with code below works fine, no errors.
RewriteEngine on
RewriteCond $1 !^(index\.php|css|gfx|js|swf|robots\.txt|favicon\.ico)
RewriteRul...
I've tried looking at the database but I can't seem to be able to make a query to do this. How can I look up posts from only one category, or more specifically, I just need the ID of the last post from the category.
I'm trying to do this in index.php
...
So I started using MySQL-based sessions with session_module_name("user"); and I love it, and I might as well because I have to.
The only thing I'm missing are my beloved multidimensional arrays, and I'm at a juncture where they are most desired. How can I still use them, or is it a lost cause?
...
Is it possible to control the output of rand, for example if I just want rand to give me the output of the variable $roll1 with the value or number of 1 half the time out of the six possibilities when rand is ran or when the browser is refreshed, how does one accomplish that?
My code sucks but I am fighting to learn, I only get one eve...
I'm trying to do Authentication against restful_authentication from a php application, however I understand it uses a SHA1(digest--salt--password--RESTFUL_AUTH_KEY). The issue is regardless of how much I try I can't get the hash to match. Reading through the documentation I see the digest is just the restful auth key, but that's where I ...
There are a number of functions that have bugs / weird interfaces / security issues etc. which do you think is worst?
...
Hi all,
I've been implementing Facebook Connect into a site and am using both the PHP API, to allow me to automatically post data to a user's wall, as well as the JS API, for manual posting, permissions dialogs, etc. When the user uses the manual method it works 100%...the popups are displayed correctly, and the data gets posted to thei...
How can I do the following without lots of complicated code?
Explode each value of an array in PHP (I sort of know how to do this step)
Discard the first part
Keep the original key for the second part (I know there will be only two parts)
By this, I mean the following:
$array[1]=blue,green
$array[2]=yellow,red
becomes
$array[1]=g...
I need to have a class constructor in PHP call its parent's parent's (grandparent?) constructor without calling the parent constructor.
// main class that everything inherits
class Grandpa
{
public function __construct()
{
}
}
class Papa extends Grandpa
{
public function __construct()
{
// call Grandpa's ...
Hey Guys.
I will like to see if everybody could share any good training sources on OOP on PHP language.
Good Training Sources for OOP (Object Oriented Programming) PHP, anyone ?
I've seen numerous tutorials, mostly superficial, some of them bad.
Please share anything good either commercial or free, Video or Written.
...
function foo () {
global $var;
// rest of code
}
In my small PHP projects I usually go the procedural way. I generally have a variable that contains the system configuration, and when I nead to access this variable in a function, I do global $var;.
Is this bad practice?
...
I am using php's imagejpeg to save a GD image resource to a file, doing this:
imagejpeg($im, '../images/' . $image_id . '.jpg');
It works fine, but according to my browser, it tries to read the file as text/plain:
Resource interpreted as image but transferred with MIME type text/plain.
Is there a step before saving the file that...
When using netbeans to edit a PHP project, the IDE can (over time) use 400+ MB of memory. Is there any way to turn off certain features or other tricks to reduce its memory usage?
...
How can I parse an XML document like this:
<feed>
<item>
<element-name>Element value</element-name>
</item>
</feed>
If I try the following, it doesn't work:
$xmlObject = simplexml_load_string($xmlString);
foreach($xmlObject->item as $item) {
$elementName= $item->element-name; // Obviously doesn't work.
}
I've tried:
$...
I am trying to connect to some of my servers using PHP ssh2_connect method. If a server is not online, my script would attempt again at a later point of time. The problem am facing is that when a server is not available, the ssh2_connect method does not return a 'false' as mentioned in the php manuals, instead it waits until the script t...
If I have a string $random, and I want to throw out everything except commas and numbers, how could I do this in PHP PCRE?
I know \d will match numbers, but I don't get the rest of PCRE.
...