My form works in firefox but not ie. I've tried using a hidden text field (fail)... I tried using an image instead of a submit button (fail)... are there any other solutions?
I am trying to create a simple inventory request system. A user can enter multiple SKU's that will query the inventory database.
My problem is I am trying to do is associate these multiple queries into a type of list. This list can later be retrieved and contains all queries that were submitted simultaneously. When the list is filled it can then be deleted.
Is this possible? I am just looking to be pointed in the right direction.
Thanks
Hello in my database date / time are stored in this format
2010-06-01T18:20:25+0000
I'd like to echo that out to time passed since that date / time
e.g.
2 minutes ago or 2 days ago
is this possible?
Hello
i need to refresh combo box (sub category ) related to what i choose in main category combo box , for example if i choose "chicken" in main category , the value of sub category will be "grilled chicken" , " fried chicken " ? how should i do this ?
<select name="categorylist" id="categorylist">
<?
$sql_query= mysql_query("select category_id,category_name, from categories");
while($fetch= mysql_fetch_array($sql_query))
{ ?>
<option value= " <? echo "$fetch[category_id];" ?> " selected="selected"><? echo "$fetch[category_name]"; ?> </option>
<?
}
?>
what should i put in subcategory ?
Every time I start apache , it always fails.
The problem is in loadmodulephp5...
The error log:[warn] pid file C:/windows/Apache2/logs/httpd.pid overwritten — Unclean shutdown of previous Apache run?
I tried to delete this file and then start apache.But this file had been created again.
Any solution?
Hi,
I'm basically trying to convert a Unix timestamp (the time() function) to a relative date/time that's both compatible with past and future date. So outputs could be:
2 weeks ago
1 hour and 60 minutes ago
15 minutes and 54 seconds ago
after 10 minutes and 15 seconds
First I tried to code this, but made a huge unmaintainable function, and then I searched the internet for a couple of hours, yet all I can find are scripts that produce only one part of the time (e.h: "1 hour ago" without the minutes).
Do you have a script that already does this? If so, I'd really appreciate if you could share it.
Thanks.
I am setting up dynamic forum signature images for my users and I want to be able to put their username on the image. I am able to do this just fine, but since usernames are different lengths and I want to right align the username, how can I go about doing this when I have to set x & y coordinates.
$im = imagecreatefromjpeg("/path/to/base/image.jpg");
$text = "Username";
$font = "Font.ttf";
$black = imagecolorallocate($im, 0, 0, 0);
imagettftext($im, 10, 0, 217, 15, $black, $font, $text);
imagejpeg($im, null, 90);
Hello,
I'm hoping somebody knows the answer :).
Within wordpress in the users section I would like to add a new row which will data pulled in from the Register Plus plugin.
Where would I need to create a new row?
My Example:
Username Name E-mail Role **Website** Posts
Admin Admin [email protected] Administrator google.com 2
Thanks.
Is it more efficient to use the key intersect or the value intersect if both key and value have the same contents for example:
Array
(
[743] => 743
[744] => 744
[745] => 745
[746] => 746
[747] => 747
[748] => 748
)
Is there any difference in performance in using one or the other with the same values. Similar to the difference of using double or single quotes?
This is the var_dump:
object(stdClass)#27 (8) {
["SETTING_ID"]=> string(2) "25"
["SETTING_SOURCE"]=> string(2) "XV"
["SETTING_FLEET"]=> string(3) "313"
["SETTING_EXAM"]=> string(1) "A"
["SETTING_HIDE"]=> string(1) "0"
["SETTING_THRESHOLD"]=> string(1) "0"
["SETTING_COUNT"]=> string(8) "POSITIVE"
["SETTING_USAGE"]=> string(7) "MILEAGE"
}
The variable I am testing is SETTING_HIDE. This is being pulled from MySQL using the Code igniter framework. I don't know if it is just me being thick after a rather long day at work or what, but no matter what value the variable holds, any if statement made against it returns true, even when typecast as a boolean or a direct string comparison, ie. == "0" or == "1".
Anyone with a fresh pair of eyes care to make me feel silly!?! :)
Just to clarify:
Have tried the following:
if($examSetting->SETTING_HIDE == "1") { $showOnABC = "checked=\"checked\""; }
if((bool)$examSetting->SETTING_HIDE) { $showOnABC = "checked=\"checked\""; }
if($examSetting->SETTING_COUNT == "POSITIVE") further on in my code works perfectly.
I am using this to get real IP but i take empty from $_SERVER['HTTP_CLIENT_IP'],i take not empty only from $_SERVER['REMOTE_ADDR'].But i dont need the IP of proxy,i need the real ip of computers using some intranet.Can i get it?when $_SERVER['HTTP_CLIENT_IP'] does not return empty?
function getRealIpAddr()
{
if (!empty($_SERVER['HTTP_CLIENT_IP'])) //check ip from share internet
{
$ip=$_SERVER['HTTP_CLIENT_IP'];
}
elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) //to check ip is pass from proxy
{
$ip=$_SERVER['HTTP_X_FORWARDED_FOR'];
}
else
{
$ip=$_SERVER['REMOTE_ADDR'];
}
return $ip;
}
I have zlib and Zend Optimizer enabled on my server.
I have read about the
zlib.output_compression
directive. Are there any caveats with turning this directive on in my server?
Using PHP5 and the latest version of MySQL I want to be able to track impressions and clicks for business listings. My question is if I did this myself what would be the best method in storing it so I can run reports? Before I just had a table that had the listing id, user ip address and if it was a click or impression as well as the date it was tracked. However the database itself is approaching 2GB of data and its very slow, part of the problem is its a pretty simple script that includes impressions and clicks from anyone including search engines and basically anyone or anything that accesses the listing page.
Is there an api or file out there that has an update to date list that can detect if the person viewing is a actually person and not a spider so I dont fill up the database with unneeded stats? Just looking for suggestions, do I just have a raw database that gets just the hits then a cron job at night tally up for the day for each listing for each ip and store the cumulative stats in a different table?
Also what type of database should it be? Innodb? MyISAM?
Hello,
I want to loop the update statement, but it only loops once.
Here is the code I am using:
do {
mysql_select_db($database_ll, $ll);
$query_query= "update table set ex='$71[1]' where field='val'";
$query = mysql_query($query_query, $ll) or die(mysql_error());
$row_domain_all = mysql_fetch_assoc($query);
} while ($row_query = mysql_fetch_assoc($query));
Thanks
Jean
Hello,
I have a news site containing an archive with more than 1 million news.
I created a word definitions database with about 3000 entries, consisting of word-definition pairs.
What I want to do is adding a definition next to every occurence of these words in the news.
I cant make a static change as I can add a new keyword everyday, so i can make it realtime or cached.
The question is, a str_replace or a preg_replace would be very slow for searching 3 thousand keywords in a text and replacing them.
Are there any fast alternatives?
Hello!
I'd like to get the main image for an article, much like Facebook does when you post a link (but without the choosing image part). The data we have to work with is the whole pages HTML as a variable. The page & URL will be different for every time this function runs.
Are there any libraries or classes that are particularly good at getting the main body of content, much like Instapaper that would be of any help?
The following code displays the ordered products individual weight:
$weightsql = 'select op.products_name, op.products_quantity , p.products_weight from ' . TABLE_ORDERS_PRODUCTS . ' op left join ' . TABLE_PRODUCTS . ' p on op.products_id = p.products_id where op.products_id = '.$pro['products_id'];
$weightq = tep_db_query( $weightsql );
while ($weight = tep_db_fetch_array( $weightq )){
if($category_parent_id != 0)$list_items[] = $weight['products_weight'].' ';
}
This shows the wieght for each of the products ordered. What I am stuck on is instead of showing seperate weights, I need to show a total weight. For example, if the product was ordered three times, and it weighs 7kg, the code at the moment is showing:
Product 7.00 7.00 7.00
How would I make it show the total weight, 21kg?
Fatal error:
Call to undefined function mb_substr()
after moving to my dedicated server (hypervm CP) , i got lots of errors .
it would be grateful ,if you know how to solve this problem
thanks in advance
I need to create a valid xml from a given array();
My Method looks like this,
protected function array2Xml($array)
{
$xml = "";
if(is_array($array))
{
foreach($array as $key=>$value)
{
$xml .= "<$key>";
if(is_array($value))
{
$xml .= $this->array2Xml($value);
}
$xml .= "</$key>";
}
return $xml;
}
else
{
throw new Exception("in valid");
}
}
protected function createValidXMLfromArray($array,$node)
{
$xml = '<?xml version="1.0" encoding="ISO-8859-1"?>';
$xmlArray = $this->array2Xml($array);
$xml .= "<$node>$xmlArray</$node>";
return $xml;
}
if i execute the above i just get keys with empty values;
like
<node>
<name></name>
</node>
What i need is if i pass this array("name"=>"test","value"=>array("test1"=>33,"test2"=>40));
that it return this
<node>
<name>test</name>
<value>
<test1>33</test1>
<test2>40</test2>
</value>
</node>
Where is the error what did i wrong in the above recursion?
I'm writing a little homebrew ORM (academic interest). I'm trying to adhere to the TDD concept as a training exercise, and as part of that exercise I'm writing documentation for the API as I develop the class.
Case in point - I'm working on a classic "getCollection" type mapper class. I want it to be able to retrieve collections of asset X (let's say blog posts) for a specific user, and also collections based on an arbitrary array of numeric values. So - you might have a method like any one of these
$User = $UserMapper->load(1);
$ArticleCollection = $ArticleMapper->getCollection(range(10,20));
$ArticleCollection = $ArticleMapper->getCollection($User);
$ArticleCollection = $ArticleMapper->getCollection($User->getId());
So, in writing the documentation for the getCollection method - I want to declare the @param variable in the Docblock. Is it better to have a unique method for each argument type, or is it acceptable to have a method that delegates to the correct internal method/class based on argument type?
Hi all,
I have a report page that deals with ~700k records from a database table. I can display this on a webpage using paging to break up the results. However, my export to PDF/CSV functions rely on processing the entire data set at once and I'm hitting my 256MB memory limit at around 250k rows.
I don't feel comfortable increasing the memory limit and I haven't got the ability to use MySQL's save into outfile to just serve a pre-generated CSV. However, I can't really see a way of serving up large data sets with Drupal using something like:
$form = array();
$table_headers = array();
$table_rows = array();
$data = db_query("a query to get the whole dataset");
while ($row = db_fetch_object($data)) {
$table_rows[] = $row->some attribute;
}
$form['report'] = array('#value' => theme('table', $table_headers, $table_rows);
return $form;
Is there a way of getting around what is essentially appending to a giant array of arrays? At the moment I don't see how I can offer any meaningful report pages with Drupal due to this.
Thanks