PravinS
Members-
Posts
459 -
Joined
-
Last visited
-
Days Won
2
Everything posted by PravinS
-
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
-
What is a data type of date field.
-
Run below given query in MySQL SELECT UNIX_TIMESTAMP(CURDATE());
-
You can use DATETIME data type.
-
basically you can directly create new config file and write all config content in that file, it will overwrite your old config file.
-
Refer http://php.net/manual/en/function.fwrite.php
-
Uploading using PHP then redircetion doesn't work, help!
PravinS replied to andy5898's topic in PHP Coding Help
You have given "/" after .html in header("Location: ") -
Use session_unregister(VARIABLE)
-
Write session_start() at the top of every page where you need session variables.
-
Refer this thread, I have post with pagination script http://www.phpfreaks.com/forums/index.php/topic,289203.msg1370548.html#msg1370548
-
Submitting form data to paypal and saving it to a DB???
PravinS replied to craigtolputt's topic in PHP Coding Help
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. -
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; }
-
Help implementing Paging with a Dynamic Sql Query
PravinS replied to viperdrake's topic in PHP Coding Help
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; } ?> -
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.
-
Use $username = substr($geturl[1], 1);
-
Yes it will be better if you fetch correct data from database using query as mentioned by thorpe.
-
Try this list($client_newsRecords, $client_newsMetaData) = getRecords(array_unique(array( 'tableName' => 'news', 'orderBy' => 'client ASC', )));
-
It will return array. $username[1] will return you actual username.
-
One way is to use $_SERVER['PHP_SELF'] which will return you "/~username/folder/setup.php", then explode it by "/", will get the result.
-
May array_unique() will help you.
-
` 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().