I have a function that exports values into a CSV file, but the "comments" field has commas in it and it messes up the columns when you open it in a spreadsheet program.
Is there a way around exporting it properly?
//this exports only names and comments into a CSV file
function exportNamesCommentsCSV($table, $columns) {
$file = "vol...
I know that it's more performant to use '' delimited strings rather than ""...
but I was wondering if there's any performance improvemente doing this
$a = array( 'table' => 'myTable', 'order' => 'myOrder' );
$table = $a['table']
instead of
$a = array( table => 'myTable', order => 'myOrder' );
$table = $a[table]
I guess so, bu...
I want to use CURL library but I don't want to install it in a hard way
I just want to do something like this
require_once('curl.php');
I am not sure if this possible or not? and where can I found this CURL class?
thanks
...
I'm trying to insert a new event into Google Calendar, which I can do fine by the following:
$sname = Zend_Gdata_Calendar::AUTH_SERVICE_NAME; // predefined service name for calendar
$client = Zend_Gdata_ClientLogin::getHttpClient($userName,$password,$sname);
$service = new Zend_Gdata_Calendar($client);
$event = $service->newEventEntry(...
I am using PHP to build a web crawler to crawl millions of URLs, what is better for me in terms of performance? file_get_contents or CURL?
Thanks.
...
I'm trying to display an image using a PHP script. Basically so the php script is passed on the full path to the image, and it then displays that image in the browser. I've checked to make sure the image exists, it is being read correctly, etc, however in the browser i just see the broken image box (e.g the small red cross in IE) if I go...
Because of the nature of new project we are about to start, I need to get into Java world rather quickly.
I have about 8 years of PHP experience, and about 3 year in Javascript.
(CI, Kohana and my own MVC framework)
I have solid knowledge of OOP (as much as you can get from PHP/JS and little ActionScript & python here and there)
So i...
Lets assume I have an array in PHP:
$array = array("apple", "banana", "cap", "dog", etc..) up to 80 values.
and a string variable:
$str = "abc";
If I want to check whether this string ($str) is exists in the array or not, I use preg_match function. Which is like this:
$isExists = preg_match("/$str/", $array);
if ($isExists){
...
Hi,
I'm learning about timestamps. I can find lots of infomation about extracting data from current timestamps but little about querying a database timestamp. For example, I'd like to perform the following (the syntax is not correct, but should hopefully illustrate my question)
SELECT * FROM database where timestamp DAY('12') AND MONTH...
I'm working on a website for a client, in PHP/MySQL. They are a publisher, and the site needs to show whether the book you are looking at is in stock with their distributor.
The stock file is a CSV file on the distributor's FTP. This file is updated at a certain time every evening. So far I've written a script in PHP that copies the con...
I don't have whois installed on my server (apparently it's in the works but no real news on it). I was wondering if anybody knew a way to emulate the functionality of it though. I figured I'd be posting some data to a url but I don't know what, or where.
Basically I'm at a complete loss, and would appreciate any help or even something t...
I have an array of times I want to print out. I want the times that have passed lets say 12:00 clock to be 'greyed out'.
$theTime = '12:00';
if($theTime >= $time[$i])
{....}
02:30
03:50
03:20
04:50
05:45
19:45
20:00
20:50
20:55
21:25
21:30
22:00
22:45
23:55
00:50
00:55
Im doing a simple compare 12:00 a clock to each value.
The p...
Is there any different typing:
<?php echo $_SERVER[REQUEST_URI] ?>
and
<?php echo $_SERVER['REQUEST_URI'] ?>
and last
<?php echo $_SERVER["REQUEST_URI"] ?>?
Them all work... I use the first one.
Maybe one is faster than the other?
Thanks
A Noob
...
I'm developing some lower end code in my system that uses multiple child classes of the php exception class. Essentially I have the exceptions broken up to a few categories. What I'm wanting to do is two things.
I need all exceptions that are fired in the application to be handled in a single place.
I need to be able to log and the...
Ok, so here's the situation.
I'm working on a site that allows people to upload things to a database that are then pulled to the frontpage so people can see them. It is a pretty straightforward site and I had it working real well but i was developing everything at ../html/backend for the sake of simplicity and to make sure nothing was s...
Hey!
I am populating this mysql table with data from a php (via post and using filter_input).
The database is utf8 but when I have a user that inputs words with ^,',',~ like Não I get this -> Não
What do I have to do to make it show the correct values. Or should I try to make some correction when I retrieve the data??
UPDATE:
I hav...
I have three strings:
$str1 = "abc";
$str2 = "def";
$str3 = "ghi";
I can get the value of all of them like this:
echo "$str1$str2$str3";
But I heard there is a way to join them together, so I can echo all of them without quotes.
...
I have the following code:
while ($row = mysql_fetch_array($result, MYSQL_NUM))
{
for ($i=0; $i<count($row); $i++)
{
(DO THING HERE)
$row[$i] = str_replace("\n", " ", $row[$i]);
$row[$i] = str_replace("\r", " ", $row[$i]);
}
}
I basically want to do, if the associative array key is equal to "email" (so $row...
Hi everybody,
here's my problem:
I want to check if a user insert a real name and surname by checking if they have only letters (of any alphabet) and ' or - in PHP.
I've found a solution here (but I don't remember the link) on how to check if a string has only letters:
preg_match('/^[\p{L} ]+$/u',$name)
but I'd like to admit ' and - t...
I wrote a PHP extension, and I'm trying to get it running on Mac's Apache server.
It runs fine via the command line, for example:
$ php -r 'dl("mylib.dylib");
I also tried building Apache from source, and it works perfectly when I run that (I set it up to use the same PHP as Mac's built-in Apache, too, so no difference there).
How...