Hello,
I'm writing a store system for my game,
it worked quite well until I found out that it only takes the amount of first entered Item.
function pbuy(buyitem) {
var amountc = "amount-"+buyitem,
var amount = $("#"+amountc+"").val();
$.ajax({
type: "POST",
url: "store2.php",
data: "buyitem="+ buyitem+"&amount="+amoun...
Can anyone tell me why the timestamp generated by the php time() function is so different from SQL datetime?
If i do a date('Y-m-d', time()); in php, it gives me the time now, as it should. If I just take the time() portion and do:
$now = time();
//then execute this statement 'SELECT * FROM `reservation` WHERE created_at < $now'
I ge...
Hello,
I wrote the following php snippet to fetch the currency conversion rate from Yahoo Finance.Im using curl to fetch the data.
Suppose, i want to convert from US dollars (USD) to Indian National Rupee (INR),then the url is http://in.finance.yahoo.com/currency/convert?amt=1&from=USD&to=INR&submit= and the Indian Rupee val...
I have a php script that has the following requirement command: require_once 'HTTP/OAuth.php'; the file HTTP/OAuth.php is in php's include_path that is .:/usr/lib/php.
Nevertheless in Eclipse the require_once line is marked with the following warning: Include filename: 'HTTP/OAuth.php' doesn't exist in project:
How can I make my proje...
Hi,
is it possible to use date_sub like this ?
$dt = date("Y-m-d h:i:s");
$query = "INSERT INTO `table` (`date`) VALUES ('DATE_SUB('$dt', INTERVAL 15 DAY)')";
$result = MYSQL_QUERY($query);
Thanks
...
I've the following function:
function Cache($key, $value = null, $ttl = 60)
{
if (isset($value) === true)
{
apc_store($key, $value, intval($ttl));
}
return apc_fetch($key);
}
And I'm testing it using the following code:
Cache('ktime', time(), 3); // Store
sleep(1);
var_dump(Cache('ktime') . '-' . time()); ec...
I have a small form is to be filled in.
If the user is logged in, the form is submitted as normal. If the user is not logged in, I show an overlayer with an iframe'd page that contains a login box where he enters his credentials. If the credentials are correct I can "break out" of the frame to "return" to the main page, but how can I up...
I have a PHP-based web app that I'm trying to apply Apache's mod_rewrite to.
Original URLs are of the form:
http://example.com/index.php?page=home&x=5
And I'd like to transform these into:
http://example.com/home?x=5
Note that while rewriting the page name, I'm also effectively "moving" the question mark. When I try to do thi...
The user clicks the URL that is generated via the code below.
$url = 'https://graph.facebook.com/oauth/authorize?' .
http_build_query(array('client_id' => FACEBOOK_APP_ID,
'redirect_uri' => 'http://fb.example.com/facebook',
'scope' => 'publish_stream,email,offline_access,user_...
I am operating on a (not so) large graph having about 380K edges. I wrote a program to count the number of 3-cliques in the graph. A quick example:
List of edges:
A - B
B - C
C - A
C - D
List of cliques:
A - B - C
MySQL Table structure:
+-------+------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default...
I have two tables registries and names. Consequently, I have two model classes. I'm coding a method in registries model and I need to fetch all names in the names table/model. How'd I do it?
Should a simple new Names() work? But, is it recommended?
...
I wanted to start using the Amazon Simple Notification Service (http://aws.amazon.com/sns/), but I have not found any PHP libraries that I can use to access the service. I would rather not create my own library, I wanted to see if anybody has used any PHP libraries for the SNS service, and if they would recommend any.
...
I've recently started logging my errors through codeIgniter. Since doing so, I have noticed a lot of 404 errors for directories that don't exist. For example:
ERROR - 2010-05-15 21:06:26 --> 404 Page Not Found --> someController/images
Where someController is, obviously, a controller. The problem is, there are no functions within that ...
I'm trying to extract the postal codes from yell.com using php and preg_replace.
I successfully extracted the postal code but only along with the address. Here is an example
$URL = "http://www.yell.com/ucs/UcsSearchAction.do?scrambleSeed=17824062&keywords=shop&layout=&companyName=&location=London&searchType=advance&broaderLocation=&...
Hi all
I am trying to build a PHP class to check the username and password in MySql.
I am getting "mysql_query(): supplied argument is not a valid MySQL-Link resource in D:\2010Portfolio\football\main.php on line 38" database has errors:" message.
When I move my userQuery code out of my Class, it works fine. Only if it is inside my C...
Function call:
$trdata .= $this->table_td($tddata, 1, $td);
Function:
public function table_td($data = '', $parameters = array()){
return($this->table_thtd($data, 0, $parameters));
}
A print_r before the return shows a 1, instead of the data array I'm passing. Any thoughts on what's going on?
...
Hi,
I've got dates being generated which look lke these:
Sun May 16 23:59:59 GMT 2011
I want to convert them into storable MYSQL form and so that i can read/compare them via php. I am using php. How can i convert the above into something MYSQL will understand?
...
This is a trick question, while developing a php+ajax application i felt into some long queries, nothing wrong with them, but they could be done in background.
I know that there's a way to just send a reply to user while throwing the real processing to another process by exec(), however it dosen't feels right for me, this might generate...
Well,
It's a beginner's question but I really don't know what is the best way.
I have a basic CRUD (Create, Retrieve, Update and Delete) in my project and I'd like to output some message if succeeded or not in a div inside the same page.
So, basically, I have a form which action is set to the same page and I have a div #statusDiv below...
I want to post a search value from index.php to search.php,
index.php
<form action="search.php?val=" method="post">
and search.php
<?php echo $_GET['val']?>
or
<?php echo $_POST['val']?>
I would like to retain 'val' value in the URL, but search.php could not capture the value of 'val' which appear to be "val=".
...