-
Posts
837 -
Joined
-
Last visited
Everything posted by samshel
-
Hi unsider, You can use static URLs with URL rewrite/.htaccess combination. This helps in improving SEO. please google around for more info.
-
<?php $dtBirthDate = "1978-09-13"; $dtToday = date("Y-m-d"); //Calculate difference in seconds $intDiffSec = strtotime($dtToday) - strtotime($dtBirthDate); //Calculate no of days $intDays = $intDiffSec / (60*60*24); $intYearsAge = (int) ($intDays / 365); $intDaysAge = $intDays - ($intYearsAge * 365); echo "Age is : ".$intYearsAge. " Years and ".$intDaysAge." Days" ; ?> something like this should also work...not tested. PS: Leap years are not considered...
-
you should always start by searching in the manual http://in.php.net/manual/en/book.ftp.php hope you are looking for the same.
-
Yes it will add 2 june together, and yes there is a way to display total for each month, try following code. $sql = "SELECT sum( mcgross ) AS `total`,EXTRACT(MONTH FROM FROM_UNIXTIME(`payment_date`)) as month, EXTRACT(YEAR FROM FROM_UNIXTIME(`payment_date`)) as year FROM `payments`GROUP BY EXTRACT(MONTH FROM FROM_UNIXTIME(`payment_date`)), EXTRACT(YEAR FROM FROM_UNIXTIME(`payment_date`)) "; $rs_result = mysql_query ($sql); while ($row = mysql_fetch_assoc($rs_result)) echo "Month-".$row['month']."-".$row['year']." Total: ".$row['total']."; again, code is not tested so might have some small issues.
-
Try this, not tested so may have some issues. $intMonth = 6;//June $sql = "SELECT sum( mcgross ) AS `total` FROM `payments`WHERE EXTRACT(MONTH FROM FROM_UNIXTIME(`payment_date`)) = '$intMonth'"; $rs_result = mysql_query ($sql); while ($row = mysql_fetch_assoc($rs_result)) echo "Total: ".$row['total'].";
-
try rawurlencode();
-
The code pasted above works for me, Make sure "images" directory also has 775 permissions.
-
Generally header errors are caused when you print something before redirecting. Check if you have printed/echoed something purposely or by mistake. Even a space or a newline at the end of included file after ?> tag can cause problems.
-
do you want to retain the old indexes ? $arr = array(6=>"one", 5=>"two", 0=>"three", 2=>"four"); $arrOne = array(0=>"three", 2=>"four", 5=>"two", 6=>"one"); $arrTwo = array(0=>"one", 1=>"two", 2=>"three", 3=>"four"); do you want $arrOne or $arrTwo ?
-
[SOLVED] Mysql_error Cant figure out why its doing it GRR
samshel replied to Dethman's topic in PHP Coding Help
you code has a back tick before f. Ace code has a single quote. -
[SOLVED] Mysql_error Cant figure out why its doing it GRR
samshel replied to Dethman's topic in PHP Coding Help
`defTroops` = `defTroops +'$sdef', Looks like you have missed one back tick after defTroops. It should be `defTroops` = `defTroops` +'$sdef', -
Hi All, Does anybody have idea about implementing "Did you mean ?" functionality like Google in PHP/MySQL? Let me explain in detail. I have a table containing search words. If a person types a wrong spelling by mistake and submits, the page should look for spellings who are closely matching with the entered word in the search word table and show the alternatives as "Did you mean" ? Example: Person enter "Amsterdm" No Results Found. Did you mean "Amsterdam" ? Thanks
-
Call/query a URL and getting the response without redirecting to it?
samshel replied to peet1909's topic in PHP Coding Help
Hi vbnullchar , He needs to call a file from some other domain/server and as far as i know. cross domain AJAX calls do not work.. It will give you security error. -
Call/query a URL and getting the response without redirecting to it?
samshel replied to peet1909's topic in PHP Coding Help
Try using CURL http://php.net/manual/en/book.curl.php -
UPDATE subitem1 SET totalstock = totalstock + $amount; Will update all rows and add amount to all totalstocks. no need of loops.
-
not tested , but something like this... $intPagesShown = 10; if ($pageNum > 1) { $page = $pageNum - 1; $prev = " <a href=\"$self?page=$page\"><img src='Images/Prev.jpg' border='0' />[/url] "; $firstnum = $pageNum - $intPagesShown /2; if($firstnum < 1) $firstnum = 1; $first = " <a href=\"$self?page=".$firstnum."\"><img src='Images/First.jpg' border='0' />[/url] "; } else { $firstnum = 1; $prev = ' '; // we're on page one, don't print previous link $first = ' '; // nor the first page link } if ($pageNum < $maxPage) { $page = $pageNum + 1; $next = " <a href=\"$self?page=$page\"><img src='Images/Next.jpg' border='0' />[/url] "; $lastnum = $firstnum + $intPagesShown - 1; if($lastnum > $maxPage) $lastnum = $maxPage; $last = " <a href=\"$self?page=$lastnum\"><img src='Images/Last.jpg' border='0' />[/url] "; } else { $next = ' '; // we're on the last page, don't print next link $last = ' '; // nor the last page link } // print the navigation link echo "<table width='500' border='0' cellspacing='0' cellpadding='0'><tr><td width='100' height='50'>" . $first . "</td><td width='75' height='50'>" . $prev . "</td><td width='150' height='50'>" . $nav . "</td><td width='75' height='50'>" . $next . "</td><td width='100' height='50'>" . $last . "</td></tr></table> "; } }
-
if(strlenCheck($email, $password) == 1 || strlenCheck($email, $password) == 2){ header("Location: /index.php?LoginError=Required"); }
-
$arrNumeric = array_values($arrAssociative);
-
Putting all this code in a file and opening i see only 2 rows, so it wont show a scroll bar.sorry if i am getting it wrong.
-
I put the above code in a blank file , added many rows to it, and opened it in browser. it does show a scroll bar.
-
Please paste view source of the page you see in browser, i.e. only the HTML
-
<?php $browser = $_SERVER['HTTP_USER_AGENT']; if(ereg("MSIE", $browser)) { echo "Internet Explorer"; } if(ereg("Firefox", $browser)) { echo "Firefox"; } ?>
-
Try this, and check if this is what you need $arrString = array(); if(!is_null($relevanta)) $arrString[] = $relevanta; if(!is_null($relevantb)) $arrString[] = $relevantb; if(!is_null($relevantc)) $arrString[] = $relevantc; if(!is_null($relevantd)) $arrString[] = $relevantd; if(!is_null($relevante)) $arrString[] = $relevante; if(!is_null($relevantf)) $arrString[] = $relevantf; $srt_string = implode(",", $arrString);
-
try using $_SERVER["HTTP_USER_AGENT"]
-
Try this $query1 = stripslashes($_POST['query']); $query0 = str_replace('{$table}',$forumname,$query1); $result = mysql_query($query0); echo mysql_error();