php

Sort definitions list (<dl>)

I have a list of many <dt>/<dd> tags which come in a sort of natural order, but I would also like my visitors to have an option for alphabetical sorting. Is there a way to do this in (X)HTML/PHP with minimal code? My doctype is XHTML 1.0 Transitional. Thanks in advance. ...

Prevent Adblock Users from Accessing Website?

Im one of the Users who use Adblock. And i love it. That question could be interesting for all of us. Once i visited a german developer website, I just saw a jquery fancybox, on that box there was a Message something like this: "You are using Adblock, this site is financed with ads. If you want be able to see the content deactivate Adb...

Is it better to use mysql or files to store data?

I'm wondering if it's better to use mysql or use files to store data? What is safer, what is faster? I'm talking about php and mysql. ...

php date/week problem

I'm kind of at a loss here. It seems as though somehow my code is missing a whole week at the end of 2009 and I've tried a couple different things. My base function to get the start and end date for a week is below. Given a Year, Week and Day of the Week it gives you a date. function datefromweeknr($aYear, $aWeek, $aDay) { ...

xDebug seems OK installed, but not connecting with NetBeans

I have now tried for hours getting xDebug (2.0.5 compiled from source) to work on my MacBook OS X with NetBeans 6.8. I have installed MAMP and am running a small PHP (5.2) test program with it, no problem. But when I try to debug I get this text in Netbeans: "Waiting for connection (netbeans-xdebug)" and nothing more happens. Netbeans is...

Open MySQL slow query log with PHP

I'm having trouble opening MySQL's slow query log with PHP. I'm writing a debugger and trying to tap into the log file but it's giving me a permission denied message. Code: $log = file_get_contents('/var/log/mysql/mysql-slow.log'); Response (error): Warning: file_get_contents(...): failed to open stream: Permission denied ... I ca...

Decimal number with comma instead of point (php and sql)

Hi, I'm doing a little application of adding prices and decimals. Points are normal to use with decimals, but how can I write decimal number with comma as input (543,35 instead of 543.35) and then maybe change it with point to the database (mysql)? Then print it back form the database with the comma. Reason is that comma (,) is more use...

Drupal: Incorrect use of t()?

I want to wrap a word in <strong> tags. Is it correct to do that right in the t() call, or am I supposed to do it some other way? $help = '<p>' . t("Does this sample data look right for node type %node_type? If not, use your browser's <strong>back</strong> button to fix it on the previous page.", array('%node_type' => $_SESSION[NODE_TYP...

PHP: @ character before a function call

What is the difference between these two function calls in PHP? init_get($somevariable); @init_get($somevariable); Thanks. ...

PHP exec command

Hello guys! I am working on a project where I have to defend the website against code injection. Is there a list with all shell commands which doesn't need the php exec function? So a list with shell commands that can be performed from php without the exec command? ...

Server Response: err404.html HTTP Status Code: HTTP/1.1 200 OK

hi friends 404 error page's 200OK header error what is this? Server Response: http://www.blabla.com/err404.html HTTP Status Code: HTTP/1.1 200 OK and it should give 404, my client says.. i researched so much by google, but could not understand the issue.. What should I do to fix this? appreciate helps!!! ...

Is there a Symfony helper for getting the current action URL and changing one or more of the query parameters?

Hi, What I'd like to do is take the route for the current action along with any and all of the route and query string parameters, and change a single query string parameter to something else. If the parameter is set in the current request, I'd like it replaced. If not, I'd like it added. Is there a helper for something like this, or do ...

Need advice on how to save all stock changes for rpg game in mysql.

I've been creating rpg game and now I'm doing stock-market for my players that they could buy and sell shares. Stock prices are random and stock prices changes every 20 minutes. So, every change I have to save in mysql in one field because I want to show players graph of last month's changes. For example. first stock price is 100$, then,...

PHP checking entries in array for duplicates

I want to take all the records from my MySQL table and check if there are duplicates. I had the idea of storing them all in an array and then checking the array for duplicates. The problem is, I have about 1.5 million rows in my MySQL table. This is my code so far: <?php $con = mysql_connect('localhost', 'root', ''); $sel = mysql_sele...

PHP: how to perform htmlspecialchar() on an array-of-arrays?

How do I run the PHP function htmlspecialchars() on an array of array objects? I have the following code: $result_set = Array ( [0] => Array ( [home_id] => 1 [address] => 4225 Nasmyth Dr [city] => Plano [state] => TX [zip] => 76798 ) [1] => Array ...

Cloned object should use single file handle or each one has their own?

I am working on a wrapper that parses a data file for an existing web tool. However, I am using large data files so I cannot load the whole thing into memory so I have to walk through it loading it in small chunks. The existing web tool expects data in a style similar to SimpleXML ($obj->parentnode->childnode->childnode returns a strin...

how Configure::write works in cakePHP

I want to understand how Configure::write('Config.language','fre'), do I have to call this function in beforFilter() methode ? when i call it does it save the the configuration in session or it does not save at all ? ...

What HTTP Status Codes Should Programmers be Concerned With?

So, if you look at the List of HTTP Status Codes, there are probably a number of them that would be useful while programming. The server might handle some things, like protocols, but a lot of these codes could be useful in telling the browser the actual status of the page. So, my question is which of these status codes should we be con...

Image Processing & Creation in PHP - How To Create 300DPI Images

When creating images using the GD library in PHP ie) imagecreatetruecolor() what is the DPI of the resulting image? I haven't been able to find anyone specifying where the dpi can be set or what it defaults to. I require a 300DPI tiff or jpeg to be created and then saved to the file system from the program. If this isn't possible usi...

[SOLVED]Mysql optimization

Here you have a screenshot from my table structure:http://img64.imageshack.us/img64/54/pictx.jpg On my site I have two fields for the search, one for the city(ort) and one for industry(branche), and if I search for: Frankfurt verschierung, let's say that in the field for city I have: Frankfurt and in the field for industry(branche) I ha...