Jump to content

PravinS

Members
  • Posts

    459
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by PravinS

  1. Try this <?php $k = 1; while () // your while loop { // your code if ($k % 5 == 0) echo "<br>"; $k++; } ?>
  2. Are you getting some error?
  3. Use this[this.selectedIndex].text Instead of this[this.selectedIndex].value
  4. You can use this function function force_download($file) { $dir = ""; if ((isset($file))&&(file_exists($dir.$file))) { header("Content-type: application/force-download"); header('Content-Disposition: inline; filename="' . $dir.$file . '"'); header("Content-Transfer-Encoding: Binary"); header("Content-length: ".filesize($dir.$file)); header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment; filename="' . $file . '"'); readfile("$dir$file"); } }
  5. Use SQL query like this. SELECT * FROM tbl_name WHERE key_col LIKE 'RY%';
  6. How will you get $row['id']?
  7. Your delete query is wrong, you have used $ in where condition for field name. Use below given query. $query = "DELETE FROM recipes WHERE id = '$id'";
  8. While inserting data in the table use MYSQL NOW() function to insert date, and while retrieving it from database use MYSQL DATE_FORMAT() function.
  9. Also add enctype="multipart/form-data" for form.
  10. First echo is commented and second is blank.
  11. What method you are using in form POST or GET?
  12. You need to create database on new server and upload the database from old server. Create database dump(.sql) file from old server and upload it to new server. Then in cms_class.php page update username, password, database name of new server.
  13. Does image.gif physically exists in images folder?
  14. Use below given functions 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; }
  15. Use like this mysql_query("update application set comment='".mysql_real_escape_string($_POST[comment])."', userdatetime = NOW() where `IGN`='".mysql_real_escape_string($_POST[name])."'");
  16. remove the (') single quotes, use only NOW() function. Also why are you using 2 different queries to update same table. You can do it in single update query.
  17. You have not used mysql_query() function for insert query $sql= mysql_query("INSERT INTO application (datetime) VALUES (NOW())");
  18. Hi Please use below given function function pagingPN($sql, $page, $limit, $getvars, $class) { if ($page == "") $page = 1; if ($limit == 0) $limit = $this->limit; $tsql = $sql; $result = mysql_query($tsql) or die("Error: ".mysql_errno().":- ".mysql_error()); $total = mysql_num_rows($result); $totnumpages = ceil($total/$limit); if ($offset < 0) $offset = 0; else $offset = ($page - 1) * $limit; $sql = $sql. " limit $offset, $limit"; if ($sql!="") { $result = mysql_query($sql) or die("Error: ".mysql_errno().":- ".mysql_error()); if ($result) { while($row = mysql_fetch_array($result)) $data[] = $row; } $res = $data; $serial_no = ($page - 1) * $limit; if ($total > 0) { $link .= "<font face='verdana' size='1'>Page: <strong>".$page."</strong> of <strong>".$totnumpages."</strong> Goto: </font>"; if ($page > 1) { $link .= "<a href=".$_SERVER['PHP_SELF']."?page=1$getvars class='".$class."' title='Jump to First Page'><<</a> | "; $prev = $page - 1; $link .= "<a href=".$_SERVER['PHP_SELF']."?page=".$prev."$getvars class='".$class."' title='Goto Previous Page'>Previous</a><span class='".$class."'> | </span>"; } else { $link .= "<span class='".$class."' title='Jump to First Page'><<</span> | <span class='".$class."' title='Goto Previous Page'>Previous | </span>"; } if ($page < $totnumpages) { $next = $page + 1; $link .= "<a href=".$_SERVER['PHP_SELF']."?page=".$next."$getvars class='".$class."' title='Goto Next Page'>Next</a> | "; $link .= "<a href=".$_SERVER['PHP_SELF']."?page=".$totnumpages."$getvars class='".$class."' title='Jump to Last Page'>>></a>"; } else { $link .= "<span class='".$class."' title='Goto Next Page'>Next</span> | <span class='".$class."' title='Jump to Last Page'>>></span>"; } } $retarr["sql"] = $sql; $retarr["records"] = $res; $retarr["serial_no"] = $_no; $retarr["link"] = $link; return $retarr; } } $rs = pagingPN($query, trim($_REQUEST['page']), 10, "", "pagingCSS"); $rs_recordset = $rs['records']; $link = $rs['link'];
  19. Oh I am really sorry
  20. I have not insisted to use array($res) in the code.
  21. Use for loop like this, replace fieldnam1, fieldname2 .... with your table fieldnames for($i=0;$i<count($res);$i++) { echo $res[$i]['fielname1']." ".$res[$i]['fielname1']; }
  22. Use like this $res = select_row("SELECT * from mains order by main_id asc limit 10 "); echo "<pre>"; print_r($res); echo "</pre>";
  23. Use below given function, it will give you 2 dimension array function select_row($sql) { $rs = mysql_query($sql); if (!$rs) return false; else { while($row = mysql_fetch_array($rs,MYSQL_ASSOC)) { $res[] = $row; } return $res; } }
  24. Please close PHP tag ( ?> ) at the end of the code.
  25. You need to use enctype="multipart/form-data" for your form tag like this <form name="form1" method="post" action="register.php" enctype="multipart/form-data">
×
×
  • 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.