php

echo php function in HTML, will it work ?

I have a drop shadow function in PHP. In my php page, I have HTML set up like this: <img src="<?php echo drpShadow($img_path[$i]);?>" /> The php function is like this: function drpShadow($pic_url){ echo "Hello"; list($width, $height)=getimagesize($pic_url); $pic_display="<table border='0' style='display:inline;' cellsp...

How to add an element To Array

Hmm.. thats realy different problem I fetch $links from db linke this $links = $db->GetAll("SELECT * FROM {$tables['link']['name']} WHERE STATUS = '2' AND CATEGORY_ID = ".$db->qstr($id)." {$feat_where} {$expire_where} ORDER BY {$sort_cols[$sort]} {$sort_ord[$sort]} {$limit}"); The array looks like this array(28) { ["ID"]=> str...

AJAX Controlled Multiple Select Box Strategy

I've done some reading on AJAX, and would like to create a listbox, that controls what is displayed in a separate textbox located within the same form. The backend of the website is handled in php, and the possible values and whatnot is stored within the MySQL database via php. What's the best way of obtaining the listbox values as well ...

How to declare a two dimensional array most easily in PHP?

Like : declare int d[0..m, 0..n] ...

Appropriate use of exceptions?

We are developing a collection class for a specialized PHP application. In it, there are functions named map, each, etc. A debate has been brought up about calling some functions with a bad argument. For example: public function each($fn) { // ... } // ... $collection->each('not a function'); Should the call to each throw an ...

Running 30 php script at once in the background

I have a PHP script that must run 30 parallel times each with a different argument. What is the best way to do this so that each script can have as much even exposure to the processor as possible? ...

PHP inverse of a matrix

I saw this question,and pop up this idea. Is there an efficient way to do this in PHP? EDIT Best with a demo? ...

PHP: Can someone explain how this code works? (Fibonacci)

I promise this isn't homework. I'm just a curious novice. How does this: function f($i){return $i<2?$i:f($i-1)+f($i-2);} (written by someone smart) produce the same result as this function fibonacci($n, $arr = array(0,1)){ $arr[] = $arr[(count($arr) - 1)] + $arr[(count($arr) - 2)]; if (count($arr) == $n) return $arr[$n - 1]; els...

PRE tag to Plain Text

I am making a site where code will be displayed as plain text in a PRE tag (no highlighting, comments, no edit tags) and the I want them to be able to click a button and have the highlighted, commented and edit tag code to appear (also in a pre tag) . Obviously I have to store the highlighted HTML code somewhere but I was looking for a ...

Determining which PHP source files are not used.

I have a large web app, and I think there are a bunch of old files that are no longer being used, is there an app which can tell me what these files are? ...

How does the php snippet work?

$this->_config = parse_ini_file($configIniFile); And this is the content of $configIniFile: ; <?php exit; ?> DO NOT REMOVE THIS LINE [database] host = localhost username = root password = dbname = openslopeone port = 3306 adapter = PDO_MYSQL ; PDO_MYS...

php breaking it down

I was looking at some code and I came across this line: Machine drink[] = {{"Coke", .75,7}, {"Sprite", .55, 2}, { "Pepsi", 1.00, 5}} At first I thought it was an array, but in php we don't create arrays like this, unless if this is some advanced technique for creating an array that I am not aware of. And why is it constructed li...

PHP/MySQL last edit script?

How do I create a php script that stores and displays when an article was last edited using PHP and MySQL. ...

Why my typeset function doesn't work for non-latin/Asian characters?

Hi all: I've convinced my boss to do the typesetting stuff using PHP(PHP Version 5.2.8). And this is what I got so far(set Character encoding to Unicode(UTF-8) if you see misrendered Japanese characters): demo page at my personal website Basically, if you copy and paste the latin sample paragraph into the textarea and click the button...

how can i custom format a string ?

i have a site where users enter a numeric code of 10 numbers. when reading from the db and displaying the codes i want it to display in this format xxxx-xxxx-xx how can i do this with php or jquery ? ...

How to retrieve the title part of other web page like google or yahoo using php??

Hi, I want to retrieve the title of the cricinfo.com webpage. How to retrieve it using php. Please help me ...

Imagemagick convert pdf to png

I am rather new to using the command line and php. That being said I have been trying to figure out how to use ImageMagick with the exec() function. I have this currently, $command="/usr/local/lib/ImageMagick convert images/a.pdf images/a.png"; if(exec($command)){ echo 'yes'; } else{ echo 'no'; } Which is returning 'no'. ...

name="option11",name="option21",name="option31",name="option41",1,2,3,4.., is a variable. How to write the code?

$html=<<<html <div>A:<input type="text" maxlength="40" size="8" name=option$i."1" value='$option1'/>(answer)</div><br/><br/> html; echo $html; $i is a variable. For example, when $i=5, the value of name should be "option51". So the HTML code should be <div>A:<input type="text" maxlength="40" size="8" name="option51" value='$option...

How to export all Yahoo emails using PHP

Can anyone tell me what the best way to export about 90K emails off of a Yahoo account? The way it stands now, I believe that every email would need to be extracted one by one. I'd like to write a program to do this for me. Can someone give me any ideas as to the best way to so this? What I am after are the sender email addresses (that ...

PHP / MYSQL: Sanitizing user input - is this a bad idea?

I have one "go" script that fetches any other script requested and this is what I wrote to sanitize user input: foreach ($_REQUEST as $key => $value){ if (get_magic_quotes_gpc()) $_REQUEST[$key] = mysql_real_escape_string(stripslashes($value)); else $_REQUEST[$key] = mysql_real_escape_string($value); } I haven't seen anyone el...