php

basic linking question

I've always added the file extension to a link "contact.php" is there anything wrong with excluding it and simply having <a href="contact">? seems to work fine, as Im having a lot of trouble with .htaccess removing the file extensions. thx ...

POST data to another Joomla page on the same site

I have a Joomla controller that iterates a number of times over some Google Checkout XML code. What I want is during this iteration, POST data to another page - in the same site. so com_mycomponent/controllers/checkout_iterator.php //breaks up the xml into small parts and posts then to the executor, one at a time com_mycomponent/cont...

How does IMAP structure emails with attachments?

I'm using Zend_Mail_Storage_Imap to retrieve messages. When the code retrieves an email with an attachment it contains 3 parts. The first part's content is the body of the email. The second part's content is the body of the email with some extra whitespace after it. The third part is the base64 attachment. Why is it showing two part...

Is this a Reasonable Validation Strategy?

Is it okay to put some custom validation methods in AppModel and call those from my app's Models? I want phone number validation to work the same for all phone numbers on my site and I want that validation rule to be in one place only. Is there a better way to do this? ...

PHP : How to get milisecond between two dateTime obj?

PHP : How to get milisecond between two dateTime obj? $date = new DateTime(); $date2 = new DateTime("1990-08-07 08:44"); I try to follow the comment below but I got an error $stime = new DateTime($startTime->format("d-m-Y H:i:s")); $etime = new DateTime($endTime->format("d-m-Y H:i:s")); $millisec = $etime->getTimestamp() - $stime->g...

How do I Alter this wordpress php to output into an array?

<?php $parent_cat = 57; $child_cats = get_categories('child_of='.$parent_cat); if($child_cats) : echo '{ '; foreach($child_cats as $cat) { echo $sep . $cat->cat_name; $sep = ', '; } echo ' }'; endif; ?> The above code outputs a number of categorys in this format: A Cut Above,A20Labs,AMCH, how would I add ' ' aroun...

EpiTwitter getAuthorizeUrl() via AJAX call not working

I'm using the EpiTwitter getAuthorizeUrl() for Twitter authorization. On one of my pages, the user can click a 'tweet' button which makes an ajax call. Within the PHP script that ajax calls, I determine if the user has linked to their Twitter account. If they have not, I call getAuthorizeUrl() and send the URL back in the resposeTex...

Service to connect instant messaging (msn/icq gtalk etc) with your websites visitors?

Basically, I want my users to be able to just click a button and get a small popup-window that puts them in contact with me through one of the major communicationstools. Does anyone know about any such services? ...

sprintf() Versus mysql_query()

Having trouble formatting my code to execute without error using sprintf() When I run the code I get this error: Parse error: syntax error, unexpected T_VARIABLE in /location on line 16 $query = sprintf('UPDATE `%s` SET `stock` = :amount WHERE `itemname` = '$q'', $tablename); Above is line 16 in my code. I'm assuming it is syntax rel...

Get Host Name with Curl using ip

Is there a way to get the host name using CURL, or what is the preferred way using PHP? ...

Optimum settings for apache/php webserver with separate mysql database server...

I'm having a mysql connection speed issue with my home development setup. I have two VM's (VirtualBox running on a Ubuntu host). One is my WEBSERV with apache2/php and one is by DBSERV with mysql and postgres (both are ubuntu server 10.4 LTS). Also, i have mysql installed on the WEBSERV as well and this was only done before i decided ...

How to combine results from multiple tables with different columns?

I have several tables with different numbers and types of columns, and a single column in common. +--------+---------+------------+-------------+ | person | beardID | beardStyle | beardLength | +--------+---------+------------+-------------+ +--------+-------------+----------------+ | person | moustacheID | moustacheStyle | +--------+-...

check the data of ckeditor is null or not

I'm using the ckeditor 3.4 as text editor for my website, and want to validate the data at client side first, before submitting the data to server. I can get the data of editor by using this code: var editorData = CKEDITOR.instances.editor1.getData(); but having trouble to validate data. The problem is: - The data should be invalid i...

need some help using php and SOAP for integration with a web service.

I'm using jbilling that requires PEAR and SOAP in order to integrate with PHP. jBilling didn't come with any SOAP files, so I found some on the internet and downloaded them thinking I would be able to just include them in the php pages, but I'm not sure if this is the right way to do this. Inside all the SOAP .php files they have somet...

What is the best PHP developer setup for Windows 7 64bit?

What is the best PHP developer setup for Windows 7 64bit? I just purchased PhpStorm and what to get a developer env setup on my Win 7 laptop. ...

PDO Uncaught Exception

This error appears when executing the code below: Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[42000]: Syntax error or access violation: 1065 Query was empty' in /home/content/63/6563663/html/inventory/pg.php:20 Stack trace: #0 /home/content/63/6563663/html/inventory/pg.php(20): PDOStatement->execute() ...

doubt regarding storing values in mysql databse

Hi, is it better to save the exact user input in the database or clean it for xss and store .. or is it good to store the direct user input , clean it and display it ?? please guide me . Thanks ...

PHP coding issue: this won't display name

I am puzzled why it won't display the name. I expect to see the output, "Jeffrey" but it doesn't. I created an object with an argument to be passed to the constructor so I expected "JEFFREY" to be displayed but it didn't. I added the echo function in constructor to see if it output jeffrey and it didn't echo either. PHP didn't show any e...

URL Validation?

Does anyone know an up to date regular expression for validating URLs? I found a few on Google but they all allowed junk URL's i.e (www.google_com) when testing. My regular expression knowledge is not so vast, so I would hate to put something together that would fail under pressure. Thanks. ...

php session not saving after $_post

Hi I am experiencing issues with session where if i put the following code on a page the counter will increment by one every time i reload the page. session_start(); if(isset($_SESSION['views'])) $_SESSION['views'] = $_SESSION['views']+ 1; else $_SESSION['views'] = 1; if i put the above code in an if statement where it on...