
PravinS
-
Posts
459 -
Joined
-
Last visited
-
Days Won
2
Posts posted by PravinS
-
-
` 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
-
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'";
-
If SUM('int') is working the in SQL query give alias name like "SUM('int') AS cnt" and use it in $row['cnt']
-
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.
-
Try base64_encode() and base64_decode().
-
Try osCommerce
-
-
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
-
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; }
-
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']; ?>
-
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
get distinct values from an array
in PHP Coding Help
Posted
May array_unique() will help you.