php

The best way to render a Zend_Form with existing markup

Hello! I want to use Zend_Form because of its validation and filters etc. But the markup for forms is already done. Even worse, it isn't very standardized, so writing my custom decorators is not a solution. Is there a simple way to "apply" Zend_Form to existing very custom markup? I think it's a common problem. ...

Nested Sortable JQuery list doesn't work in IE while it does in FF

Hello everybody, While I'm using this site quite often as a resource for jQuery related problems I can't seem to find an answer this time. So here is my first post. During daytime at work I'm developing an informationsystem for generating MS Word documents. One of the modules I'm developing is for defining a default chapterselection fo...

MySQL LIKE Statement and PHP Variable

Hi , I need my following code to work. I am trying to use a PHP Variable and also add a [charlist] Wildcard statement to it Could some one please help figure out why it wont work. Basically it works if i remove the [charlist] Wildcard but I need it to find all the letters which are in the PHP Variable my code is as followed LIKE ...

how to use urlencode in php

Hello, I'm trying to use urlencode to convert the string: <a href="<?php print 'search.php?query='.quote_replace(addmarks($search_results['did_you_mean'])).'&search=1'?>"> Actually, i want to implement a search engine. |-www |- index.php |- search directory |- search.php |- header.html |- search_form.html |- search_result....

Same MySQL query takes 0.3 sec in MyPHPAdmin, 7.9 sec in PHP -- Why?

I am running the following MySQL query: select * from combinations where family_type='f597'; on a table that has about 90,000 lines. If I run the query via MyPHPAdmin, it takes 0.3 seconds to run, but in my php page on the same host it consistently takes about 8 seconds. To test the amount of time it takes in my page, I run it like ...

wordpressL How to array the child categories without any html tags?

Hello, I am using a category called 'blogs'. Under that category I have many authors. Each author gets a category for himself. In the 'blogs' template I want to display nicely a for each category and the ecxerpt from the latest post. Unfortunately, when I am trying to use wp_list_categories to query the child of that 'blogs' cat, I ...

How to validate domain name in PHP?

Is it possible without using regular expression? For example, I want to check that a string is a valid domain: domain-name abcd example Are valid domains. These are invalid of course: domaia@name ab$%cd And so on. So basically it should start with an alphanumeric character, then there may be more alnum characters plus also a hyphe...

php relative and absolute paths

I have read that when including a php file that using a absolute paths has a faster processing time than relative paths. What would you suggest to use? include("inlcudes/myscript.php"); or include("/home/ftpuser/public_html/includes/myscript.php"); or even set_include_path("/home/ftpuser/public_html/includes"); include("myscript....

PHP - Open TXT file, add +1 to contents when link clicked

How can I make it so when a user clicks on a link on my web page, it writes to a .txt file named "Count.txt", which contains only a number and adds 1 to that number? Thank you. ...

unbale to figure out the proper sql query

Hi Guys, I have a tables like this Results ------- id - autoincrement value TestCase - varchar Verdict - varchar AppID - varchar TestCases --------- id - autoincrementr value TestCase - varchar TestCase_container - varchar Basically I am displaying the results in php code. while displaying the ...

SQL Server: Stopping Queries Externally

Hello all, I run queries using SQLCMD utility via PHP and I wanted to know if there was a way to stop queries or scripts that I have executed via another SQL command by passing the process ID or something. I also make use of the PHP Driver for SQL Server would it be easier to do this way? Or is none of this possible - once a query run...

MySQL: inserting records in tables linked by foreign key

In MySQL, is it possible to have two tables linked by a foreign key and when a record is inserted into the parent table to create a corresponding record in the child table? I have a website that handles member registrations. One table contains the member's details such as name and email address, and is linked to a settings table via mem...

How to store the value?

I want to make the application like below. First there is a page with four radio buttons. The user clicks on any of the radio buttons but doesn't save and he goes to another page. Then if he comes back to same page with the radio buttons it shows the selected radio button before he goes to another page. How can I do it by using jQuery ...

Can't use sha1 inside class definition?

I'm working on a login class in PHP. I have the following line inside a class definition: private $salty = sha1('salty'); ...which is giving me the following error: "Parse error: parse error, expecting ','' or ';'' in C:\xampp\htdocs\test\includes\jaLogin.php on line 26" I've tried using this line outside of the class definition and...

Upload files using mobile broadband using standard browsers (not from phone)

My issue is trying to upload photos while using mobile broadband. (PHP) The situation is - 1) I'm using a laptop that is connected to the internet using mobile broadband (t-mobile) 2) I know that my web site works as I've used the php script for well over a year without issues Other points which may help with an answer 1) uploading ...

Does form processing code need to be abstracted? (Zend_Form)

In Zend Frameworks tutorials, I can see form processing code like if ($request->isPost()) { $formData = $request->getPost(); $code = $request->getParam("code"); $url = $request->getParam("url"); if ($form->isValid($formData)) { // here goes code to determine insert/update action...

Converting RE code from PHP to Python

I have done a simple program in PHP, now need to convert this into Python: $string="Google 1600 Amphitheatre Parkway Mountain View, CA 94043 phone"; preg_match_all('/[0-9]+.{10,25}[^0-9]*[0-9]{5,6}+\s/',$string,$matches); print_r($matches); ...

Emacs23 php-mode problem

I keep getting this error and similar errors while using php-mode on Emacs23 on Ubuntu: Debugger entered--Lisp error: (void-function php-template-if-hook) php-template-if-hook() abbrev-insert(if #("if" 0 2 (fontified t face font-lock-keyword-face)) 414 416) #[(G73404 funs global) "[Byte Code]" apply(#[(G73404 funs global "[Byte ...

Mod Rewrite path issues

I have successfully created rewrite rules to handle URLs like http://example.com/xyz http://example.com/xyz/ http://example.com/xyz/abc http://example.com/xyz/abc/ Here is the mod rewrite & regex: Options +FollowSymlinks RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d Rewrite...

Remove all characters after "-"

I thought this would work but it appears to be only removing the - and the whitespace after it. $itemList[] = preg_replace('/-(.*?)/i', "", $temp['item']); ...