I have built a small forum where users can post messages. My server is in the United States, but the userbase for the forum is in Taiwan (+15hrs).
When someone posts to the form, I store the time in my mySQL database in the format YYYY-MM-DD HH:MM:SS. When I look in the database, the time displays the proper time (the time that the pe...
I don't know if this is a problem yet but wanted to start thinking about it.
Question:
"Are PHP array indexes case sensitive"?
Example:
$a=array("a"=>"Dog","b"=>"Cat","c"=>"Horse","A"=>"Dog","B"=>"Cat","C"=>"Horse");
print_r($a);
Results:
Array ( [a] => Dog [b] => Cat [c] => Horse [A] => Dog [B] => Cat [C] => Horse )
I've run a ...
I have visitors coming to my site from 5 seperate sources, each one sends a variable in the url based on where its from, in the event these sources sends visitors I want to send them to a seperate page thats more relevant to the user
<?php
$var = $_GET["var"];
if( $var='site1')
{
header('Location: ' . "http://www.mysite.com/site1page"...
Say I have a products table that stores off the shelf products that are not customizable and have static pricing. I also have 1 product in this same table that is customizable and it's price and all sorts of characteristics vary based on the configuration. The final price for this customizable product is based on an equation, not a sum...
I am currently trying to write a little program to track time-off requests for employees. I'm fairly new to MYSQL and PHP, so it's a learning project for me as well. I've run into this problem which I do not seem to be able to figure out.
I want to display time off requests for a given week (Mon-Fri). I've got the requests in a table 'r...
I have UTF-8 string(from DB), and when i run:
echo rawurldecode('S = ( a + b ) * ( a + b ) : 4');
as result i see:
'S = ( a + b ) * ( a + b ) : 4'
I can't to get full access to this project. What can be wrong?
...
I have an array declared above the beginning of a for loop as: $array = array();
Now, in the for loop I start inserting values into it.
At some point I make one of its index as another array as $array[$j]=array();
And insert some values like, $array[$j][$l] = id; and so on.
Now, when I use print_r ($array) ; inside the loop I get the e...
I have a long string, and an array of country names. So the array looks something like this:
array('Afghanistan', 'Bulgaria', 'United States', 'Bulgaria', ...)
I need to count the number of times each country appears in the string.
Is there a quick and nifty way of doing this, i.e., some kind of magical preg_match_all which receives ...
I'm not sure if the php server side Facebook library validates sessions on load. So then I want to know if there is a best practice for insuring that I really do have a valid FB session and not some crackers altered $_COOKIE data.
$fb = new Facebook();
if( $fb->session_expires !== 0 && $fb->session_expires < time() ) {
die('bad and/or...
I have a small PHP script I wrote to help me push changes from staging to production. I run both staging and prod on the same server so my script copies changes from staging folders to prod folder.
This has been working fine until today when I had a few instances when files were only partially copied over resulting in some down time....
Hi, I just installed PHP on my computer (Ubuntu). If I create a test.php file with simple code and then run "php test.php", it works fine (I get what I expect). However, if I open this file (test.php) with my browser (Mozilla) it ask me how to open this file. Not a problem. I click "open with" and then I select "/usr/bin/php" and... noth...
I have a MySQL table with a column 'full_description' of type 'text'.
In that column is a standard lorem ipsum (plus the word END):
Lorem ipsum dolor sit amet,
consectetur adipisicing elit, sed do
eiusmod tempor incididunt ut labore et
dolore magna aliqua. Ut enim ad minim
veniam, quis nostrud exercitation
ullamco laboris n...
Hey all,
I recently set up a SQL logging framework with PEAR, and everything was working fine. However, I thought that the default length of the message field (VARCHAR 200) was a little short, so I changed my database structure in phpmyadmin to increase this to 512. However, I quickly realized that this changed completely stopped loggi...
I've been using the CodeIgniter framework, however after learning Java and awesome features like Interfaces, Abstract classes, packages, and that PHP 5 also supports most of these features, I'm ready to graduate and build a real OO framework in PHP which uses all of these features (including namespaces), so I can build much more elegant ...
Hi, I just installed apache server on my local machine. I executed the following command for that:
sudo apt-get install apache2
sudo apt-get install php5
sudo apt-get install libapache2-mod-php5
sudo /etc/init.d/apache2 restart
However, if I put my test.php file in /var/www and open it with my browser I see nothing (I supposed to see ...
I am running GNU Emacs 22.2.1 on a HP notebook running Ubuntu 9.04 with the latest patches.
Recently, I need to handle some PHP codes, so I added Ubuntu's php-mode package, thinking what I have in my .emacs would cover the basics. Well, almost. The following short snippet shows the symptom:
<?php
# main()
/*
*
*
*/
{
$fpath="...
Hi,
I have a mysql table containing messages:
id (INT)
sender_id (INT)
recipient_id (INT)
sent_time (INT)
read_time (INT)
body (TEXT)
I need to retrieve a list of most recent messages user X received from or sent to other (distinct) users.
In other words I'd like to create a full list of conversations with other users, sorted by sen...
Hi All,
I have a small problem with some late additions to a project, mysql and PHP.
We have a table in mysql with 200,000 rows, each with an assigned category. Originally the select statement would just pull out the required items based on a where clause and order by an indexed id. Very quick.
However we had some users request the ab...
hi guys,
This is my first time here so go easy with me. I am keen on mastering codeignter and jquery for web app dev. I have made progress but I am at a point I was hoping I would pick on your great minds over.
I have links where I click and they fill up a div with content and this works but I use the $.ajax({}); not get or post or loa...
For example, is it possible to write code like this:
int $x = 6;
str $y = "hello world";
bool $z = false;
MyObject $foo = new MyObject();
And is it possible to define functions like this:
public int function getBalance()
{
return 555; //Or any numeric value
}
...