I want to convert
<p>Code is following</p>
<pre>
<html><br></html>
</pre>
to
<p>Code is following</p>
<pre>
<html>
</html>
</pre>
I don't know how to write regular expression for replace between pre tag in PHP.
I tried this code http://stackoverflow.com/questions/1517102/replace-newlines-with-br-tags-but-on...
i code some configuration setting. And need those values to be load, everytime my webapp start. yes, it's somekind autoload setting.
But, right now, i have to choose between save it as object or array. is there any different between them when we save them in database ? which one is faster or maintainable or other pro and cons
thanks
...
How can I connect from one website to database of another website in php.
...
hi how to find no of weeks and each mondays date between 2 dates. for ex 10-07-2009 to today .
Note :consider leap year and other date related constrains also.
...
Hi. I am writing a plugin for wordpress and I want to create my own search. I have tried to alter the wordpress search, but what I am doing is very specific with the SQL query. I am comparing lat and long coordinates and getting posts based on that.
I can display posts by using the standard wpdb query, but then I don't get the other fe...
I intent to resize an animated gif and outputing it to the browser on-the-fly. My problem is that when I save the resized image it is of good quality, but if I echo it to the browser it is of poor quality and the animation is removed. Here is the code:`
header("Content-type:image/gif");
try
{
/* Read in the animated gif */
$anim...
Hi ,
Am looking free like TextAds open source ,
if u know any thing similar like this OPENSOURCe, please refer that URL ,
Thanks
...
i use file_get_contents() to get dinamic data.
here is my script...
$str = file_get_contents("http://cba.am/");
some script here...
it works fine for a long time, but now it returns Connection timed out.
and what is strange, when i run the script from local server, it works fine.
could you tell me why, and what can i do, to solve th...
Hello!
How do i get the actual max length of a specified column in php?
For instance, this table:
id - int(11)
name - string(20)
I want in php to select the maximum number of characters that a field can have, like
SELECT length(name) from table1
and it should then return 20 (since its the maximum number of characters for that field)...
This is part of my code:
$con = mysql_connect("localhost","username","passs");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("database", $con);
if(mysql_num_rows(mysql_query("SELECT name FROM xbox_user WHERE name = '$user'"))){
// Code inside if block if userid is already there
$result = mysql_q...
Basically what I want to do is to send an email to follow up on order placed in 3 hours later.
What I try to do is to get the current date (up to hours level), then compare with the orderdate+ 3 hours, to see whether it match.
Example orderdate: 2010-06-12 18, after add 3 hours should become 2010-06-12 21
However, after add hour, the ...
Hi,
where, in your opinnion, should a breadcrumbs path be declared (in other words, in which letter of MVC)? So far I've been declaring it in Controllers, but I've recently started to work with CakePHP, where it is all made in Views and it surprised me.
I'm just curious of your opinions.
...
I'm getting really muddled up now and my brain hurts! :( lol
Root:
index.php
Includes:
cat.php
dog.php
index includes dog: include("includes/dog.php");
dog includes cat: include("cat.php");
When I run index, for cat it says:
A link to the server could not be established
Access denied for user ...
However, if I run dog, I...
hey guys
i need to query my database and find results :
mysql_query("select * from ".ALU_TABLE." where username like '%$q%' or name like '%$q%'");
if i have a name in my table such as Book and i enter book in search box it wont show the Book
i need to query my database as not to be case sensitive.
...
Hi, what is the shortest way to calculate the difference in months (average num of days in a month as 30) between two unix timestamps? Date::diff is available for working with DateTime objects, but I'm wondering if there's a neat way to work this out with timestamps...
...
I am trying to redirect visitors to a site based on their referring url.
Here is the script:
php
$domain='blankds.com';
$referrer=$_SERVER['HTTP_REFERER'];
echo $referrer;
if (preg_match("/$domain/",$referrer)) {
header('Location: http://www.blackisgreen.org/page_1.php');
} else {
header('Location: http://www.blackisgreen.org/page_...
here is a site http://www.lyrkjsw.gov.cn that can let the registered user to upload file (e.g. images or office files) to the site.
i want to register user and upload image to this site using libcurl binding with php.
only registered user can upload image. so i use cookiejar stored in c:\cookie.txt after register and use c:\cookie.txt ...
I'm trying to access an FTP server from my PHP script using Codeigniter's FTP Library. These functions work great, but when testing the script I discovered that if I attempt to connect to a server that does not exist, the script does not terminate with an error message of any kind.
The page continues to execute, until the web server giv...
This is an extension of this question: http://stackoverflow.com/questions/3027082/understanding-how-to-inject-object-dependencies. Since it is a bit different, I wanted to separate them, to make it, hopefully, easier to answer. Also, this is not a real system, just a simplified example that I thought we'd all be familiar with. TIA. :
...
I'm trying to run a query through the ORM like this:
SELECT * from table where (fname like 'string%' or lname like 'string%')
AND (fname like 'string2%' or lname like 'string2%');
Here's what i have so far:
$results = ORM::factory('profiles');
foreach ($strings as $string) {
$result->where('fname', 'like', "$string%");
$r...