I want to do this:
Check the top 10 values of points.
Here is my condition:
If there are less than 10 records (rows) found, e.g give bonus
If the points is in top ten (among hundreds records/rows), give bonus.
So, what i do is (wrong method):
SELECT points FROM `scores` WHERE id = '1' ORDER BY score DESC LIMIT 9 , 1
That will on...
Need some help with this error. Fresh wordpress 2.9 install...
Fatal error: Cannot instantiate non-existent class: directoryiterator in /home1/test/public_html/test2/wp-content/themes/mytheme/functions.php on line 471
function get_dirs($path = '.') {
$dirs = array();
foreach (new DirectoryIterator($path) as $file) { //THIS IS LINE 47...
I have a pretty large social network type site I have working on for about 2 years (high traffic and 100's of files) I have been experimenting for the last couple years with tweaking things for max performance for the traffic and I have learned a lot. Now I have a huge task, I am planning to completely re-code my social network so I am...
Hi,
Recently I've been doing quite a big project with php + mysql. And now I'm concerned about my mysql. What should I do to make my mysql as optimal as possible? Tell everything you know, I'll be really very grateful.
Second question, I use one mysql query per page load which takes information from mysql. It's quite a big query, becau...
My site requires a login that establishes permissions based on the user. In the photo listing of the site, I must determine if a particular photo will be displayed if the user has guest access only. So I thought that this if else statement would work:
if (!($mysql_row['guest_access'] == 'NO') AND ($_SESSION['user_level'] == 'GUEST')) {
...
I can't get project-specific licenses to work in my Netbeans File Templates. I have a template called "PHP File". The contents look like this...
<?php
<#assign licenseFirst = "/*">
<#assign licensePrefix = " * ">
<#assign licenseLast = " */">
<#include "../Licenses/license-${project.license}.txt">
?>
I also added a file template to t...
I have a url rewrite that looks like this:
RewriteEngine On
RewriteRule ^cancun/tours/$ location-tours-listings.php?locationName=Cancun
RewriteRule ^cancun/tours$ location-tours-listings.php?locationName=Cancun
Problem is that now the page can't find the relative URL's, such as CSS, images, etc...
Is there a way to fix this with a co...
How do I get the PHP reference ID, as is possible with the var_dump function:
// PHP 5.2.6
class Test {}
$test1 = new Test; var_dump($test1);
$test1b = $test1; var_dump($test1b);
$test2 = new Test; var_dump($test2);
Resulting in:
object(Test)#1 (0) {}
object(Test)#1 (0) {}
object(Test)#2 (0) {}
See, var_dump can tell which refer...
I have a function(this is exactly how it appears, from the top of my file):
<?php
//dirname(getcwd());
function generate_salt()
{
$salt = '';
for($i = 0; $i < 19; $i++)
{
$salt .= chr(rand(35, 126));
}
return $salt;
}
...
And for some reason, I keep getting the error:
Fatal error: Cannot redeclare
gene...
Please look at the example code below, when I run it, the defined part is nottranslated in the header function call, is there a special way to do the syntax or is this exact method not possible?
<?PHP
session_start();
define('SITE_URL', 'http://testsddf.com');
$_SESSION['user_role'] = 0;
//if a user is not active, redirect to verifica...
I use my PHP backend to detect Ajax like this:
$_SERVER['HTTP_X_REQUESTED_WITH'].
This gives me a reliable detection, making sure the request is Ajaxed.
How can I make sure the request came from my own domain, and not an external domain/robot?
www.example.com/ajax?true could allow anyone to make an Ajax call and cut the information.
I...
I want the user to be able to type in a fraction like:
1/2
2 1/4
3
And convert it into its corresponding decimal, to be saved in MySQL, that way I can order by it and do other comparisons to it.
But I need to be able to convert the decimal back to a fraction when showing to the user
so basically i need a function that will conver...
I have a php file that outputs json encoded text via
echo '(' . json_encode( $final ) . ')';
And i have a javascript file that fetches that page
$.getJSON(file, function(data){
var object = eval(data);
alert(object); //for testing
...
When any browser other than firefox 3.5 visits the page that calls .getJSON it alerts null
BUT!!!...
Hello,
We are testing a DSL modem's web pages (the HTTP server is running on the modem).
We have an automation tool that configures various options on the web pages by sending
POSTS of the respective web pages
We are using TCL (HTTP package) to send POST data on the web pages .
My questions:
Is there a faster way to do this other...
PHP version is 5.2.11 returns...
Fatal error: Uncaught exception 'RuntimeException' with message 'DirectoryIterator::__construct(/home/test/test.com/wp-content/themes/mytheme/images) [directoryiterator.--construct]: failed to open dir: No such file or directory' in /home/test/test.com/testing123/wp-content/themes/mytheme/functions.php:4...
I have a form which accepts text input. I would like it to be able to accept characters such as & and ; and > and <, which are useful characters for the data being supplied by the user. I want the user to, for example, be able to say
The ampersand (&) is encoded as &
(and I see from the preview that I can't even do that here - it shou...
Hi, I'm using Zend Framework and it is escaping single quotes, double quotes and backslashes. This is done even before I save the text to the database so I guess it is done by the Zend_Form object.
Are those the only characters it escapes? Does Zend have a function to undo this escaping or a way to turn off this escaping?
The text is c...
On my site I have a contactUser.php that sends mail and a replyMail.php. I have put PHPMail on my contact user to send email notifications which is working great. When I put the same code chunk on my replyMail (which mail goes to the same place as the contact user mail,the inbox) that shares the same variables its giving me a internal se...
Really like that function.
$matches = array('12', 'watt');
list($value, $unit) = $matches;
Is there a Javascript equivalent of that?
...
how to get SWF file dimensions in PHP?
...