php

SQL - Most efficient way to perform this query?

Hi, I basically have three tables, posts, images and postimages (this simply contains the ids of both the other tables and allows more than one image in each post and each image to be reused in multiple posts if necessary). I'm trying to list the titles of all the posts, along with a single, small image from each (if one exists) I can ...

How to check if my shared hosting provider has mod_gzip installed?

Is there a way to check if my hosting provider has mod_gzip enabled? It's not mentioned in any info on the web site, nor there is a forum to contact other people about this problem. Thanks. ...

How to let Curl use same cookie as the browser from PHP

I have a PHP script that does an HTTP request on behalf of the browser and the outputs the response to the browser. Problem is when I click the links from the browser on this page it complains about cookie variables. I'm assuming it needs the browsers cookie(s) for the site. how can I intercept and forward it to the remote site? ...

Uploading Image not Working

I am trying to write a PHP script that can upload multiple files. for($i=0;$i<count($_FILES['uploadimg']['name']);$i++){ $name = $_FILES['uploadimg']['name'][$i]; $type = $_FILES['uploadimg']['type'][$i]; $filepath = $_FILES['uploadimg']['tmp_name'][$i]; $size = getimagesize($filepath); $img = file_get_contents($file...

Vertical jCarousel with Ajax and PHP

Can anyone please help me how to implement vertical jCarousel by using ajax. ...

Finding number of nodes in PHP, DOM, XPath

I am loading HTML into DOM and then querying it using XPath in PHP. My current problem is how do I find out how many matches have been made, and once that is ascertained, how do I access them? I currently have this dirty solution: $i = 0; foreach($nodes as $node) { echo $dom->savexml($nodes->item($i)); $i++; ...

In PHP, is printf more efficient than variable interpolation?

I want to know if the below code: <?php printf ("%s", $some_variable); ?> is more efficient than: <?php echo "$some_variable"; ?> One common complaint of variable interpolation is that it is very slow. I want to know if there is a better alternative to variable interpolation that doesn't make one's code as messy as: <?php echo $fi...

Can anyone explain the following PHP Code ?

Can anyone explain what the following PHP Code does function query($query_string) { if ($query_string == "") { return 0; } if (!$this->connect()) { return 0; }; if ($this->QueryID) { $this->free_result(); } if ($this->RecordsPerPage && $this->PageNumber) { $query_stri...

slideToggle table row using Jquery Help!

Hey, I have been trying for over a week now to slideToggle a table row when the 'more info' button is clicked but nothing seems to be working at all. I'm new to Jquery so if anyone ca help me slideToggle the 'more-info-1', 'more-info-2', 'more-info-3' tr tags. the main problem is that those id's are created dynamically through php and I...

OpenId sign-in screen like stackoverflow

I am looking for an example of an openId sign-in just like stackoverlow. I saw a few around, but I don't like the idea of copying or memorizing a url to enter. I want to include options for openId with google/yahoo/etc buttons. I said something about not liking the standard openid login, however, that will be there as an example. I a...

PHP / MySQL - Sometimes a blank entry gets added to a table

Hello, The code below allows my users to add an item ($site) to a table ($find). It works well. But every once in a while, it adds a blank value to the table in addition to the one the value the user adds. Any ideas why? Thanks in advance, John <? $find1 = urlencode($find); print "<div class=\"siteadd\"> <form action=...

Q:Technical requirements for Flash AS3 image manipulation and saving application

I am building a Flash AS3 application that allows users to modify images, and then submit-save them to a server. The user will then have the ability to log in and access these saved images in a thumbnail gallery. They can either delete an image or click a thumbnail to view it at original size. I am comfortable with the front end having ...

Have a script to handle http errors.

I would like to have pretty 404 pages, as well as other error pages. I redirected all the errors (400, 401, 403, 404, 500, 502, 504) to my error.php. Apache provides a lot of information in $_SERVER variable. Do you know if there is good a ready script I can use for my error pages? ...

How do I properly create an HTML class?

I'm working on an HTML class in PHP, so that we can keep all our HTML output consistent. However, I'm having some trouble wrapping my head around the logic. I'm working in PHP, but answers in any language will work. I want the class to properly nest the tags, so I want to be able to call like this: $html = new HTML; $html->tag("html...

Looping a PHP Script

I've got a PHP script that checks a directory and deletes any files not modified within 15 seconds (It's for a game). My problem is how to get this script to run all the time. I set up a cron job to run every 10 minutes and then in the PHP script I have an infinite loop with a sleep(10). My thought was that it would run the code every 1...

Parsing XML using PHP

Hiya, I've consistently had an issue with parsing XML with PHP and not really found "the right way" or at least a standardised way of parsing XML files. Firstly i'm trying to parse this: <item> <title>2884400</title> <description><![CDATA[ ><img width="126" alt="" src="http://userserve-ak.last.fm/serve/126/27319921.jpg" ...

What's the correct way to call MooTools JS code from within Joomla?

I wrote some MooTools code that reads from YouTube's API in JSON and I want to execute it from within a custom component. I've been reading about the js.php file, but I'm unclear on the best approach. I was just going to output js in my component directly, and then i realized that the MooTools library isn't being loaded unless a compone...

Problem: Alert value of dynamically created select tags.

Hello. I have an external Javascript file and i am trying to alert the value of select tags which are being generated dynamically through php. the problem is, that it selectes the value of only the first select tag. What should i do, so that the javascript is able to independently identify each select tags value. My <select> code l...

How can I implement RSS 2 in Code Igniter?

How can I implement RSS 2 in Code Igniter? ...

php check if domain equals value, then perform action

I need to take a variable that contains a URL, and check to see if the domain equals a certain domain, if it does, echo one variable, if not, echo another. $domain = "http://www.google.com/docs"; if ($domain == google.com) { echo "yes"; } else { echo "no"; } Im not sure how to write the second line where it checks the domain to see if...