Hi,
I have a strange problem here: If I try to download more than one file with the same download script (I've tried 5 different scripts found on php.net), the first goes well but the second has a delay of about 60 seconds from the time of its request. If I cancel the first download, then the second starts suddenly.
I've tested direct f...
How can I on 'allow_url_fopen' in .htaccess or PHP file ?
please help me
...
When I have something like this:
$row = mysqli_fetch_assoc($result);
Does $result now have one less row in it?
If I loop mysqli_fetch_assoc through all the $result, will it be empty afterwards?
...
Hi, i was wondering what the best way is to implement a hit counter for articles, products, etc. Now if someone visits the page the counter just adds one in the database. If someone refreshes the page it counts continuously, misleading results, and unnecessary reads, writes.
I was thinking of storing their ip, but i don't know how to mo...
I made a class. I give it some objects (mostly retreived database rows) as input, and tell it which fields it has to show, and which buttons I want. Then it renders a very nice html table! It's pretty awesome, I think.
$ot = new ObjectTable();
$ot->objects = $some_objects;
$ot->fields = array('id','name','description','image');
$ot->but...
Hi,
This thing has been bugging me for long and I can't find it anywhere!
What is the difference when using classes in php between :: and ->
Let me give an example.
Imagine a class named MyClass and in this class there is a function myFunction
What is the difference between using:
MyClass myclass = new MyClass
myclass::myFunction()...
I found that there are many if-else statements, especially nested if else statements, these statements make my code less readable. How to reduce the number of if else statements in PHP?
My tips are as follows:
1.Use a switch statement when it is suitable;
2.use exit() statement when it is feasible;
3. Use ternary statement when it is fe...
I need a way of taking an equation given as a string and finding it's mathematical answer, the big caveat is that I can't use eval().
I know the equation will only ever contain numbers, the four mathematical operators (i.e. * / + -) and parentheses, it may or may not have spaces in the string. Here's a couple of examples.
4 * 4
4+6/3
(...
In my web hosting server, file_get_contents() function is disabled. I am looking for an alternative. please help
...
in my project site if i click on a link and the PDF opens in a new or parent window. Well I want a box to appear that prompts the user to download the file instead of opening it. Does anyone know of a simple JavaScript onClick event that will do this? In all browser default with default settings.
EDIT:
sorry my server was PHP based
...
I want to trigger a URL without user interaction. I used
file_get_contents($myurl);
But in my webhost file_get_contents() is disabled. how to do that. I dont want to read the contents of the URL. I just want to trigger the URL. Also I can not use header() function, because, Im going to trigger the url in a loop, so header will not be ...
I'm still learning the ropes with PHP & MySQL and I know I'm doing something wrong here with how character sets are set up, but can't quite figure out from reading here and on the web what I should do.
I have a standard LAMP installation with PHP 5, MySQL 5. I set everything up with the defaults. When some of my users input comments to ...
Hey everyone,
I'm thinking about how to handle sending large amounts of email from my web applications, and whether there are any best practices for doing so. StackOverflow is already labeling this as 'subjective', which it may be to an extent, but I need to know the most successful way to implement this system, or whether any standardi...
Hello,
The pagination below works well. It splits a table into 25 rows per page. However, when I click on a page besides page one, there is a large space between the bottom of the 25 rows and the pagination links. I think the problem is related to the CSS. How can I get rid of this large space?
Thanks in advance,
John
/****** bu...
I want to ask which is a better free web host provider with allow_url facility. I know this is not right place to ask this. where should i ask this
...
$ckfile = tempnam ("/tmp", "CURLCOOKIE");
$useragent="Mozilla/5.0 (iPhone; U; CPU iPhone OS 3_0 like Mac OS X; en-us) AppleWebKit/528.18 (KHTML, like Gecko) Version/4.0 Mobile/7A341 Safari/528.16";
$ch = curl_init ("website.com");
curl_setopt($ch, CURLOPT_USERAGENT, $useragent);
curl_setopt ($ch, CURLOPT_COOKIEJAR, $ckfile);
curl_setop...
Hi,
I need to initialize an array of objects in PHP.
Presently I have the following code:
$comment = array();
And when i am adding an element to the array
public function addComment($c){
array_push($this->comment,$c);
}
Here, $c is an object of class Comment.
But when I try to access an functions of that class using $comment,...
Hi,
I am trying to get the search keyword from a referrer url. Currently, I am using the following code for Google urls. But sometimes it is not working...
$query_get = "(q|p)";
$referrer = "http://www.google.com/search?hl=en&q=learn+php+2&client=firefox";
preg_match('/[?&]'.$query_get.'=(.*?)[&]/',$referrer,$search_keyword);
...
Hi
Take the following code:
$target = 'NAME FUNC LPAREN P COMMA P COMMA P RPAREN';
//$target = 'NAME FUNC LPAREN P RPAREN';
//$target = 'NAME FUNC LPAREN RPAREN';
$pattern = '/(?P<ruleName>NAME )?(?P<funcName>FUNC )?(?:(?<=LPAREN)(?: (?P<arg1>P))|(?P<args>P)(?=(?: RPAREN)|(?: COMMA)))/';
preg_match_all($pattern,$target,$matches,PREG_O...
I've spent the last eight months working in the LAMP stack.
Since I just graduated college with a degree in Computer Science, I'm still very new to programming. I've looked at the trends, and for non-Microsoft development stacks, Java and PHP top the list.
Given that most of the Java positions in my area (Toronto, Canada) are for S...