php

How is the PHP array implemented on the C level?

The PHP array is one of the language's core features IMHO. It is sparse, allows multi-typed keys in the same array, and supports set, dictionary, array, stack/queue and iterative functionality. BUT after working with PHP for a while now, I've found that quite a few of the array_* functions are much slower than you'd think at first glanc...

php code for language detection doesn't work on WAMP server 2

I'm using this $lang=$_SERVER['HTTP_ACCEPT_LANGUAGE']; to detect the language of the browser. At first, I thought something was wrong with my code. But then I tried this demo, and even if I had my 'display preferred language' as Spanish (es), it displayed the content English (en). Finally, I figured out that it doesn't work in localhost ...

PHP script for calculating Krippendorff's Alpha

I can't find any PHP script to compute Krippendorff's Alpha. I need this for a project I'm working on, but the only things that I was able to find online are either written in Python (that I know nothing of) or are for SAS/SPSS software suites. Any help is appreciated. Thanks! ...

Adodb, escaping quotes?

I am using adodb with php. I need to insert html into my database, and need to know the best method to escape the quotes before inserting it into the database? I tried using pg_escape_string() but it still does not seem to insert. What is the best method to do this? ...

cannot retrieve value in database and cannot update the table

situation: i have changepass page to change password. but the page cannot retrieve and display the value in the database. i want to display the ID, name and department that have been stored in the db. the newpasswword also cannot be update...plz..help me.. here's the code: <?php session_start(); $username = $_SESSION["username...

Retrieving truncated record from mysql database

Say you have a string 3.4564. A sample set in the database has these records(VARCHAR): Name Score Peter 3.35643294332 John 3.47870923 James 3.740249842 Henry 4.0432849 Solomon 3.456183923 Andrew 3.45743 You want to truncate 3.4564 to 3 decimal places(to become 3.456) then compare with the values of ...

Design Pattern for Drilldown / Filtered Search

I'm looking to build a powerful search feature for a site, similar to NewEgg's drilldown search, e.g., http://www.newegg.com/Product/ProductList.aspx?Submit=ENE&amp;N=2010150014%201035507776&amp;name=7200%20RPM I'm working with a variety of objects similar to products which have different criteria. Can anyone recommend a good design fo...

How can I have a file for each language's content in this php language detection demo?

This tutorial is about language selection according to preferred language on browser. lang.php: <?php function dlang($Var) { if(empty($GLOBALS[$Var])) { $GLOBALS[$Var]=(!empty($GLOBALS['_SERVER'][$Var]))? $GLOBALS['_SERVER'][$Var]: (!empty($GLOBALS['HTTP_SERVER_VARS'][$Var]))? $GLOBALS['HTTP_SERVER_VARS'][$Var]:''; } } fun...

Creating a login based website in Drupal

Hello, Im a Drupal beginner. I want to create a simple website, which has a login form. Users should be able to register on the website and then be able to login into it. Can someone please provide some tips or point me to some resources online which can help me achieve this functionality ? Thank You ...

PHP to Javascript, array to array, object to object

I have a list of image paths in my PHP script that I would like to pass to javascript whitout rendering them in the HTML page. I mean, I don't want people go fishing for the path's when do do a > view HTML source. <?php $images_str = "some/dir/001.jpg|*|some/dir/002.jpg|*|some/dir/003.jpg"; $images_arr = array('some/dir/001.jpg'...

My includes dont seem to be working now that i have uploaded the files to the production server

They were all working fine on my XAMMP sandbox but now nothing. Something im doing wrong. Here is the code: index.php Contains mass include, which basically has all the includes in it. <?php //Starting session session_start(); //Includes mass includes containing all the files needed to execute the full script //Also shows homepa...

Displaying user input on my page

In our application, we allow user's to write their Bio using a WYSIWYG editor, but it often contains bad HTML that breaks our page. Is it a good idea to show the user bio inside an iframe so it doesn't affect the rest of the page? Or any better options? Thanks ...

PHP: Search in more tables at once?

Hello. How do i make a mysql query for more tables to check at once? i mean, something like: $sql = mysql_query("SELECT username FROM table1, table2, table3 WHERE username = '$username'"); $numer = mysql_num_rows($sql); echo "You have ".$number; can you do like this? What i want to do is to show a user all his posts from the whole s...

pick selected name from array val

Array ( [4] => stdClass Object ( [vid] => 4 [name] => Movie [description] => [help] => [relations] => 1 [hierarchy] => 0 [multiple] => 0 [required] => 1 [tags] => 1 [module] => taxonomy [weight] => 0 [nodes] => Array ( [lyrics] => lyrics ) ) [1] => stdClass Ob...

form problem after sending (cookie problem)

Hi, I get a strange error after submitting a form the error is this one: Warning: Cannot modify header information - headers already sent by (output started at /var/www/g35003/coldcharlie.nl/subdomains/test/mailer.php:6) in /var/www/g35003 /coldcharlie.nl/subdomains/test/mailer.php on line 96 ...

(Zend Framework > Zend_Config) How to avoid using .ini or .xml config?

Hello, I don't think that using .ini or .xml file is a good idea with high traffic projects because every page load causes parsing config.ini or .xml file. Is there any way to replace using .ini/.xml with regular php array as config? Now php ini looks like that... [production] phpSettings.display_startup_errors = 0 phpSettings.display...

PHP Fatal error: Using $this when not in object context

Hello Everybody, I've got a problem: I'm writing a new WebApp without a Framework. In my index.php im using: require_once('load.php'); and in * load.php* I'm using require_once('class.php'); to load my class.php. In my class.php I've got this error: Fatal error: Using $this when not in object context in class.php on line ... (in t...

PHP throwing XDebug errors ONLY in command line mode...

Hey, all! I've been having a few problems running PHP-based utilities within the command line ever since I enabled the XDebug. It runs just fine when executing script through a browser, but once I try an execute a script on the command line, it throws the following errors: h:\www\test>@php test.php PHP Warning: PHP Startup: Unable to ...

Language switcher in PHP

I have made a site with classic php and mysql functions. I order to insert a language switcher, how can I change the language of site without duplicating site folder? Thanks in advance ...

why lost data in session ?

data lost when passing session to array and using foreach(looping). qty lost is the text from another page why lost this???? using looping to delete item by id from get (using link in another page) $cart = $_SESSION['cart']; $id = $_GET['id']; $arrcart = array(); $count=0; $qty = intval($_POST['product_'.$product['product_id']]);...