php

setting utf8 with mysql through php

I have the following very simple code, which retrieves utf8 formatetd data, such as containing umlauts from a mysql database, which may or may not be set as utf8. If I use either of the commented out approaches to ensure that utf8 data is returned, the data will NOT be returned as utf8, however if I leave them off, the data will be displ...

Testing a SQL query in PHP

I have the following simple php code snippet, which will, when called, delete a relevant article from a database. The result is passed to a javacsript function, which will update the page via AJAX. I would like to return the string "false" if the query fails, as I am attempt below. if($cmd=="deleterec"){ $deleteQuery = "DELETE FROM AUCT...

Dynamically insert content into pdf files with php

I have an ebook in word that I convert to PDF before distributing to my clients. I'd like to dynamically insert their email address into all links in the ebook to allow them access to the members-only content on my site, and I'd like to do this on the fly, as part of the book download process. I've briefly looked at http://us.php.net/pd...

Why aren't checkboxes/radiobuttons and options resetable if they were set by PHP?

Working with XHTML 1.1 I have this login page managed in php. It contains several checkboxes, radiobuttons and a dropdownlist. There's a lot of formchecking behind it and if something doesn't check out, the page reloads and all values are filled back into their place, except for passwords. This means the <select>, <input type="radio" ...

Running Java on a Web Server

I have written a standalone Java application that I've packaged into a jar file that takes in some command line arguments, does some hardcore computations, and then writes out the result to a file along with some output to the default output stream pointing to where the file with the results are. I now want to create a website around th...

Why is this MySQL query failing?

This query keeps failing with Integrity constraint violation: 1048 Column 'login_name' cannot be null My insert statement is... $insertUserQuery = 'INSERT INTO `users` ( `login_name`, `password`, `first_name`, `last_name`, `company_n...

DocBook to DokuWiki

Is there a straightforward way to take docbook content and convert it into DokuWiki content? So far I've only found the DokuWiki plugin that will interpret docbook content and output it in XHTML, but this happens on every page load. I would like to find a way to convert docbook content directly to DokuWiki's native formatting syntax so ...

In PHP, what is the differences between NULL and setting a string to equal 2 single quotes.

I used to set things like this when I wanted blank values. $blankVar = ''; Then after some months, I decided this looked better and had a clearer intent. $blankVar = null; This worked without hiccup for a while, but recently with a PDO prepared statements I ran into a problem. Binding a value to null made the query fail, whilst bin...

PHP Newbie question - CMS / Templating

We're planning on setting up a website for student group - most of the content is fairly static but certain portions such as events and members would turn up from the database. I've never worked with PHP much, and was wondering would a CMS system like Drupal or PHP Nuke be appropriate for this kinda work? Is there anything else that wo...

VBulletin cannot Connect to MySQL Database.

Hello All, I've just moved a forum from BradPPresents.com to BradP.com. May not be SFW. It's located at forum.bradp.com. I'm getting a Database connection error, despite being absolutely sure about the username and password of the database. Here's the VBulletin Configuration file, with the username and password masked. <?php ...

How to get thumbnail snapshot of video and pdf file in php

Can anyone help me out that how i can display video and pdf file as thumbnail?? Thanks.............. ...

Set some web directories as restricted directories

I am doing PHP web application, with Apache. There are a few configuration files ( like App.yml) whose content I don't want to expose to users under whatsoever circumstances. Is there anyway that I can tweak my Apache setting so that these files won't be available when hostile users query for them? ...

How can I search for a value in an object?

I have a PHP script that goes through an XML file, but I want to be able to search the object for a value, just like I can search an array for a value. According to comments on PHP.net, array_search() supports objects as of PHP5, but I can't get it to work. The XML file is a list for bus stops, and I want to be able to search through t...

How can I use XPath to perform a case-insensitive search and support non-english characters?

I am performing a search in an XML file, using the following code: $result = $xml->xpath("//StopPoint[contains(StopName, '$query')]"); Where $query is the search query, and StopName is the name of a bus stop. The problem is, it's case sensitive. And not only that, I would also be able to search with non-english characters like ÆØÅæøå...

Geo Proximity Search

There is requirement in application which states that find out all the objects that are bounded to specific country and/or city into the google map. We have objects with respective latitude and longitude precalucated using google map api and stored in database. Some times these objects are provides service withing certain service range/...

How can i synchronize two database tables with PHP?

I need to use PHP to copy data from one MySQL database to another. I can build and array of all the values to go into the other database but first I want to make sure the database has the correct fields before inserting. For example say I am going to be copying data from tableA to tableB. I can set up tableB to look just like table...

ViewSVN fails to run saying unsupported URL

I'm trying to setup ViewSVN for viewing our subversion repository. My SVN repository uses https for access. However, irrespective of supplying svn://, svn+ssh:// or https:// in the viewsvn configuration for my svn repository, I always get this in my apache log: svn: URL protocol is not supported 'https://my.repository.com' Everything ...

PHP Server Name from Command Line

I can't find a way to detect the name of the server running a PHP script from the command line. There are numerous ways to do this for PHP accessed via HTTP. But there does not appear to be a way to do this for CLI. For example : $_SERVER['SERVER_NAME'] is not available from the command line. Does anyone have suggestions? Thanks, Ju...

How do I sort an object within an array?

I have searched and found a couple of solutions on this site, that didn't work for me. My case is that I perform a XPath search (contains function) in the XML, and lists the results. I want those results listed alphabetically. The results are laying in an array, and looks like this: Array ( [0] => SimpleXMLElement Object ( ...

Automatically create email link from a static text

Hi, I'm trying to figure out how to automatically link the email addresses contained in a simple text from the db when it's printed in the page, using php. Example, now I have: Lorem ipsum dolor [email protected] sit amet And I would like to convert it (on the fly) to: Lorem ipsum dolor <a href="mailto:[email protected]">[email protected]</a> ...