Forum: PHP 28 Days Ago |
| Replies: 12 Views: 529 I've always just assumed those region specific URIs directed you to a cache server closer to you. The cache server concept would remain the same, tho. They wouldn't actually be attached to a separate... |
Forum: PHP 28 Days Ago |
| Replies: 3 Views: 407 It should be, yes. You can define functions and classes withing an if block if you need to.
Doing something like this is pretty common:
<?php
if(!function_exists('myFoo')) {
function... |
Forum: PHP 28 Days Ago |
| Replies: 12 Views: 529 Agree, this is an excellent point. Especially if you have a lot of variable-length columns. They slow queries down more than most people realize.
It's best to identify the columns you don't need... |
Forum: PHP 29 Days Ago |
| Replies: 12 Views: 529 Indeed, there are :)
I suggest you go with the method I mentioned in my first post; creating a 'page' table, in which you add a row for each new page.
I don't doubt that. I am in no way... |
Forum: PHP 29 Days Ago |
| Replies: 12 Views: 529 Yes, for typical websites that is true.
However, I am talking about websites like Facebook and WordPress, who get more hits per day than all of our websites combined are likely to get in our... |
Forum: PHP 29 Days Ago |
| Replies: 12 Views: 529 Hey.
In a properly designed CMS, changing anything just INSERTs, UPDATEs or DELETEs stuff from the database. If it is actually creating tables, or otherwise changing the database structure, there... |
Forum: PHP 29 Days Ago |
| Replies: 4 Views: 288 Hey.
The fact that the file ends in .php means absolutely nothing to a RSS feed reader. (Or rather; a RSS reader worth using.)
As far as they are concerned, if it acts like a XML file (uses a XML... |
Forum: PHP 30 Days Ago |
| Replies: 14 Views: 687 Just to underline how much easier it is to work with libraries like Prototype and jQuery, this is how ardav's "doForm1" function would have looked like in native JavaScript:
function doForm1(){
... |
Forum: PHP 31 Days Ago |
| Replies: 14 Views: 687 True, that might be a problem. Although I have never really found to much data to be a problem :)
It could even help you refine your process; being able to see if a lot of people are abandoning it... |
Forum: PHP 31 Days Ago |
| Replies: 14 Views: 687 Hey.
You could use sessions to store the data from the first part of the form until the second one is submitted.
Or you could insert the data from the first page into the database as soon as it... |
Forum: PHP 32 Days Ago |
| Replies: 4 Views: 485 Ahh yea, sorry. I should have explained that a little better.
You can use the <input> elements just like you would a normal variable within PHP, and once it is submitted, it will appear as an... |
Forum: PHP Nov 17th, 2009 |
| Replies: 14 Views: 521 So it is displaying the data as if it were still yesterday?
Where is your SQL server hosted? In your timezone?
I ask because I have test server hosed on a timezone 6 hours later than where I... |
Forum: PHP Nov 17th, 2009 |
| Replies: 14 Views: 521 Try moving the AND clause into the LEFT JOIN.
Like:
SELECT
j.jobs_id,
j.jobs_description,
d.jobs_done_id,
d.jobs_timedone,
d.jobs_comment,
d.jobs_user |
Forum: PHP Nov 17th, 2009 |
| Replies: 14 Views: 521 Ok, I see.
Edit... didn't see that last post. Give me a sec. |
Forum: PHP Nov 17th, 2009 |
| Replies: 14 Views: 521 If you only want the jobs done today, you need to add that to the SQL query.
SELECT
j.jobs_id,
j.jobs_description,
d.jobs_done_id,
d.jobs_timedone,
d.jobs_comment,
... |
Forum: PHP Nov 16th, 2009 |
| Replies: 4 Views: 485 Hey.
You can set use the name attribute of an <input> just as you would an array inside PHP. So you can do stuff like:
<?php
$result = mysql_query("SELECT id, name FROM users");
echo '<form... |
Forum: PHP Nov 16th, 2009 |
| Replies: 14 Views: 521 Hey.
A single LEFT JOIN should be able to do that.
Consider this:
<?php
// Open a database connection
$dbLink = new mysqli('host', 'usr', 'pwd', 'dbName');
if(mysqli_connect_errno()) { |
Forum: PHP Nov 14th, 2009 |
| Replies: 5 Views: 627 Your welcome.
I'm glad I could help :) |
Forum: PHP Nov 13th, 2009 |
| Replies: 2 Views: 556 Hey.
It is generally better to use MySQL's DATE and TIME types (http://dev.mysql.com/doc/refman/5.1/en/date-and-time-types.html) to store date or time. Easier to work with it that way.
... |
Forum: PHP Nov 13th, 2009 |
| Replies: 5 Views: 627 That's a bit tougher, because it's very hard to keep accurate track of your users, short of requiring that people register and log in before voting.
A popular method is to record the user's IP... |
Forum: PHP Nov 13th, 2009 |
| Replies: 5 Views: 627 Hey.
Do you have some sort of a database? Like MySQL?
If not, you could use a CSV file to store the data.
For example, I wrote this a while back. Does pretty much what you were talking about:... |
Forum: PHP Nov 11th, 2009 |
| Replies: 7 Views: 400 Hey.
Perhaps your server has the magic_quotes (http://php.net/magic_quotes) feature enabled?
If you don't know, create a PHP file that contains only: <?php phpinfo(); ?> and look for... |
Forum: PHP Nov 10th, 2009 |
| Replies: 14 Views: 576 IDs of elements don't work like the names of input elements. If you have two elements with the same ID, only one of them will be used by JavaScript. (The last one, I believe.)
So you need to... |
Forum: PHP Nov 10th, 2009 |
| Replies: 14 Views: 576 Good point.
if(substr_count(trim($input, ','), ',') == 2) {
echo "Valid!;"
}
@muralikalpana
I'm glad you found a solution. |
Forum: PHP Nov 9th, 2009 |
| Replies: 14 Views: 576 Hey.
You could also use the substr_count (http://php.net/substr_count) function.
if(substr_count($input, ',') == 2) {
echo "Valid!;"
} |
Forum: PHP Nov 9th, 2009 |
| Replies: 15 Views: 646 Sure. You can just swap out the column name for an alias.
Like:
// A list of column names and their aliases.
$aliases = array(
# 'column_name' => 'alias',
'local_id' => 'ID',
... |
Forum: PHP Nov 9th, 2009 |
| Replies: 15 Views: 646 Those errors are shown when you use the header functions after adding to the output stream.
In other words; you can not use the header functions after printing anything from PHP, or from inside a... |
Forum: PHP Nov 7th, 2009 |
| Replies: 15 Views: 646 Consider this code.
It has a form where a user enters the start and end date, and the PHP code compiles a XML file with all the data from a table that were created in that time-frame.
I created... |
Forum: PHP Nov 7th, 2009 |
| Replies: 15 Views: 646 Also, forgot to mention.
If you would rather send the file to the user, to allow him to download it, you can do this instead of the file_put_contents.
header('content-type: text/xml');... |
Forum: PHP Nov 7th, 2009 |
| Replies: 15 Views: 646 Ok, I see.
You can have PHP create whatever output you want out of that.
For example, to create a XML file and save it on the server, you can do:
// <snipped the DB code>
$output = '<?xml... |
Forum: PHP Nov 7th, 2009 |
| Replies: 15 Views: 646 Hey.
What data are you looking to export?
Fetching data from a form and writing it to a file is fairly simple. We just have no idea what sort of data you are using, and without knowing that we... |
Forum: PHP Nov 5th, 2009 |
| Replies: 10 Views: 346 Sure. Try this one (http://www.regular-expressions.info/tutorial.html). It's what I used when I was first starting out with regular expressions.
And you can check out the details on how PHP uses... |
Forum: PHP Nov 5th, 2009 |
| Replies: 7 Views: 721 The $_POST array represents the data sent via a HTML <form>, using the POST method. So the data in $_POST['ta'] is just the data in whatever form element was named "ta".
The if statement checks to... |
Forum: PHP Nov 4th, 2009 |
| Replies: 2 Views: 415 Hey.
When you create an array of <input> elements, you can specify the ID that is supposed to be used for that specific element.
For example:
<?php
echo "<form action='process.php'... |
Forum: PHP Nov 4th, 2009 |
| Replies: 7 Views: 721 Ahh ok.
Is the MySQL table created to use UTF-8?
If you are not sure, try using the SHOW CREATE TABLE command. It should provide a DEFAULT CHARSET clause or two.
And how do you insert the data... |
Forum: PHP Nov 4th, 2009 |
| Replies: 7 Views: 721 Well, I don't know what they are on about there, but I have never come across a situation where I explicitly needed to specify a charset when sending a query, and I use UTF-8 exclusively in my PHP... |
Forum: PHP Nov 4th, 2009 |
| Replies: 7 Views: 721 Hey.
Do you set the charset for the resulting page?
By default, most browsers use the ISO charset, so if you plan on printing Unicode characters into it, you must specify that in the request.... |
Forum: PHP Nov 4th, 2009 |
| Replies: 4 Views: 249 As an afterthought...
The mail function does allow for multiple recipients for one call.
If you pass something like User1 <user1@example.com>, User2 <user2@example.com> as the first parameter,... |
Forum: PHP Nov 4th, 2009 |
| Replies: 4 Views: 249 Hey.
You should check out PHPMailer (http://phpmailer.worxware.com/) or Swift Mailer (http://swiftmailer.org/).
Both are much easier to deal with than the PHP mail function, and both allow for... |
Forum: PHP Nov 4th, 2009 |
| Replies: 10 Views: 346 Yes, sorry about that second post. When I posted my first post it got posted twice because of a bug in the forum. (I assume)
It has been removed now.
But OK, as form validation is a rather... |