php

How do you search by the contents of a tag in simplehtmldom?

Hi, I am trying to write a web scraper using simplehtmldom. I want to get a tag by searching the contents of the tag. This is the plaintext inside it, not the type of tag. Then once I have the tag by searching for the contents of its plain text I want to get the next tag after that. How do I find a tag based on its contents? And on...

php imploding array help

I am trying to the implode the userIDs in the $users_in_range array the problem is it is iploding miles instead of userid <?PHP $users_in_range = users_in_range($lat, $long, 500, true); // implode users into mysql friendly list $comma_separated = implode(",", $users_in_range); echo $comma_separated; // this is just for output while...

database query's from class object with php

Hello, My question is: Can I still do query's from within an object like this: $result = mysql_query ($q,$dbc) or trigger_error("Query: $q\n<br />MySQL Fout: " . mysql_error($dbc)); by passing the global dbconnection variable $dbc to the constructor or is there a better way? Or creating a singleton class for...

Suggestions for a user notification system in MySql and PHP

I am implementing a notification system and seeing if these suggestions are valid to set up, if one is better than the other or a better solution is available: A notification is added to the database. A guest / identifiable user logs onto or uses the site. They are greeted with notifications they haven't seen before with the option to c...

How do I replace tabs with spaces within variables in PHP?

$data contains tabs, leading spaces and multiple spaces, i wish to replace all tabs with a space. multiple spaces with one single space, and remove leading spaces. in fact somthing that would turn Input data: [    asdf asdf     asdf           asdf   ] Into output data: [asdf asdf asdf asdf] How do i do this? ...

pass MySQL link to a class method

Here is my problem, i have a class with a ave method, i want to pass a Mysql DB link to it, so i create a new object from the class, and call the saveProperty method, and in my main file i created a MySQL connection and saved the link in a var called $db so when i call the method it's link this: saveProperty($db). but insted of saving t...

.po to .mo convertor in php?

i want a PHP script which can convert .po(Portable Object) as .mo(Machine Object) file? is any script available in PHP? byte +------------------------------------------+ 0 | magic number = 0x950412de | | | 4 | file f...

Extract leaf nodes of multi-dimensional array in PHP

Suppose I have an array in PHP that looks like this array ( array(0) ( array(0) ( . . . ) . . array(10) ( .. ) ) . . . array(n) ( array(0) ( ) ) ) And I need all the leaf elements of this mulit-di...

Display row by row data by clicking next button in php

Need to display data from database in different textbox of each value of one row. when i click the next button then show the next row's value in that textbox and when i click the previous button then show the previous row's value. All code must be in php. ...

Send iPhone HTTP request to Apache PHP webserver

I am programmer with a games and 3D graphics background and at the moment I would like to brush up on my networking and web development skills. I have a task that I would like to accomplish to do this. My idea is that I would like to be able to send a HTTP request or something similar to my webserver, which runs a LAMP based setup. I wo...

Possible preg match miss format in php

I have this code: //fetch data $data = $_POST['list']; echo($data); echo('<br>then<br>'); $data = str_replace("\t", " ", $data); echo($data); $matches = array(); $user = array(); preg_match( "/(.+?) ((?:[A-Z])(?:[0-9]+:){3}[0-9]+) ([0-9]+) \/([0-9]+) ([0-9]+) \/ ([0-9]+)/", $data, $matches ); list(,$user['base'],$user['location'...

how to add time in mysql query

i am using this query select date_time_posting from table where FROM_UNIXTIME(date_time_posting,'%d-%m-%Y')='$c_day_date' where $c_day_date is having dates in dd-mm-yy format like 25-07-2009 My server is in different time zone from mine.Total difference is of about 6 hours i.e. my local timezone is 6 hours ahead of my server timezone....

know of a good tutorial for posting status updates to facebook?

I'm looking for a tutorial for updating Facebook status in PHP. Any suggestions? ...

Doctrine migrations in symfony don't update model and forms

I've been testing the Doctrine migrations in symfony and I finally got them to work, but I noticed that these migrations only update the database. The forms and the model are not updated as I expected... Is this normal? If it's normal, is there a way to update the model with the changes made to the db? ...

Online video streaming

I want to make a video site in which we can upload the video in any format and display it like youtube. How can I do this? My whole site is in PHP I'm a newbie in the video streaming sp plz be descriptive with your answer Thanks ...

PHP: count uppercase words in string

Hi, is there an easy way to count uppercase words within a string? ...

[PHP] get only 5 elements from array

Hi all, my array is setup as follow: array 'testuri/abc' => array 'label' => string 'abc' (length=3) 'weight' => float 5 'testuri/abd' => array 'label' => string 'abd' (length=3) 'weight' => float 2 'testuri/dess' => array 'label' => string 'dess' (length=4) 'weight' => float 2 ...

The Best PHP Templating Engine

Possible Duplicate What's a good templating system for PHP? What is your favorite PHP templating engine? There are a few frameworks, such as Symfony, that comes with its own templating engine, but there is also some other third party templating engines available, such as smarty. Which is your favorite? ...

Find longest repeating strings?

I have some HTML/CSS/JavaScript with painfully long class, id, variable and function names and other, combined strings that get used over and over. I could probably rename or restructure a few of them and cut the text in half. So I'm looking for a simple algorithm that reports on the longest repeated strings in text. Ideally, it would r...

How do I protect the database server?

Currently my database user and its password are pretty easily to guess, eg. database user: dbadmin database pwd : super + companyname What and how to generate a secure a secure database password? Using md5 or sha1?? What are the things that I need to pay attention to secure my database? I am using php, thanks ...