php

ajax how to read out $_post variable

Hi, I am trying to filter/search a database with ajax $.ajax({ type: "POST", url: "filterSearch.php", queryString: qry, success: function(data){ alert( "Data Saved: " + data ); $('#searchResult').html(data); // Fill the search results box } }); Now in filterSearch.php i have the following test codes if(iss...

Best way to implement a meta language compiling down to PHP.

I've been working on the specifikation / kitchensink for a meta language that can compile down to PHP for some time now. Now I want to begin building the thing. Before I have implemented tiny DSL's using PHP_Lexergenerator and PHP_Parsergenerator and they have worked very well but I have never build anything this scale before. I would ap...

[PHP] array_diff & renumbering numeric keys

(I'm a beginner) My script uses the standard $c = 0; $t = count($array); while ($c < $t) { $blah = $array[$c]; ++$c; } rather extensively. But I just ran into a situation where I also need array_diff and it breaks that all to hell because now the numeric keys have gaps. I'm getting Undefined offset errors all over the place. H...

Total number of repetition of array value in PHP.

Hello, I have an array like: [Organization_id] => Array ( [0] => 4 [1] => 4 [2] => 2 [3] => 4 [4] => 2 [5] => 4 [6] => 4 [7] => 4 [8] => 2 ) Now i just want to know that how many times the vale '4' & '2' does...

creating an image in php using mysql resut set

Is there anyway to create an image outof mysql result set in PHP using GD library? I am ucrrently displaying the resultset in a table format in my php page. ...

PHP: Get name of variable passed as argument

Possible Duplicate: How to get a variable name as a string in PHP? problem Sometimes, I need to to show name of variable passed as argument while debugging, can I get a name of var passed to function if it exists and value if it doesn't? example function foo($bar){ print_variable_name($bar); //<- this part baffles me } f...

how can use a javascript variable as php variable?

hi, im trying to include javascript variables into php code as php variable but having problems doing so. When a button is clicked, the following function is called: <script type="text/javascript"> function addTraining(leve, name, date) { var level_var = document.getElementById(leve); var training_name_var = document.getEle...

Php template caching design

Hello to all, I want to include caching in my app design. Caching templates for starters. The design I have used so far is very modular. I have created an ORM implementation for all my tables and each table is represented by the corresponding class. All the requests are handled by one controller which routes them to the appropriate w...

MySQL: How to make data unique for several rows in a table?

How would I do the following (interested only in how to do UNIQUE (title, description)) in myphpadmin?: CREATE TABLE `myData` ( id serial primary key, title varchar(255) not null, description varchar(255) not null, UNIQUE (title, description) ); And by the way, so as not to open another question on SO, I would like to ...

What is the best way to select multiple rows by ID in sql?

I need to select multiple records I use SELECT * FROM `table` WHERE `ID` =5623 OR `ID` =5625 OR `ID` =5628 OR `ID` =5621 this query run 4 times in every second whit php is there a better and faster way for this ? ...

Windows7 WAMP 64-bit stack MySQL problems

By using this guide here -> http://www.elxis.org/guides/developers-guides/64bit-apache-php-mysql-windows.html And hacking through the errors and issues that came up, I've got an apache, php, and MySQL stack almost working on Windows 7 - all 64 bit. PHP and apache are working just fine, and phpinfo tells me that mysql support is enabled...

how to retrieve value from cache file in php

i am storing web page in cache file. and i want to retrieve related data.but it does not work.every time it retrieve from database.how can i do this please help me. ...

Wordpress > Scripting the 404.php to send 201 host header on specific 404 requests

In my wordpress site, I have a specific condition that triggers a 404 in which I want to handle as a "404 exception" (< there's probably a better term I could use but hopefully it conveys the spirit of what I'm trying to do :) For example, the page mysite.com/site-map does not exist in my site, however, I have a link called "Site Map" ...

is there a way to set a class variable to apply to all instances of that class in php?

I'm probably asking the question badly, so I'm going to give an example. I have a class that is something similar to this: class myclass { var $template = array(); var $record = array(); function __construct($template,$record) { $this->template = ( set = to a database response here ); $this->record = ( set = to a database...

Regex problem (PHP)

[quote=Username here]quoted text here[/quote] Reply text here I need a regular expression that stores the "Username here", "quoted text here" and "Reply text here" in a Array. This expression needs to support nesting aswell. Eks: [quote=Username2 here][quote=Username here]quoted text here[/quote] Reply text here[/quote] Reply text...

HTMLPurify - Disable Javascript

I use HTMLPurify for disabling JavasSript in a textarea. My problem is: $config = HTMLPurifier_Config::createDefault(); $purifier = new HTMLPurifier(); $va = $purifier->purify($va); This removes script tags, but does not remove [a href='javascript:...']link[/a] What should I do to remove the bad links and retain good links? ...

Should I rollback failed SELECT statements or commit successful ones?

Out of habit I've been using try/catch blocks in my application code for all SQL queries, with a rollback at the beginning of the catch block. I've also been committing those which are successful. Is this necessary for SELECTs? Does it free up something on the database side? The select statements aren't altering any data so it seems ...

Read plain text from binary file with PHP

File 1: asdffdsa File 2: asdfjklfdsaHGUik How do I read these binary files with PHP such that I can populate an array with the plaintext like: $file1_output = ["asdf", "fdsa"]; $file2_output = ["asdfjkl", "fdsaHGUik"]; ...

How to generate unique alphanumeric content in MySQL?

Say, values would be 1000-characters long. ...

generate a unique hash value which can be used as primary key in mysql thru php

I am using auto increment value for the inserts in my table. But is there any other way to generate a unique value (which is small enough and not GUID or UUID) in php to insert as primary key in mysql? Basically I want to get the value that is used as PK, but using auto increment I guess I cannot get the next auto increment value? Plea...