PravinS
Members-
Posts
459 -
Joined
-
Last visited
-
Days Won
2
Everything posted by PravinS
-
Try osCommerce
-
Quick question regarding gallery scripts
PravinS replied to deansaddigh's topic in Third Party Scripts
Refer this site, they have different gallery scripts http://www.dynamicdrive.com/ -
Also use array_flip() function.
-
Use CRON.
-
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]
-
Try like this Options +FollowSymLinks RewriteEngine On RewriteRule ^index.html index.php [NC]
-
User VARCHAR() data type
-
Fatal error: Maximum execution time of 30 seconds exceeded
PravinS replied to krizzangel's topic in PHP Coding Help
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. -
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; } ?>
-
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.
-
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); } ?>
-
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; ?>
-
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; }
-
need help outputing mysql data in hierarchical format
PravinS replied to marcin_koss's topic in PHP Coding Help
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. -
What is data type of "last_activity" field. It it is DATETIME then you can directly compare it with NOW() function in query.
-
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']; ?>
-
php warning - supplied argument is not a valid MySQL result resource
PravinS replied to Nucleus's topic in PHP Coding Help
Its $num=mysql_num_rows($result); not $num=mysql_numrows($result); -
Use AND instead of & in SELECT query $query = $db->execute("select * from `players` where `username`='". $username ."' AND `password`='". $password ."'");
-
You can use style="display:none" in object tag
-
You can use strip_tags () function, if you want to remove HTML tags from doc.
-
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 ";
-
Try this $sql = "SELECT * from TABLENAME LIMIT 6, 5"; it will give you next 5 records from 6 to 10
-
What are different ways for load balancing on MySQL server?
-
Warning: mysql_fetch_array() expects parameter 1 to be resource
PravinS replied to EmuX's topic in PHP Coding Help
You need to check the queries, echo the queries and execute it in mysql. -
Warning: mysql_fetch_array() expects parameter 1 to be resource
PravinS replied to EmuX's topic in PHP Coding Help
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.'");