php

How to get the player rank from there stats in php and mysql

I have the following code i am trying to get the play speed rank from mysql. Mysql Table Called Accounts Username | Speed ----------------- Player1 21 Player2 52 Player3 33 Player2 52(Ranked:1) Player3 33(Ranked:2) Player2 21(Ranked:3) $result = mysql_query("SELECT * FROM accounts") or die (mysql_error()); wh...

PHP - What's faster, memcache or require?

I'm trying to load in predefined email messages to send out -- my question is, should I memcache all the email messages rather than just including the file that contains the variables with the email messages, and only call it once a day or something? ...

Why Zend_Route don't work?

routes.info.route = "info" routes.info.defaults.module = "default" routes.info.defaults.controller = "index" routes.info.defaults.action = "info" http://localhost/info/ Exception information: Message: Invalid controller specified (info) Request Parameters: array ( 'controller' => 'info', 'action' => 'index', 'module' => 'd...

Changing who it is from in mail()

I'm sending myself a text message using PHP mail() and it says FRM: [email protected]. I'm using [email protected] to send the text message. How can I change that? ...

Match a word with similar words using Solr?

I want to search for threads in my mysql database with Solr. But i want it to not just search the thread words, but for similar words. Eg. if a thread title is "dog for sale" and if the user searches for dogs the title will be in the result. and also if a user searches for "mac os x" the word "snow leopard" will appear. and the abili...

What is wrong with my script?

I don't see any errors in Firebug, and I can't figure out what's wrong with the AJAX. PHP: <?php $subject = $_POST['subject']; echo $subject; ?> Javascript <html> <head> <script type="text/javascript"> /* <![CDATA[ */ function ajax() { if (window.XMLHttpRequest) { xmlhttp=new XMLHttpRequest(); ...

Text Editor for comments

I am using the CKEditor for my website along with PHP, and want to allow only <b>, <i>, <a>, and <img> tags. This is easy, however our problem is that a user could essentially add a <b> tag some where and then not close it resulting in all of the comments thereafter and the rest of that page being bolded. How do we check and make sure t...

How to sort an array of arrays in php?

In php I have a numerical array of associative arrays: mainArray: [ array1:['title':'Record a','order':'2'], array2:['title':'Record b','order':'4'], array3:['title':'Record c','order':'1'], array4:['title':'Record d','order':'3'] ] What is the simplest way to sort mainArray by the 'order' value of each associative array? Th...

Foreign Characters not showing up correctly in php

I am saving some foreign characters quite fine into my mysql database. This is the ones I am using right now for example: いち When I try to echo out that column from the database, it only shows up as '??' Why are there question marks showing up when I am trying to echo foreign characters? ...

Make PHP page return "304 Not Modified" if it hasn't been modified

I have a PHP file that will return the same thing with the same $_GET parameters every time -- it's deterministic. Unfortunately for efficiency (this file is requested very often), Apache defaults to a "200 OK" response whenever a PHP page is requested, making the user download the file again. Is there any way to send a 304 Not Modifie...

Unable to execute functions on elements loaded with AJAX (jQuery)

i am using .prepend() to load data after i POST a form with .ajax(). once the new elements are added, my functions won't work on them. if i link the js file directly in the prepended data, the functions work, but when i POST, i starts multiplying the events. i have a feeling it has something to do with binding, but i am not able to f...

hope for php to become as secure and fast as python and ruby in the future?

i know that php is not as good as python and ruby compared from a view of security and performance. i wonder however, is there a chance for php to reach that level in the future and no one will say..."php is a ugly and slow language"? a more professional language? ...

How long is a piece of $string.... too long... php

what am I doing wrong here guys? $string = "string How Long is a Piece of String?"; if $string = <5; { echo "string is less than 5"; } else { echo "string is more than 5"; } ...

Facebook Graph API will not give me picture data.

Using PHP 5.2.11 and the new facebook graph code... If I call $facebook->api("/me"); I get a proper response: array 'id' => string '10700210' (length=8) 'name' => string 'Brandon Renfrow' (length=19) 'first_name' => string 'Brandon' (length=7) 'middle_name' => string '✫' (length=3) 'last_name' => string 'Renfrow' (length=7...

Return PHP error constant (such as E_USER_ERROR) from function, or use trigger_error?

Which would you recommend? Return an error code, such as E_USER_ERROR from a function, and determine proper message higher up: function currentScriptFilename() { if(!isset($_SERVER['SCRIPT_FILENAME'])) { //This? return E_USER_ERROR; } else { $url = $_SERVER['SCRIPT_FILENAME']; $exploded = explode('/', $url);...

How to display the rss version of a News Link

I'm trying to write a script that will show the rss version of a single url (title, author, image, source, etc..). This should behave much the way that facebook does when you copy paste a link to share and it generates this information automatically. I'm trying to do this with a php script but would also be open to opensource programs th...

draw line with php using coordinates from txt file

I have file A2.txt with coordinate x1,y1,x2,y2 in every line like below : 204 13 225 59 225 59 226 84 226 84 219 111 219 111 244 192 244 192 236 209 236 209 254 223 254 223 276 258 276 258 237 337 in my php file i have that code. This code should take every line and draw line with coordinate from line. But something wa...

Pairing Links with PHP Randomized Ads

So I have the following code with works great for randomly generating position for 5 different sidebar ads, my problem is how to give the ads a link that will always be paired with them. I'm looking for suggestions from some PHP gurus as to best practices for doing this... <ul class="top_ads"> <?php ...

MySQL Insert Query Randomly Takes a Long Time

I am using MySQL to manage session data for my PHP application. When testing the app, it is usually very quick and responsive. However, seemingly randomly the response will stall before finally completing after a few seconds. I have narrowed the problem down to the session write query which looks something like this: INSERT INTO Session...

need help with installing php bbs discuz 7.0 english

hi, does anyone knows how to install discuz 7.0 with postgresql instead of the mysql? ...