Jump to content

PravinS

Members
  • Posts

    459
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by PravinS

  1. It will be easy it you use MySQL date format function in your query like this SELECT DATE_FORMAT(DATEFEILD,"%M %e %Y") as dt from TABLENAME
  2. What is a data type of date field.
  3. PravinS

    Storing Dates

    Run below given query in MySQL SELECT UNIX_TIMESTAMP(CURDATE());
  4. PravinS

    Storing Dates

    You can use DATETIME data type.
  5. basically you can directly create new config file and write all config content in that file, it will overwrite your old config file.
  6. Refer http://php.net/manual/en/function.fwrite.php
  7. You have given "/" after .html in header("Location: ")
  8. Use session_unregister(VARIABLE)
  9. Write session_start() at the top of every page where you need session variables.
  10. Refer this thread, I have post with pagination script http://www.phpfreaks.com/forums/index.php/topic,289203.msg1370548.html#msg1370548
  11. There are few options 1) You can save data bafore sending it to paypal and can have a flag. When payment is done and customer is redirected to site you can check payment status flag from paypal, if it is "Success" then you can update your database flag as done or something. 2) You can have data in session, then after successful payment database can be updated.
  12. Use this function, it will return you object in array function object2array($object) { $return = NULL; if(is_array($object)) { foreach($object as $key => $value) $return[$key] = $this->object2array($value); } else { $var = get_object_vars($object); if($var) { foreach($var as $key => $value) $return[$key] = ($key && !$value) ? NULL : $this->object2array($value); } else return $object; } return $return; }
  13. Use this <?php function select_row($sql) { //echo $sql . "<br />"; if ($sql!="") { $result = mysql_query($sql) or die("Error: ".mysql_errno().":- ".mysql_error()); if ($result) { while($row = mysql_fetch_assoc($result)) $data[] = $row; } return $data; } } function pagingSlot($sql, $recperpage, $pagesetlimit, $page, $class, $getvars) { $rescnt=mysql_query($sql); $totcnt=mysql_num_rows($rescnt); if (!$page) $page = 1; $first=(($page-1)* $recperpage); $sql = $sql . " limit ".$first.",".$recperpage; $res = select_row($sql); $serial_no = ($page - 1) * $recperpage; $t = ($totcnt/$recperpage); $arr=split('[.]',$t); if ($arr[1]) $totalpages=$arr[0]+1; else $totalpages=$arr[0]; if ($totalpages > $pagesetlimit) { if ($page > 1) $pagesetstart = $page - 1; else $pagesetstart = $page; $pagesetend= ($pagesetstart-1) + $pagesetlimit; if ($pagesetend > $totalpages) { $pagesetend = $totalpages; $pagesetstart = $pagesetend - $pagesetlimit + 1; } } else { $pagesetstart = 1; $pagesetend = $totalpages; } $str = ""; if ($page > 1) { $prev = $page - 1; $str.= "<a href='".$_SERVER['PHP_SELF']."?page=$prev".$getvars."' class='".$class."'> << </a> | "; } else { $str.= "<< | "; } for ($i=$pagesetstart; $i<=$pagesetend; $i++) { if ($i <= $totalpages) { if (!$page) $page=1; if ($page==$i) $str.= '<font color=red>'.$i.'</font> '; else $str.= "<a href='".$_SERVER['PHP_SELF']."?page=$i".$getvars."' class='".$class."'>".$i."</a> "; } } if ($page < $totalpages) { $next = $page + 1; $str.= " | <a href='".$_SERVER['PHP_SELF']."?page=$next".$getvars."' class='".$class."'> >> </a> "; } else { $str.= " | >> "; } if ($totcnt == 0) $str = ""; $arr["records"]=$res; $arr["link"]=$str; $arr["serial"]=$serial_no; return $arr; } ?>
  14. There may be session_unregister (), session_unset(), session_destroy() functions used in user management page or any file which is included in user management page.
  15. Use $username = substr($geturl[1], 1);
  16. Yes it will be better if you fetch correct data from database using query as mentioned by thorpe.
  17. Try this list($client_newsRecords, $client_newsMetaData) = getRecords(array_unique(array( 'tableName' => 'news', 'orderBy' => 'client ASC', )));
  18. It will return array. $username[1] will return you actual username.
  19. One way is to use $_SERVER['PHP_SELF'] which will return you "/~username/folder/setup.php", then explode it by "/", will get the result.
  20. ` is identifier quote character. If an identifier is a reserved word or contains special characters, you must quote it whenever you refer to it. ' is generally used for strings
  21. Try like this $stats_query = " SELECT SUM(td_pass), SUM(int_pass), SUM(td), SUM(sacks), SUM(int_d), SUM(`int`) AS exp FROM XXX WHERE player_id = '$player_id' AND week = '$week'";
  22. If SUM('int') is working the in SQL query give alias name like "SUM('int') AS cnt" and use it in $row['cnt']
  23. You can concatenate $domains with "," or use implode() function to concatenate, and email the concatenated string in mail. According to your coding you will get only last selected value in mail body.
  24. Try base64_encode() and base64_decode().
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.