I have a function that searches for a string inside a text file. I want to use the same function to assign all lines to an array in case I am going to replace that string. So I will read the input file only once.
I have the search function working but I do not know how to deal with the array thing.
the code is something like that (I ma...
Hi,
I'm trying to figure out the best method of getting/displaying the shortest distance between multiple locations. To best explain this think of it as a map and use the following below. All of the distances and paths from each location would be already put in a mysql database.
Locations(Letter -> Locations it can reach. and distance/...
Hi,
I have used the following php function to create thumbnail image.
function createThumbs( $pathToImages, $pathToThumbs, $thumbWidth )
{
$dir = opendir( $pathToImages );
while (false !== ($fname = readdir( $dir ))) {
$info = pathinfo($pathToImages . $fname);
if ( strtolower($info['extension']) == 'jpg' || strtolowe...
EDIT: This question is solved, but I can't accept my own answer just yet.
Howdy!
So I've got a PHP/CodeIgniter webapp. I've got some custom Ajax-based tracking code inserted into my page - however obviously, for testing purposes, I don't want this code to fire when I'm running the site locally on my development computer.
In order to a...
Hey all
I am using MySQL and the 'like' query in order to find pages. I need to be able to do things this way, but this means that these pages will be the same:
www.mysite.com/blog/hello-world
www.mysite.com/blog/hello-worl
They both work, and bring up the same page. How (possibly using .htaccess?) can I get around this problem? :\
...
Hi.
New to mysql and php, so forgive any obvious stupidity, please!
One of mysql tables has category fields, indexed from a table of categories. Each of the categories is named category_1, category_2, category_3, etc.
I'm assuming that can't I use a wildcard to search these categories, like:
'SELECT * FROM products_table WHERE cat...
how we can protect a website from "Cross-Site Scripting Phishing Through Frames" by php..
thanks
...
I have a globalish variable which is $VARcurrenttime = time(); then I normally call that variable when computing anything with that timestamp (which is a lot). Someone suggested to me that using time() instead of the variable would be somewhat faster. I don't really know but could someone advise me on whether I would bother changing this...
What is the best way to construct a audio player that can communicate with the jquery on my site?
Can I have flash send jquery commands when a song is finished playing?
Does html5 audio support a onSongEnd or similar function?
Songs on my site are a series of links that trigger jquery to reload a flash audio player with the appropriat...
Is there any way to get only images (jpeg,png&gif) while using:
$dir = '/tmp';
$files1 = scandir($dir);
...
I'm creating comments stored in a MySQL database.
I'm logging the php time function time() as the comment is posted. That way it's displaying a message such as... "comment... posted 4 seconds ago" and if I refresh the page 2 minutes later it'd display "comment... posted 2 minutes ago"
Here's how I am entering time() into the database ...
There is a lot of books and tutorials about php that are completely different from each other.
How can I choose the right way? Is the only way is test with xdebug or phpUnit or benchmark?
...
there are 10 variables. say $var1, $var2, $var3, $var4,....$var10
and a $count variable. what I am looking for is if all variables are set then $count = 10+1 or if 9 variables only set then $count=9+1 or if 8 variables only set then $count=8+1 and so on last up to 1 variable(for one variable is set then $count = 1+1).
I know do this w...
I need to create a table in runtime by using php and html,the table should look like:-
image1 image2 image3
name1 name2 name3
---------------------------------
image4 image5 image6
name4 name5 name6
total 2 rows,each row containing 3 data,each data again containing 2 rows,one is a imag...
Hey everyone,
I have recently gone into extending my site using node.js and have come to realisation I need a session handler for my PHP sessions. Now everything was cool and dandy and node.js reads the php sessions and can propogate it's own session with the php ones. I am using database sessions so the session data gets saved into a f...
How can i make an array like below through a loop? The text will generated from database!
$listofimages = array(
array( 'titre' => 'PHP',
'texte' => 'PHP (sigle de PHP: Hypertext Preprocessor), est un langage de scripts (...)',
'image' => './images/php.gif'
),
array( 'titre' => ...
For an example input of:
<a href="abc" something=b foo="bar" baz=cool>
I am trying to match:
something=b
baz=cool
However, everything I end up with will only match the first one (something=b), even when using preg_match_all. The regular expression I am using is:
<\w+.*?(\w+=[^"|^'|^>]).*?>
Or:
<\w+ # Word starting with <
.*? #...
I have a simple cmd.php page to run commands I enter using shell_exec () and show the output.
PHP is running as CGI
Entering "php -v" and most commands just show "Content-type: text/html" and then the current page's HTML source.
However, calling PHP with an invalid parameter (/usr/bin/php -z) shows PHPs usage:
Usage: php [-q] [-h] [-s...
Hello guys,
i posted a question a while ago and i got my answer but now i kind of want a followup to this problem so i have a table like the one in the picture but i want to add total to each row or in fact a group how can i do that.
This is the php code to create this table how to edit it to add the total.
$sql = mysql_query(
"SELECT...
What is the best way?
include the script
write the script as function in for example functions.php, include the functions.php and call function
thanks
...