php

PHP string within JavaScript

I currently am trying to echo the contents of a text file within JavaScript. Everything works but there is a problem. The text within the text contains apostrophes, which is throwing everything off. Below is a portion of the code that I am using. I am using this code for MANY text files. I have considered changing each apostrophe to...

IE giving error on XML code embeded with PHP.

This code works fine on browsers other than IE. echo " <item> <link>http://www.example.com/showrssdetails.php?id=".$row[recordid]."&lt;/link&gt; <guid isPermaLink=\"true\">http://www.example.com/showrssdetails.php.php?id=".$row[recordid]."&lt;/guid&gt; <title>".$row[company]."</title> <description><! [CDATA[".$row[desiredcandidate]."]]>...

Creating new SQLite DBs with PDO

I want to provide a setup feature in my next project and I'm wondering if it's possible to create a SQLite 3 database from scratch with PDO or I'm just stuck at connecting to existing databases via DSN? If it isn't possible with PDO is there any way to create a new DB via PHP? ...

Php filename sorting

Hi to all, I can get a sorted filename list with the following code: $log_files = scandir(LLP_LOG_DIR); $sorted = sort($log_files); the filename format is X.log, where X is a progressive numeric value. How can I solve the problem of getting 0.log 1.log 10.log 11.log 2.log 3.log where the wanted result is 0.log 1.log 2.log 3.log ...

how to use solr with mysql and php?

i read about how i could use solr to search in my threads but i dont quite understand how it works and i cant find any articles explaining this for a total beginner. could someone explain briefly how solr works and how it communicate with mysql and php? ...

Multidimensional array to a nested multidimensional array in PHP

Hello, I have an array like so: sid sname did dname 1 Basketball 1 Mini 1 Basketball 3 Cadet 2 Baseball 8 Little League 2 Baseball 6 Junior League...

[PHP] Functions returning strings from other files

I want to make a really simple template engine for my site, to make it easier to add new pages and edit other ones. I have a template.php file and a variable of $pageHeader. Then in my functions.php file I have a function called CallHeader() with this code: function CallHeader() { echo $pageHeader; } The problem is this does not...

sending email to multiple email address

i have a textarea... i want to send emails to all of the email addresses in textarea seperated with comma....i.e [email protected], [email protected], [email protected] also detect if user has type a single email address ...

Examples of parameterized queries

Could anyone give me examples of how to use parameterized queries with MySQL/PHP please? ...

Choosing the right PHP framework

Could someone possibly help me choosing a PHP MVC framework? My requirements are: SIMPLE authentication system (no need for ACL, just isAuthenticated(), isInRole() Resources and RESTful approach Helpers (Html, Ajax and such stuff) It would be nice if it was PHP 5 only I've tested some frameworks. CakePHP seemed good to me, but it has...

eclipse layout tips

Is there a setup of windows and menus that proves especially useful while coding? For example on my laptop I hide the toolbar so I have more editor space. I use ctrl-F7 to open views so I don't need to have them visible all the time. Note: the PHP tag is only because I use PHP. This is not a PDT or PHP specific question. ...

Drupal - log in a newly created user in PHP

I have Ubercart installed. I'd like to create a Conditional Action after an anonymous user finishes checking out. The system currently creates a user automatically, but it does not log them in - I want this conditional action to log them in. The conditional action allows me to write custom PHP to perform whatever I want - and what I wan...

PHP Remote file streaming with Resume Support

Firstly, I am aware of similar question being asked before. The subject pretty much explains the question but still, the file is hosted on another server, the user will download file via my script, streamed to him... But the problem is user can't resume it once paused...any solutions? ...

mysql_pconnect(): send of 5 bytes failed with errno=32 Broken pipe.

I've been using the same DB abstraction library for years. But today it started writing these Notice (8) messages in my log. The application is working correctly but every time a script connects to the DB the same notice is logged. I cannot think what might have changed. This is happening on my local dev machine. OS X 10.6.2 PHP 5.3.0...

PHP Wordpress add class="last" to last item in menu list

I'm drawing out a listing of menu items inside a wordpress template (header.php) and need to assign a special className to the last menu item in the list. I'm building the list with this code... $myposts = get_posts(); foreach($myposts as $post) :?> <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li> <?php endforeach...

Showing percentage complete of PHP script

I have a PHP script that takes about 10 minutes to complete. I want to give the user some feedback as to the completion percent and need some ideas on how to do so. My idea is to call the php page with jquery and the $.post command. Is there a way to return information from the PHP script without ending the script? For example, fr...

MYSQL vs. PHP SELECT COUNT(*) values differ

Hi, I'm trying to get the total count for a query but MYSQL and PHP return different values. Query: SELECT count(*) as fr FROM (select uemail from associado WHERE utipo=1) AS t1 MYSQL returns 11; PHP returns 10; Is there any reason for that? I've found the following: The missing row is: "[email protected]"; This row is ju...

PHP - generating a world map from border data

I have found the shape data for the borders of all the countries and a class to process it and I have written a script to convert the longitude and latitude to a pixel location on an image and to draw the countries using imagefilledpolygon and imageline. Everything is working great except: 1) I have a $scale variable that I can change. ...

Is there any open source text analysis library for PHP?

I am looking for a PHP library which does more or less the same thing as this webpage: http://textalyser.net/ I know that there are popular libraries in python and java, but I am looking for a PHP version. Thanks for your help! ...

Returning an array from a function (PHP)

I have this function coded to check the status of a Rapidshare link using their API: function CheckLink($fileid, $filename) { $q = file_get_contents("http://api.rapidshare.com/cgi-bin/rsapi.cgi?sub=checkfiles_v1&amp;files=$fileid&amp;filenames=$filename"); $r = explode(",", $q); switch ($r[4]) { case 0: ...