Jump to content

PravinS

Members
  • Posts

    459
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by PravinS

  1. Refer this site, they have different gallery scripts http://www.dynamicdrive.com/
  2. I have used this pie chart script in one of my site, may this will help you, plz find attached zip file. [attachment deleted by admin]
  3. Try like this Options +FollowSymLinks RewriteEngine On RewriteRule ^index.html index.php [NC]
  4. As you are having 2 while loops, it is going in loop execution reaching the max execution time. For that you can check your queries which will return minimum records, which will let you know that queries are proper. Also you can try to optimize your queries. Or else you have to increase you execution time.
  5. 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; } ?>
  6. You need to check the posted value in database using SELECT query, if record it found in database then show the error message else run the insert query.
  7. Use this function, it list all files in current directory <?php if ($handle = opendir('.')) { echo "<ul>"; while (false !== ($file = readdir($handle))) { if ($file != "." && $file != "..") { echo "<li>$file</li>"; } } echo "</ul>"; closedir($handle); } ?>
  8. First check you array $field_foo, is it valid array? Then for "," issue here is the code <?php $str = ""; foreach($field_foo as $hai) { $str = $hai['value'] . ","; } $str = substr($str,0,-1); print $str; ?>
  9. Try this function function sort_array($array, $key, $order) { if ($order=="DESC") $or="arsort"; else $or="asort"; for ($i = 0; $i < sizeof($array); $i++) { $sort_values[$i] = $array[$i][$key]; } $or($sort_values); reset ($sort_values); while (list ($arr_key, $arr_val) = each ($sort_values)) { $sorted_arr[] = $array[$arr_key]; } return $sorted_arr; }
  10. You have to use recursive function to get data in required format. I have create on multilevel menu with same recursive functionality, you can refer it. Download URL: http://www.phpclasses.org/browse/package/5927.html refer functions.php file, where it have getMenu() and getChild() functions.
  11. What is data type of "last_activity" field. It it is DATETIME then you can directly compare it with NOW() function in query.
  12. Try this <?php function hex2rgb($hex){ $rgb = array(); $rgb['r'] = hexdec(substr($hex, 0, 2)); $rgb['g'] = hexdec(substr($hex, 2, 2)); $rgb['b'] = hexdec(substr($hex, 4, 2)); return $rgb; } print_r(hex2rgb('ffffff')); $colors = hex2rgb('ffffff'); echo "<br>".$colors['r']; ?>
  13. Its $num=mysql_num_rows($result); not $num=mysql_numrows($result);
  14. Use AND instead of & in SELECT query $query = $db->execute("select * from `players` where `username`='". $username ."' AND `password`='". $password ."'");
  15. You can use style="display:none" in object tag
  16. You can use strip_tags () function, if you want to remove HTML tags from doc.
  17. You can calculate total number of records in the table and then subtract 5 from it the your query will change as $displayrecords = $totalrecords - 5; $sql = "SELECT * from TABLENAME LIMIT 6, $displayrecords ";
  18. Try this $sql = "SELECT * from TABLENAME LIMIT 6, 5"; it will give you next 5 records from 6 to 10
  19. What are different ways for load balancing on MySQL server?
  20. You need to check the queries, echo the queries and execute it in mysql.
  21. Please check your mysql queries, also try this $res = mysql_query("SELECT sqlhost,sqluser,sqlpass,chardb FROM realms WHERE entry='.$Realm.'"); and $res = mysql_query("SELECT guid FROM characters WHERE name='.$Name.'");
×
×
  • 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.