-
Posts
837 -
Joined
-
Last visited
Everything posted by samshel
-
what do u want to do ? if page is not register.php and alarmes.php u want to allow ? if ($_SERVER['PHP_SELF'] != "/alarmes.php" && $_SERVER['PHP_SELF'] != "/register.php") { } else { echo ""; } OR generally got with == for != AND should be used. not necessary but thumb rule
-
imagecopymerge(); will merge ur images.. to get samples in the first place u will have to use imagecopyresampled().
-
check if this is what u r looking for : imagecopyresampled()
-
if ($_SERVER['PHP_SELF'] != "/alarmes.php" || $_SERVER['PHP_SELF'] != "/register.php") { } else { echo ""; }
-
Need to tweak the code! Please help now! php mysql, thanks in advance
samshel replied to atrocious's topic in PHP Coding Help
yes u can store it as bool and add the value of checkbox and field name in the same insert query. -
instead of "outputting" something in PHP CLI files, you can directly write to the file you want using simple file functions.
-
Need to tweak the code! Please help now! php mysql, thanks in advance
samshel replied to atrocious's topic in PHP Coding Help
echo out ur query... $sql="INSERT INTO application (IGN, Rank, Age, Kdr, Whyjoin, Preclan, Hack, Email, Mapmode, Reco, Refer, Agree) VALUES ('$_POST[id]','$_POST[Rank]','$_POST[Age]','$_POST[Kdr]','$_POST[Whyjoin]','$_POST[Preclan]','$_POST[Hack]','$_POST[Email]','$_POST[Mapmode]','$_POST[Reco]','$_POST[Refer]','$_POST[Agree]')"; echo $sql; $res = mysql_query($sql,$con) or die(mysql_error()); if(mysql_insert_id($res)) { echo "Thank You !!"; } else { echo "Insertion Failed !!"; } -
[SOLVED] Find Number of Saturdays Between Two Dates
samshel replied to hoopplaya4's topic in PHP Coding Help
<?php $dt1 = "2009-02-26"; $dt2 = "2009-03-26"; $tm1 = strtotime($dt1); $tm2 = strtotime($dt2); $dt = Array (); for($i=$tm1; $i<=$tm2;$i=$i+86400) { if(date("w",$i) == 6) { $dt[] = date("l Y-m-d ", $i); } } echo "Found ".count($dt). " Saturdays...<br>"; for($i=0;$i<count($dt);$i++) { echo $dt[$i]."<br>"; } ?> -
Need to tweak the code! Please help now! php mysql, thanks in advance
samshel replied to atrocious's topic in PHP Coding Help
<?php $con = mysql_connect ( "myhost" , "databasename" , "pass" ) or die(mysql_error()); mysql_select_db( "databasename" ) or die(mysql_error()); not sure but u can try this...the code is breaking just before mysql_error()... -
Need to tweak the code! Please help now! php mysql, thanks in advance
samshel replied to atrocious's topic in PHP Coding Help
post ur whole code, u might be missing a semicolon or closing bracket somewhere. it generally never shows PHP code in the error. -
Parse errors show line number where the problem is.. so u can easily pinpoint the problem.
-
Need to tweak the code! Please help now! php mysql, thanks in advance
samshel replied to atrocious's topic in PHP Coding Help
what is the error? -
using sessions is safe...u can also try if(!isset($_SESSION['login_username']) || trim($_SESSION['login_username']) == "")
-
Need to tweak the code! Please help now! php mysql, thanks in advance
samshel replied to atrocious's topic in PHP Coding Help
always put ur code in between [ code ] [ / code ] tags. remove space in the tags..it makes the code readable. -
Need to tweak the code! Please help now! php mysql, thanks in advance
samshel replied to atrocious's topic in PHP Coding Help
1) does your table have field called Rank ? [check case too, i m not sure if it causes problems] 2) use back ticks to mark fields in query, to avoid problems with key words. $sql="INSERT INTO application (`IGN`, `Rank`, `Age`, `Kdr`, `Whyjoin`, `Preclan`, `Hack`, `Email`, `Mapmode`, `Reco`, `Refer`, `Agree`) VALUES ('$_POST[id]','$_POST[Rank]','$_POST[Age]','$_POST[Kdr]','$_POST[Whyjoin]','$_POST[Preclan]','$_POST[Hack]','$_POST[Email]','$_POST[Mapmode]','$_POST[Reco]','$_POST[Refer]','$_POST[Agree]')"; TIP: avoid using upper case letters in table and field names, always using lower case letters helps in avoiding mismatch problems. -
$dtDate = "2009-02-26 22:05:09"; $tmTime = strtotime($dtDate); $tmNextTime = $tmTime + 30; $dtNextDate = date("Y-m-d H:i:s", $tmNextTime); its the same as the little guy suggested, just instead of current time, u can put any time in the variable.
-
ow.......than i may be completely wrong ! sorry for mis-guiding u
-
1) Firing 2 CURL requests back to back doesnt mean that it is hitting both pages one after another. It executes as if 2 differnet users are trying to open these pages in 2 different browsers. u need to login to open second page, so it will not work. 2) u dont need to isntall snoopy, u can just download and include it. it is a PHP class.
-
mysql_connect("localhost", "user" ,"***"); mysql_select_db("dbname"); $strSql = "UPDATE propertylisting set propertylisting_status = 'NO' WHERE propertylisting_status = 'YES' AND propertylisting_expiry < '".time()."'"; mysql_query($strSql); //Assumptions //- u will be showing records with status = 'YES' //- u r storing unix time stamp in your third field whcih is _expiry, //- u will run this script periodically,
-
try running the query directly in phpmyadmin or any other mysql client u have.
-
1) Write cron 2) Select all active records from table 3) check 3rd field if the time has already passed. if yes deactivate the listing by updating record.
-
as far as i know even if u do 2 curl_exec one after another they will not be as good as hitting one page after another. PHP is stateless.... you will have to try something like Snoopy class..it is a browser simulator , but i m not sure how elegantly it works !! Google for Snoopy.class.php
-
sort your original first on counter, then do this foreach.
-
$origArr = array("bread"=>19, "butter"=>19, "coke"=>4, "orange"=> 7); $newArr = array(); foreach($origArr as $key=>$val) { $item = array(); $item["term"] = $key; $item["counter"] = $val; $newArr[] = $item; } not tested.