php

What does & before the function name signify?

What does the & before the function name signify? Does that mean that the $result is returned by reference rather than by value? If yes then is it correct? As I remember you cannot return a reference to a local variable as it vanishes once the function exits. function &query($sql) { // ... $result = mysql_query($sql); return $result...

How to do a search in current category

I am using this code for my search: <?php function wp_search_form($form) { $form = '<form method="get" id="searchform" action="' . get_option('home') . '/" > '.wp_dropdown_categories('exclude=1 Categories&hide_empty=0&echo=0&selected='.intval($_GET['cat']).'').' <input type="text" class="search_input" value="' . attrib...

PHP crop image to fix width and height without losing dimension ratio

hi, im looking to create thumbnails that has 100px by 100px dimension. i've seen many articles explaining the methods but most end up having the width!=height if the dimension ratio is to be kept. for example, i have a 450px by 350px image. i would like to crop to 100px by 100px. if i were to keep the ratio, i would end up having 100px ...

How do I create a new webpage from a user submitted database entry?

Hello, I'm creating a dictionary database using php and MySQL. The user can search for a name, if it's there it brings up a list of matching links (eg: http://mydictionary/name.php) and then the user can click on said link and they are transported to a webpage that get's its information from the database. If there is no entry for the na...

PHP site to post data to ASP.net Webservice

Hi, I've got a site running on php and I need my form to post data to an ASP.Net web service. All I have from the ASP.Net web service is a url ending in .svc and then I open up the url I get another link that I can click on which ends in .svc?wdsl This is all pretty new to me so I'm not sure where to begin, any pointers? Thanks ...

Can we use constants in place of property name in assigning values to class properties.?

Suppose, i have class, define('property', 'test'); class myClass { public $test; } $obj=new myClass; Can i use like this, $obj->property="value"; Is there any way to achieve this? ...

How do I remove  from the beginning of a file?

I have a CSS file that looks fine when I open it using gedit, but when it's read by PHP (to merge all the CSS files into one), this CSS has the following chars prepended to it:  PHP removes all whitespace, so a random  in the middle of the code messes up the entire thing. As I mentioned, I can't actually see these chars when I ope...

Need help setting up Doctrine 2

i setup Doctrine 1 b4 but it seems like now when i try Doctrine 2 it fails i have Doctrine installed at D:\ResourceLibrary\Frameworks\Doctrine D:\ResourceLibrary\Frameworks\Doctrine\bin D:\ResourceLibrary\Frameworks\Doctrine\Doctrine D:\ResourceLibrary\Frameworks\Doctrine\Doctrine\Common D:\ResourceLibrary\Frameworks\Doctrine\Doctrine...

PHP: How to tell if a string contains any special characters?

I am using pspell to spell check some words. However if the word is something like G3523B it clearly is not a misspelled word but pspell changes it to GB. I would like somehow to qualify a word as a word before trying to spell check it. Maybe checking to see if the string contains any numbers or special characters. So what is the best w...

Notification Alert for messages in PHP

hi i have PHP simple script in which i add only news, i need a formula in which it will do the following 1. for any news messages or news added within 12 hours from the previous one it will show it as news and it will ad new near that message the information in this script will be added in to database (Mysql) ...

URL Rewriting not working - rewrite rule in .htaccess

I have enabled the rewrite module in apache . Later i developed the .htaccess file in root . RewriteEngine On RewriteRule ^test.html $ test.php but its not working ? Internal server error occurs. What to do next? ...

internal server error during accessing magento admin

I have changed some setting in the URL rewrites in the Magento admin panel. Now, the URL is showing correctly on front end, but I am having a problem accessing the admin panel. It shows "internal server error with 500 error". Please help me with this problem. ...

Truncate file ('w') not working for a chat application

Hello, I've made a chat application for a website. Everything is working fine, however, I am trying to make a situation where when the user clicks 'logout', the chat box system will show to other users that the specific user has indeed logged out of the room, and then it will proceed to clear all old messages on the user's screen who ha...

Many-to-many SQL relation: how to retrieve all related entries in one query?

Hi Guys! I have the same tables as in this question: http://stackoverflow.com/questions/1202978/mysql-query-over-many-to-many-relationship. What I'm struggling with, though, is how to construct a query which would obtain a plant with all its attributes. I.e. if I want P1 I get P1 | A1 | A2 | A3 or P1 | A1, A2, A3 As opposed to P1 | ...

uploadify fails to upload files

I made a small script which basically uses jQuery uplodify to upload files to dynamically generated directories. It works fine on my localhost but does nothing on my remote test server. I inspected the traffic with fiddler and noticed the following warnings are issued: Warning: move_uploaded_file(/data/web/uploaded_videos/majid/file.tx...

Throwing exceptions and return types

When throwing a new exception is it best to simply return true if no exception needs to be thrown. Alternatively is it best to return false instead of throwing an exception. Im using php. ...

Way to bypass the controller in CodeIgniter?

I've been using the CodeIgniter framework for PHP and am enjoying it, but I notice that it seems to require a controller for every view. I'm wondering if there is a way to call a specific model from the view itself, rather than route through a controller. I understand that use of a controller is best practice in most cases, especially wh...

php session hijacking - is HTTPS enough? Suggestions for fingerprinting?

I use HTTPS, but want to minimize the risk of someone evil crafting their own cookies with a session ID that someone else actually uses recently. As a session variable I have an expiry time so the session is invalidated if it hasn't been used recently, so I figure the window of opportunity is when the victim is active or recently left...

Does git gets installed in IBM/AS400

I have PHP on running on an AS400. Can Git be also be installed on an AS400? I'd like to use it to maintain version control. ...

How to include a custom string in a Wordpress permalink?

Hello, I am a bit confused about how WordPress's permalink works, especially beyond Wordpress's own usage. My permalinks are like: %post_id%-%post_name% But in single.php I want to put another link to page itself but with different query string. When it is clicked the permalink structure may look like: %mystring%-%post_id%-%post_nam...