mdvignesh
-
Posts
60 -
Joined
-
Last visited
Posts posted by mdvignesh
-
-
I am doing Photo gallery using cakephp and flickr by seeing this link
http://www.sitepoint.com/photo-gallery-cakephp-flickr/#
I am getting
Error: Class 'phpFlickr' not found
File: C:\wamp\www\cake\app\Controller\Component\flickrComponent.php
Line: 28
This is my flickrComponent.php
<?php /** * Flickr Component * @author RosSoft * @license MIT * @version 0.1 */ define(‘FLICKR_CACHE_DIR’,CACHE . ‘flickr/’); class FlickrComponent extends Object { /** * Api Key. Change to your own * @var string * @link http://www.flickr.com/services/api/misc.api_keys.html */ //var $_api_key=’CHANGE_TO_YOUR_KEY’; var $_api_key='55d16262ee69f739466b7c45b073cc8a'; function startup(&$controller) { App::import('Vendor', 'phpFlickr', array('file' => 'phpflickr'.DS.'phpFlickr'.DS.'phpFlickr.php')); //vendor(‘phpflickr/phpFlickr’); //FlickrComponent instance of controller is replaced by a phpFlickr instance $controller->flickr =& new phpFlickr($this->_api_key); if (!is_dir(FLICKR_CACHE_DIR)) { mkdir(FLICKR_CACHE_DIR,0777); } $controller->flickr->enableCache(‘fs’, FLICKR_CACHE_DIR); $controller->set(‘flickr’,$controller->flickr); } } ?>
This is my gallerycontroller.php
<?php class GalleryController extends AppController { var $name = 'Gallery'; var $components = array('Flickr'); var $uses = null; } ?>
-
I created a password in wamp server than i added that password in new mysqli("localhost","root","beam","lms")
Now iam getting error :
Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: Access denied for user ''@'localhost' (using password: NO) in on line 169
Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: A link to the server could not be established in on line 169
(Before having password thatis without password it was working good)
-
Thank u very very much.
php freaks is the GOD
:D
-
I dont know y if else not working
my questions is when i type username in the database it displays username exists but if type something else it does not displays the else part in the if statement
signup.php
<? include("db.php")?> <html> <head> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <script type="text/javascript"> function valid() { var un=document.forms[0].dun.value; //alert(un); if(un=="") { alert("Enter username"); document.forms[0].dun.focus(); return false; } var ps=document.forms[0].pass.value; if(ps=="") { alert("Enter password"); document.forms[0].pass.focus(); return false; } var mail=document.forms[0].em.value; if(mail=="") { alert("Enter email"); document.forms[0].em.focus(); return false; } var mobile=document.forms[0].mob.value; if(mobile=="") { alert("Enter mobile"); document.forms[0].mob.focus(); return false; } } </script> <script src="jquery-1.7.1.min.js"></script> <script type="text/javascript"> $(document).ready(function(){ $('#feedback').load('chech.php').show(); $('#username_input').keyup(function() { $.post('chech.php',{ dun:form.dun.value }, function(result) { $('#feedback').html(result).show(); }); }); }); </script> </head> <body> <form name="form" method="post"> <label>Desired Username:</label> <input type="text" id="username_input" name="dun"><div id="feedback"></div> <br><br> <label>Password:</label> <input type="password" name="pass"><br/><br/> <label>Confirm:</label><input type="password" name="pass2"> <br><br> <label>Email:</label> <input type="text" name="em"> <br><br> <label>Mobile:</label> <input type="text" name="mob"> <br><br><br> <input type="submit" name="sub" value="signup" onClick="return valid();"> </form> <? if(isset($_REQUEST['sub'])) { $ins=mysql_query("insert into reg (username ,password ,email ,mobile) values ('".$_REQUEST['dun']."' ,'". $_REQUEST['pass']."','".$_REQUEST['em']."','".$_REQUEST['mob']."') "); if(!$ins) { echo "error"; } else ?> <a href="login.php">Login</a> <? } ?> </body> </html>
chech.php
<? include("db.php"); if(isset($_POST['dun'])) { //echo $_REQUEST['dun']; $sel=mysql_query("select username from reg where username='".$_REQUEST['dun']."' "); $count=mysql_num_rows($sel) or die(mysql_error()); echo $count; if($count>0) { echo "username exists"; } else echo "not exists"; } ?>
-
here is the code
$(".newsticker-jcarousellite2").jCarouselLite({ horizontal: true, hoverPause:true, visible: 3, auto:5000, speed:1000, btnNext: ".prev", btnPrev: ".next" });
-
On page load the jcarousellite comes vertically and after that it comes correctly
I want to load horizontally the jcarousellite slide
I downloaded from here
http://www.htmldrive.net/items/show/397/Vertical-Scrolling-News-Ticker-With-jQuery-jCarouse
and modified horizontal:true
How to do that see this http://cineaxis.com/
-
Facebook share fetches all pictures from my site when i click the button which i get from addthis.com
I found one solution but i dont know how to use it - <meta tag> in head tag
See this link http://www.cineaxis.com/news-details.php?id=451
-
how to use foriegn key in insert query
I am having a comment form for each video like youtube
having 2 tables one for video details and one for comments
insert into cae_comments (c_id,comments_date,comments,approve_com) values ('".$_REQUEST['id']."','".date("Y-m-d")."' ,'".trim($_POST['txtarea'])."',NULL)
i set c_id as foreign key
and primary key v_id in 2nd table
-
on page load pop up comes for selecting tv or movies
(session is started in conn.php)
if tv is selected session['select'] = 'tv_sotime' same for movies
Now i want to change the selection
I kept a link 'CHANGE' for selection
i will unset session['select'] by passing variable on session.php
but when i load /entertainment.php the pop up should not come
Thank U...
index.php
<? include("conn.php"); //require('_drawrating.php'); $pagename="Entertainment"; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title><?=$settings->ScriptName?> | <?=$pagename?></title> <link rel="shortcut icon" href="images/favicon.ico" /> <link rel="shortcut icon" type="images/png" href="images/favicon.png" /> <link rel="shortcut icon" type="images/png" href="images/favicon.gif" /> <link rel="stylesheet" href="style.css" type="text/css" media="all" /> <link rel="stylesheet" href="css/cnelstyle.css" type="text/css" media="all" /> <link media="screen" rel="stylesheet" href="css/colorbox.css" /> <script src="js/jquerylatestmin.js" type="text/javascript"></script> <script src="js/jquery.colorbox-min.js" type="text/javascript"></script> <script type="text/javascript"> $(function() { $(window).bind('load', function(e) { $.colorbox({ 'width' : 300, 'height' : 130, 'transitionIn' : 'none', 'transitionOut' : 'elastic', 'centerOnScroll' : 'true', 'overlayOpacity' : 0.2, 'overlayColor' : '#000', 'modal' : 'true', href:"select.php"}); }); }); </script> </head> <body> <? //require_once("fb.php")?> <div id="wrap"> <? include('header.php'); include("session.php"); ?> <div class="wraper"> <div class="middle"> <div class="ad"><?=stripslashes($adsense->Ads7)?></div> </div> <div class="clr"></div> </div> </div> <div class="footer"> <div class="wraper"> <?php include("footer.php"); ?> </div> </div> </body> </html>
tv_sotime.php
<?php include("conn.php"); $pagename="TV SHOWTIME"; $_SESSION['select'] = 'tv_sotime'; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title> <?=$settings->ScriptName?> | <?=$pagename?> </title> <link rel="shortcut icon" href="images/favicon.ico" /> <link rel="shortcut icon" type="images/png" href="images/favicon.png" /> <link rel="shortcut icon" type="images/png" href="images/favicon.gif" /> <link rel="stylesheet" href="css/cnelstyle.css" type="text/css" media="all" /> <link rel="stylesheet" href="style.css" type="text/css" media="all" /> <link rel="stylesheet" href="jscss/main.css" /> <script type="text/javascript" src="jscss/jquery-1.3.2.min.js"></script> <script type="text/javascript" src="jscss/main.js"></script> </head> <body> <? //include("customjqmodalbox.php"); require_once("fb.php"); ?> <div id="wrap"> <? include('header.php')?> <div class="wraper"> <div class="middle"> <div class="middle_content"><a href="session.php?curr=c">Change</a></div> <div id="page"> <ul class="mytabs" id="tabs"> <li class="title"> <h2><strong>What's on Today?</strong></h2> <? //date('l M d Y')?> </li> <!-- <li class="todaydate"> <h2></h2> </li>--> <li class="current"><a href="tab-1.html">Movies</a></li> <li><a href="tab-2.html">Reality</a></li> <li><a href="tab-3.html">Sports</a></li> </ul> <div class="mytabs-container" id="tabs-container"> Loading... </div> </div> <!-- page --> <div class="ad"> <?=stripslashes($adsense->Ads7)?> </div> <div class="ss"> <h3 id="cat_head">Categories</h3> <ul> <li><a href="#">Drama</a></li> <li><a href="#">TV Programs</a></li> <li><a href="#">Special Programs for special Day</a></li> </ul> <img src="images/cineaxis.png" alt="" /> </div> </div> </div> <div class="clr"></div> </div> </div> <!-- warp --> <!--<div class="fb-like-box" data-href="http://www.facebook.com/CineAxis" data-width="198" data-height="274" data-show-faces="true" data-border-color="#E8E8E8" data-stream="false" data-header="false"> </div>--> <div class="footer"> <div class="wraper"> <?php include("footer.php"); ?> </div> </div> </body> </html>
<? include("conn.php"); //session_start(); if(isset($_GET['curr']) == 'c') { unset($_SESSION['select']); //session_destroy(); header("Location:index.php"); } if(isset($_SESSION['select'])) { if($_SESSION['select'] == 'tv_sotime') { $page = 'tv_sotime.php'; header("Location:$page"); } if($_SESSION['select'] == 'movie_sotime') { $page2 = 'movie_sotime.php'; header("Location:$page2"); } } ?>
-
i want a page with alert on page load for selecting country
background click must be disabled and escape key should be disabled
-
First,
I will select checkbox then click generate report then it displays the items with download link
Then i click download link to download the selected checkbox values in pdf
I want to download the selected checkbox items by clicking download link
Now i am getting all check box items in the pdf download
How to download only the selected check box items
<?php session_start(); $_SESSION['pidd'] = 2; $sessvar = $_SESSION['pidd']; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Untitled Document</title> <link rel="stylesheet" type="text/css" href="css/style.css" /> <style type="text/css" media="print"> DIV#noprint{visibility:hidden;} INPUT#printbutt{visibility:hidden;} #downloadlink{visibility:hidden;} </style> <script type="text/javascript"> function gen() { var st1=document.getElementById("ckbox1").checked; var st2=document.getElementById("ckbox2").checked; var st3=document.getElementById("ckbox3").checked; var st4=document.getElementById("ckbox4").checked; if(st1 == true) { document.getElementById('g1').style.display = 'block'; } if(st2 == true) { document.getElementById('g2').style.display = 'block'; } if(st3 == true) { document.getElementById('g3').style.display = 'block'; } if(st4 == true) { document.getElementById('g4').style.display = 'block'; } document.getElementById('p_info').style.display = 'none'; document.getElementById('histree').style.display = 'none'; document.getElementById('insurence').style.display = 'none'; document.getElementById('billin').style.display = 'none'; } function showuser() { document.getElementById('g1').style.display = 'none'; document.getElementById('g2').style.display = 'none'; document.getElementById('g3').style.display = 'none'; document.getElementById('g4').style.display = 'none'; var str1=document.getElementById("ckbox1").checked; var str2=document.getElementById("ckbox2").checked; var str3=document.getElementById("ckbox3").checked; var str4=document.getElementById("ckbox4").checked; if(str1 == true) { document.getElementById('p_info').style.display = 'block'; } else document.getElementById('p_info').style.display = 'none'; if(str2 == true) { document.getElementById('histree').style.display = 'block'; } else document.getElementById('histree').style.display = 'none'; if(str3 == true) { document.getElementById('insurence').style.display = 'block'; } else document.getElementById('insurence').style.display = 'none'; if(str4 == true) { document.getElementById('billin').style.display = 'block'; } else document.getElementById('billin').style.display = 'none'; } function checkByParent(aId, aChecked) { var collection = document.getElementById(aId).getElementsByTagName('INPUT'); for (var x=0; x<collection.length; x++) { if (collection[x].type.toUpperCase()=='CHECKBOX') collection[x].checked = aChecked; } } </script> </head> <body> <div id="main_content"> <div id="left"> <div id="noprint"> <h4>Patient Report</h4> <a id="check_all" href="#" style="text-decoration:none" onClick="checkByParent('checkboxes', true); return false;">check all</a> <a id="uncheckall" href="#" style="text-decoration:none" onClick="checkByParent('checkboxes', false); return false;">uncheck all</a> <br> <br> <form method="post" name="myform" action=""> <div id="checkboxes"> <div id="cb_id1"> <input id="ckbox1" name="cbox1" type="checkbox" <? if(isset($_REQUEST['cbox1'])) echo 'checked="checked"' ; ?> value="p_info" /> Patient Info </div> <div id="cb_id2"> <input id="ckbox2" name="cbox2" type="checkbox" <?php if(isset($_REQUEST['cbox2'])) echo 'checked="checked"' ; ?> value="histree" /> History </div> <div id="cb_id3"> <input id="ckbox3" name="cbox3" type="checkbox" <?php if(isset($_REQUEST['cbox3'])) echo 'checked="checked"' ; ?> value="insurance" /> Insurence </div> <div id="cb_id4"> <input id="ckbox4" name="cbox4" type="checkbox" <?php if(isset($_REQUEST['cbox4'])) echo 'checked="checked"' ; ?> value="billin" /> Billing </div> </div> <!--checkboxes div --> <br> <input id="vuprint" name="view" type="button" value="View" onClick="showuser();"> <hr/> <label for="docs"> Documents:<br> <br> </label> <input name="sub" type="button" value="Generate report" onclick="gen();"> <hr/> </form> <input id="printbutt" name="prt" type="button" value="Print" onClick="javascript:window.print();"> </div> <!--No print --> </div> <!--Left div --> <div id="side"> <div id="p_info"> <?php require("db_conn.php"); $pinfo = mysqli_query($mysqli,"SELECT * FROM patient_datas WHERE P_Id='".$sessvar."' "); while($fet = mysqli_fetch_array($pinfo)) { echo "<h4>Patient Info</h4>"; echo "<b>Name: </b>" . $fet["P_Fname"] . " " . $fet["P_Lname"]. "<br>"; echo "<b>Dob:</b> " . date("d-m-Y",strtotime($fet["P_Dob"]))."<br>"; echo "<b>Age:</b> " . $fet["P_Age"]."<br>"; echo "<b>Gender:</b> " . $fet["P_Gender"]."<br>"; echo "<b>Marital Status:</b> " . $fet["P_Mstatus"]."<br>"; echo "<b>Blood: </b>" . $fet["P_Blood"]."<br>"; echo "<b>Height: </b>" . $fet["P_Height"] . $fet["P_Hval"]."<br>"; echo "<b>Weight: </b>" . $fet["P_Weight"] . $fet["P_Wval"]; } ?> </div> <div id="histree"> <?php $his = mysqli_query($mysqli,"SELECT * FROM patient_datas WHERE P_Id='".$sessvar."' "); while($hisrow = mysqli_fetch_array($his,MYSQLI_ASSOC)) { echo "<h4>Patient Histroy</h4>"; echo "<b>P_Idate: </b>" . date("d-m-Y",strtotime($hisrow["P_Idate"]))."<br>"; echo "<b>P_Edate: </b>" . date("d-m-Y",strtotime($hisrow["P_Edate"]))."<br>"; echo "<b>D_Ddate: </b>" . date("d-m-Y",strtotime($hisrow["D_Ddate"])); } ?> </div> <!-- Insurence --> <div id="insurence"> <?php $insu = mysqli_query($mysqli,"SELECT * FROM patient_datas WHERE P_Id='".$sessvar."' "); while($insrow = mysqli_fetch_array($insu,MYSQLI_ASSOC)) { ?> <?php echo "<h4>Insurence</h4>"; echo "<b>P_Isname: </b>" . $insrow["P_Isname"]."<br>"; // echo $insow[""]; } ?> </div> <div id="billin"> <?php $bilrow = mysqli_query($mysqli,"SELECT * FROM patient_datas WHERE P_Id='1' "); while($bill = mysqli_fetch_array($bilrow,MYSQLI_ASSOC)) { ?> <?php echo "<h4>Billing</h4>"; echo "<b>P_Fbill: </b>" . $bill["P_Fbill"]."<br>"; echo "<b>Fees: </b>" . $bill["fees"]; } ?> </div> </div> <!--/side div --> <div id="generatereport"> <div id="g1" style="display:none; clear:both;"> <label for="Gen_reports">Generaterd reports</label> <br /> <br /> <?php $pinfo = mysqli_query($mysqli,"SELECT * FROM patient_datas WHERE P_Id='1' "); while($fet = mysqli_fetch_array($pinfo,MYSQLI_ASSOC)) { $new_dob = date("d-m-Y",strtotime($fet["P_Dob"])); ?> <?php echo "<h4>Patient Info</h4>"; echo "<b>Patient Id:</b> ". $fet["P_Id"]."<br>"; echo "<b>Name:</b> " . $fet["P_Fname"] . " " . $fet["P_Lname"]."<br>"; echo "<b>Dob:</b> " . $new_dob ."<br>"; echo "<b>Age:</b> " .$fet["P_Age"]."<br>"; echo "<b>Gender:</b> " . $fet["P_Gender"]."<br>"; echo "<b>Marital Status:</b> " . $fet["P_Mstatus"]. "<br>"; echo "<b>Blood:</b> " . $fet["P_Blood"] . "<br>"; echo "<b>Height:</b> " . $fet["P_Height"] . $fet["P_Hval"]. "<br>"; echo "<b>Weight:</b> " . $fet["P_Weight"] . $fet["P_Wval"]. "<br>"; } echo "*************************************************************************************************************************"; ?> </div> <div id="g2" style="display:none"> <?php $his = mysqli_query($mysqli,"SELECT * FROM patient_datas WHERE P_Id='1' "); while($secrow = mysqli_fetch_array($his,MYSQLI_ASSOC)) { echo "<h4>Patient Histroy</h4>"; echo "<b>P_Idate:</b> " . date("d-m-Y",strtotime($secrow["P_Idate"])) ."<br>"; echo "<b>P_Edate:</b> " . date("d-m-Y",strtotime($secrow["P_Edate"])) ."<br>"; echo "<b>D_Ddate:</b> " . date("d-m-Y",strtotime($secrow["D_Ddate"])) ."<br>"; } echo "*************************************************************************************************************************"; ?> </div> <div id="g3" style="display:none"> <?php $insu = mysqli_query($mysqli,"SELECT * FROM patient_datas WHERE P_Id='1' "); while($insrow = mysqli_fetch_array($insu,MYSQLI_ASSOC)) { echo "<h4>Insurence</h4>"; echo "<b>P_Isname:</b>" . $insrow["P_Isname"]."<br>"; } echo "*************************************************************************************************************************"; ?> </div> <div id="g4" style="display:none"> <?php $bilrow = mysqli_query($mysqli,"SELECT * FROM patient_datas WHERE P_Id='1' "); while($bill = mysqli_fetch_array($bilrow,MYSQLI_ASSOC)) { echo "<h4>Billing</h4>"; echo "<b>P_Fbill:</b> " . $bill["P_Fbill"]."<br>"; echo "<b>Fees:</b> " . $bill["fees"]; } ?> </div> <?php $infochk = 'p_info'; $hischk = 'histree'; $insuchk = 'insurance'; $billchk = 'billin'; ?> <a id="downloadlink" href="download_pdf2.php?info=<?php if(isset($infochk)) echo $infochk; ?>&hist=<?php if(isset($hischk)) echo $hischk; ?>&insu=<?php if(isset($insuchk)) echo $insuchk; ?>&billin=<?php if(isset($billchk)) echo $billchk; ?>">Download</a> </div> <!--generate report --> </div> <!--/main_coontent --> </body> </html>
-
-
Help to solve
i am getting Access denied for user 'SYSTEM'@'localhost' (using password: NO)
phpclasspagination
<html>
<head>
<link rel="stylesheet" href="style.css" type="text/css" />
</head>
<body>
<?php
//$dbHost = 'localhost';
//$dbUser = 'root';
//$dbPass = '';
//$dbName = 'pagination';
//$mysqli = new mysqli($dbHost, $dbUser, $dbPass, $dbName);
require("CSSPagination.class.php");
$sql1 = "SELECT * FROM records WHERE active='1' ORDER BY name";
$rowsperpage = 5;
$website = $_SERVER['PHP_SELF']."?id=1";
$pagination = new CSSPagination($sql1, $rowsperpage, $website);
$pagination->setPage($_GET
); // dont change it
echo $pagination->showPage();
$sql2="SELECT * FROM records ORDER BY name ASC LIMIT " . $pagination->getLimit() . ", " . $rowsperpage;
$dbcon=mysql_connect($dbHost, $dbUser, $dbPass);
mysql_select_db("pagination",$dbcon);
$result = @mysql_query($sql2, $mysqli) or die("failed");
//$result = $mysqli->query($sql2);
//$rows = $result->fetch_array(MYSQLI_ASSOC)
while($rows = mysql_fetch_array($result)) {
echo $rows["name"];
echo "<br>";
echo $rows["id"];
}
echo $pagination->showPage(); // Show the pagination index
//ob_end_flush();
?>
</body>
</html>
CSSPagination.class
<?php
class CSSPagination
{
private $totalrows;
private $rowsperpage;
private $website;
private $page;
private $sql;
public function __construct($sql, $rowsperpage, $website)
{
$this->sql = $sql;
$this->website = $website;
$this->rowsperpage = $rowsperpage;
}
public function setPage($page)
{
if (!$page) { $this->page=1; } else { $this->page = $page; }
}
public function getLimit()
{
return ($this->page - 1) * $this->rowsperpage;
}
private function getTotalRows()
{
$result = @mysql_query($this->sql) or die ("mdv ". mysql_error());
$this->totalrows = mysql_num_rows($result);
}
private function getLastPage()
{
return ceil($this->totalrows / $this->rowsperpage);
}
public function showPage()
{
$this->getTotalRows();
$pagination = "";
$lpm1 = $this->getLastPage() - 1;
$page = $this->page;
$prev = $this->page - 1;
$next = $this->page + 1;
$pagination .= "<div class=\"pagination\"";
if($margin || $padding)
{
$pagination .= " style=\"";
if($margin)
$pagination .= "margin: $margin;";
if($padding)
$pagination .= "padding: $padding;";
$pagination .= "\"";
}
$pagination .= ">";
if ($this->getLastPage() > 1)
{
if ($page > 1)
$pagination .= "<a href=$this->website&page=$prev>« prev</a>";
else
$pagination .= "<span class=\"disabled\">« prev</span>";
if ($this->getLastPage() < 9)
{
for ($counter = 1; $counter <= $this->getLastPage(); $counter++)
{
if ($counter == $page)
$pagination .= "<span class=\"current\">".$counter."</span>";
else
$pagination .= "<a href=$this->website&page=$counter>".$counter."</a>";
}
}
elseif($this->getLastPage() >= 9)
{
if($page < 4)
{
for ($counter = 1; $counter < 6; $counter++)
{
if ($counter == $page)
$pagination .= "<span class=\"current\">".$counter."</span>";
else
$pagination .= "<a href=$this->website&page=$counter/>".$counter."</a>";
}
$pagination .= "...";
$pagination .= "<a href=$this->website&page=$lpm1>".$lpm1."</a>";
$pagination .= "<a href=$this->website&page=".$this->getLastPage().">".$this->getLastPage()."</a>";
}
elseif($this->getLastPage() - 3 > $page && $page > 1)
{
$pagination .= "<a href=$this->website&page=1>1</a>";
$pagination .= "<a href=$this->website&page=2>2</a>";
$pagination .= "...";
for ($counter = $page - 1; $counter <= $page + 1; $counter++)
{
if ($counter == $page)
$pagination .= "<span class=\"current\">".$counter."</span>";
else
$pagination .= "<a href=$this->website&page=$counter>".$counter."</a>";
}
$pagination .= "...";
$pagination .= "<a href=$this->website&page=$lpm1>$lpm1</a>";
$pagination .= "<a href=$this->website&page=".$this->getLastPage().">".$this->getLastPage()."</a>";
}
else
{
$pagination .= "<a href=$this->website&page=1>1</a>";
$pagination .= "<a href=$this->website&page=2>2</a>";
$pagination .= "...";
for ($counter = $this->getLastPage() - 4; $counter <= $this->getLastPage(); $counter++)
{
if ($counter == $page)
$pagination .= "<span class=\"current\">".$counter."</span>";
else
$pagination .= "<a href=$this->website&page=$counter>".$counter."</a>";
}
}
}
if ($page < $counter - 1)
$pagination .= "<a href=$this->website&page=$next>next »</a>";
else
$pagination .= "<span class=\"disabled\">next »</span>";
$pagination .= "</div>\n";
}
return $pagination;
}
}
?>
-
U can use
window.open()
-
I already tried it
its not working in getdetail.php
But the fancy box is working in getdetail.php not by ajax call
-
i am having reals.php on clicking search goes to getdetail.php using ajax
when i click the image it goes to that image file not a fancy box
-
I am having date column with date datatype like this
2012-03-01
2012-03-02
2012-03-03
2012-03-04
2012-04-01
2012-04-02
2012-05-01
2012-05-02
How to select all fields of march month??
-
i want to make a monthly report
the user selects month from drop down and i must get the specified dates of that month from the DB
I am using ajax to get the dates
-
How to download the page to pdf with changing alignment
I need to align the columns for the table
pur_report.php
<?php $cnn = mysql_connect("localhost","root",""); mysql_select_db("stock",$cnn); ?> <html><head> <script src="jquery.min.js" type="text/javascript"></script> <script type="text/javascript" src="datetimepicker.js"> </script> <script src="js/jquery.min.js" type="text/javascript"></script> <script type="text/javascript">$(function() { $("#from_purchase_date").date_input(); $("#to_purchase_date").date_input(); }); function purchase_report_fn() { window.open("view2.php?from_purchase_date="+$('#from_purchase_date').val()+"&to_purchase_date="+$('#to_purchase_date').val(),"myNewWinsr","width=800,height=600,toolbar=0,menubar=no,status=no,resizable=yes,location=no,directories=no,scrollbars=yes"); } </script> </head> <body> <form method="get"> <input type="text" id="from_purchase_date" name="from_purchase_date"> <a href="javascript:NewCal('from_purchase_date','ddmmyyyy')"> <img src="cal.gif" width="16" height="16" border="0" alt="Pick a date"></a> <input name="to_purchase_date" id="to_purchase_date" type="text"> <a href="javascript:NewCal('to_purchase_date','ddmmyyyy')"> <img src="cal.gif" width="16" height="16" border="0" alt="Pick a date"></a> <input type="button" onClick="purchase_report_fn();" value="Go"> </form> </body> </html>
view2.php
<?php $cnn = mysql_connect("localhost","root",""); mysql_select_db("chms",$cnn); ?> <html> <head> <style type="text/css"> table{width:100%;} </style> </head> <body><?php if($_GET['from_purchase_date'] && $_GET['to_purchase_date']) { ?> <div align="center"><b>Purchase Report</b></div> <input name="prt" type="button" value="Print" onClick="javascript:window.print()" /> <hr/> <?php echo "From : ".$_GET['from_purchase_date'] ." "." To : ".$_GET['to_purchase_date']; ?> <hr/> <table border="0" cellspacing="0" cellpadding="0"> <tr> <th scope="col" align="center">Bill Number</th> <th scope="col" align="center">Supplier Name</th> <th scope="col" align="center">Quantity</th> <th scope="col" align="center">Cost Price</th> <th scope="col" align="center">Rate</th> <th scope="col" align="center">Paid</th> <th scope="col" align="center">Balance</th> <th scope="col" align="center">Date</th> <th scope="col" align="center">Due Date</th> </tr> <?php $start = $_GET['from_purchase_date']; $end = $_GET['to_purchase_date']; $mysqldfor = array(); $fromDateTS = strtotime($start); $toDateTS = strtotime($end); for ($currentDateTS = $fromDateTS; $currentDateTS <= $toDateTS; $currentDateTS += (60 * 60 * 24)) { $currentDateStr = date("Y-m-d",$currentDateTS); $mysqldfor[] = $currentDateStr; } function dateconvert($date,$func) { if ($func == 2){ //output conversion list($year, $month, $day) = explode('-', $date); $date = "$day-$month-$year"; return $date; } } for($b = 0; $b < count($mysqldfor); $b++) { $gett = mysql_query("SELECT * FROM stock_entries where date between '".$mysqldfor[$b]."' and '".$mysqldfor[$b]."' "); if(!$gett) die(mysql_error()); while($dsa = mysql_fetch_array($gett)) { ?> <tr><td align="center"><?php echo $dsa['billnumber']; ?></td> <td align="center"><?php echo $dsa['stock_supplier_name']; ?></td> <td align="center"><?php echo $dsa['quantity']; ?></td> <td align="center"><?php echo $dsa['cost_price']; ?></td> <td align="center"><?php echo $dsa['total']; ?></td> <td align="center"><?php echo $dsa['payment']; ?></td> <td align="center"><?php echo $dsa['balance']; ?></td> <td align="center"><?php echo $newdate=dateconvert($dsa['date'],2)."<br/>";?></td> <td align="center"><?php echo $newdue=dateconvert($dsa['due'],2)."<br/>";?></td> </tr> <?php } } //closing for loop ?> </table> <a href="download.php">download</a> <?php } else echo "No from and to dates"; ?> </body> </html>
download.php
<?php ob_start(); require('WriteHTML.php'); $pdf=new PDF_HTML(); $pdf->AddPage(); $pdf->SetFont('Arial'); $pdf->WriteHTML('<html> <body> <b>Purchase Report</b></div> <hr/> From : 9-3-2012 To : 12-3-2012 <hr/> <table border="0" cellspacing="0" cellpadding="0"> <tr> <th scope="col" align="center">Bill Number</th> <th scope="col" align="center">Supplier Name</th> <th scope="col" align="center">Quantity</th> <th scope="col" align="center">Cost Price</th> <th scope="col" align="center">Rate</th> <th scope="col" align="center">Paid</th> <th scope="col" align="center">Balance</th> <th scope="col" align="center">Date</th> <th scope="col" align="center">Due Date</th> </tr> <tr><td align="center">BN10007</td> <td align="center">xyz</td> <td align="center">5</td> <td align="center">10.00</td> <td align="center">50.00</td> <td align="center">0.00</td> <td align="center">50.00</td> <td align="center">09-03-2012<br/></td> <td align="center">09-03-2012<br/></td> </tr> </table>'); $pdf->Output("sample.pdf",'D'); ob_end_flush(); ?>
-
time validation for text box
valid time in 24 hours format with no seconds
my textboxes have same name and id with array
i am alerting the text box value onblur.It shows only the first text box value
I want to alert for every text box if value is not a number
How?
<?php session_start(); if (!$_SESSION['uname']) header("Location:login.php"); ?> <html><head><title>Attendance sheet</title> <link rel="stylesheet" href="att_style.css" type="text/css" > <script type="text/javascript"> /*function IsNumber() { var intime = document.myForm.in_time[].value; if(intime == "") { //var pt = /^[0-9]* $/; alert("dfsd"); } } */ function IsNumber(strAlert) { //alert("mdv"); //alert(strAlert); var txtb = document.getElementById('in_time[]').value; //for (var i = 0; i < txtb.length; i++) { //var txtv = txtb[i].value; alert(txtb); //} } /* for ( var i=0; i < txtb.length; i++) { if(txtb.charAt(i)!="" ) { if( strFieldValue.charAt(i) < "0" || strFieldValue.charAt(i) > "9") { if(strAlert != "")alert(strAlert) return false; } } } return true; }*/ </script> </head> <body> <?php $cnn = mysql_connect("localhost","root",""); mysql_select_db("time_sheet",$cnn); $dbdate = mysql_query("SELECT start_mon,end_mon FROM admin"); $dd = mysql_fetch_array($dbdate); $curmon = getdate(); $nextmonth = $curmon['mon'] + 1; $start = "2012" . "-" . $curmon['mon'] ."-". $dd['start_mon']; $end = "2012" . "-". $nextmonth ."-". $dd['end_mon']; $_SESSION['fromdate'] = $start; $_SESSION['todate'] = $end; $dateMonthYearArr = array(); $fromDateTS = strtotime($start); $toDateTS = strtotime($end); for ($currentDateTS = $fromDateTS; $currentDateTS <= $toDateTS; $currentDateTS += (60 * 60 * 24)) { $currentDateStr = date("M d",$currentDateTS); $notmysql[] = $currentDateStr; $currmysql = date("Y-m-d",$currentDateTS); $mysqlfor[] = $currmysql; } echo " No of days: " . count($mysqlfor); //Table for view if (isset($_REQUEST['sub'])) { $inti = $_POST['in_time']; $outi = $_POST['out_time']; $intime = serialize($inti); $outtime = serialize($outi); $inser = unserialize($intime); $outser = unserialize($outtime); $dbdate = mysql_query("SELECT start_mon,end_mon FROM admin"); $dd = mysql_fetch_array($dbdate); $curmon = getdate(); $nextmonth = $curmon['mon'] + 1; $dateMonthYearArr = array(); $fromDateTS = strtotime($start); $toDateTS = strtotime($end); for($b = 0; $b < count($mysqlfor); $b++) { $qry = mysql_query("SELECT * FROM timetable where date = '".$mysqlfor[$b]."' "); $ds = mysql_fetch_array($qry); if(!$qry) die(mysql_error()); $check = mysql_num_rows($qry); // print_r($inser); if($check == 0) { if($inser[$b] == "") $inser[$b] = '00:00'; if($outser[$b] == "") $outser[$b] = '00:00'; $ins = mysql_query("INSERT INTO timetable VALUES ('', '".$_SESSION['uname']."', '".$mysqlfor[$b]."', '".$inser[$b]."', '".$outser[$b]."', '') "); } else { //print_r($mysqlfor[$b]); $upd = mysql_query("UPDATE `timetable` SET `in` = '".$inser[$b]."', `out` = '".$outser[$b]."' WHERE `date` = '".$mysqlfor[$b]."' "); if(!$upd) die(mysql_error()); } } } ?> <form name="myForm" method="post" action=""> <table border="1" cellspacing="0" cellpadding="2"> <tr><th scope="row">DATE</th> <?php for ($s = 0; $s < 10; $s++) { ?> <td align="center"><?php print_r($notmysql[$s]); } ?></td></tr> <tr><th scope="row">IN</th> <?php for ($ss = 0; $ss < 10; $ss++) { ///////////////getting from DB $sele = mysql_query("SELECT * FROM timetable where date = '".$mysqlfor[$ss]."' "); $emp = mysql_num_rows($sele); ?> <td align="center"> <?php $numrows = mysql_num_rows($sele); if($numrows == 0) { ?> <input name="in_time[]" id="in_time[]" type="text" onBlur="IsNumber();" size="5"> </td> <?php } else { while($row1 = mysql_fetch_array($sele)) { ?> <input name="in_time[]" id="in_time[]" type="text" onBlur="IsNumber();" value="<?php echo $row1['in']; ?>" size="5"></td> <?php } } }?> </tr> <tr><th scope="row">OUT</th> <?php for ($v = 0; $v < 10; $v++) { ?> <td align="center"> <?php $sel2 = mysql_query("SELECT * FROM timetable where date = '".$mysqlfor[$v]."'"); $numrows = mysql_num_rows($sel2); if($numrows == 0) { ?> <input name="out_time[]" id="out_time[]" type="text" size="5"></td> <?php } else { while($row2 = mysql_fetch_array($sel2)) { ?> <input name="out_time[]" id="out_time[]" type="text" onBlur="IsNumber();" value="<?php echo $row2['out']; ?>" size="5"></td> <?php } } }?> </tr> <tr><th scope="row">Late</th><?php for ($s = 0; $s < 10; $s++) { ?> <td align="center"><input name="late_time[]" id="late_time[]" onBlur="IsNumber();" type="text" size="5"></td> <?php }?> </tr> </table> <br><br> <!-- second tab--> <?php if(count($notmysql) >= 11) { ?> <table border="1" cellspacing="0" cellpadding="2"><tr><th scope="row">DATE</th> <?php for ($st = 10; $st < 20; $st++) { ?> <td align="center"><?php print_r($notmysql[$st]); ?></td> <?php } ?></tr> <tr><th scope="row">IN</th> <?php for ($g = 10; $g < 20; $g++) { $selec = mysql_query("SELECT * FROM timetable where date = '".$mysqlfor[$g]."'"); $numrows = mysql_num_rows($selec); ?> <td align="center"> <?php if($numrows == 0) { ?> <input name="in_time[]" id="in_time[]" type="text" onBlur="IsNumber();" size="5"></td> <?php } else { while($secinrow = mysql_fetch_array($selec)) { ?> <input name="in_time[]" id="in_time[]" value="<?php echo $secinrow['in']; ?>" onBlur="IsNumber();" type="text" size="5"></td> <?php } } }?></tr> <tr><th scope="row">OUT</th> <?php for ($h = 10; $h < 20; $h++) { $select = mysql_query("SELECT * FROM timetable where date = '".$mysqlfor[$h]."'"); ?> <td align="center"> <?php $numrows = mysql_num_rows($select); if($numrows == 0) {?> <input name="out_time[]" id="out_time[]" type="text" onBlur="IsNumber();" size="5"></td> <?php } else { while($secoutrow = mysql_fetch_array($select)) { ?> <input name="out_time[]" id="out_time[]" type="text" onBlur="IsNumber();" value="<?php echo $secoutrow['out']; ?>" size="5"></td> <?php } } }?></tr> <tr><th scope="row">Late</th> <?php for ($m = 10; $m < 20; $m++) { ?> <td align="center"><input name="late_time[]" id="out_time[]" onBlur="IsNumber();" type="text" size="5"></td> <?php } ?> </tr> </table> <?php } ?> <br/><br/> <!-- Third table--> <?php if(count($notmysql) >= 21) { ?> <table border="1" cellspacing="0" cellpadding="2"> <tr> <th scope="row">DATE</th> <?php for ($tt = 20; $tt < count($notmysql); $tt++) { ?> <td align="center"><?php print_r($notmysql[$tt]); ?></td><?php } ?> </tr> <tr><th scope="row">IN</th> <?php for ($j = 20; $j < count($notmysql); $j++) { $selected = mysql_query("SELECT * FROM timetable where date = '".$mysqlfor[$j]."' "); ?> <td align="center"> <?php $numrows = mysql_num_rows($selected); if($numrows == 0) {?> <input name="in_time[]" id="in_time[]" type="text" onBlur="IsNumber();" size="5"></td> <?php } else { while($treinrow = mysql_fetch_array($selected)) { ?> <input name="in_time[]" id="in_time[]" type="text" onBlur="IsNumber();" value="<?php echo $treinrow['in']; ?>" size="5"></td> <?php } } } ?> </tr> <tr><th scope="row">OUT</th> <?php for ($k = 20; $k < count($notmysql); $k++) { $selectedr = mysql_query("SELECT * FROM timetable where date = '".$mysqlfor[$k]."'"); $numrows = mysql_num_rows($selectedr); ?> <td align="center"> <?php if($numrows == 0) { ?> <input name="out_time[]" id="out_time[]" type="text" onBlur="IsNumber();" size="5"></td> <?php } else { while($treoutrow = mysql_fetch_array($selectedr)) { ?> <input name="out_time[]" id="out_time[]" onBlur="IsNumber();" value="<?php echo $treoutrow['out']; ?>" type="text" size="5"></td> <?php } } } ?> </tr> <tr><th scope="row">Late</th> <?php for ($s = 20; $s < count($notmysql); $s++) { ?> <td align="center"> <input name="late_times[]" id="late_times[]" type="text" value="<?php ?>" size="5"></td> <?php } ?> </tr> </table> <?php } ?> <!--Table End --> <a style="float:right" href="logout.php">Logout</a> <p align="center"><input name="sub" type="submit" value="Save"></p> </form> </body> </html>
-
how to store all txt box value and corresponding dates to DB
<?php session_start(); if (!$_SESSION['uname']) { header("Location:login.php"); } ?> <html><head><title>Attendance sheet</title> <link rel="stylesheet" href="att_style.css" type="text/css" > <script src="datetimepicker.js"> </script> </head> <body> <form method="post" action=""> <label for="range_start">Start range:</label> <input name="from" id="frm_date" type="text"> <a href="javascript:NewCal('frm_date','ddmmyyyy')"><img src="cal.gif" alt="pick a date"></a> <label for="range_end">End range:</label> <input name="to" id="dpk" type="text" > <a href="javascript:NewCal('dpk','ddmmyyyy')"><img src="cal.gif" alt="pick a date"></a> <input name="date_but" type="submit" value="Go"> <a style="float:right" href="logout.php">Logout</a> </form> <br/><br/> <?php if (isset($_REQUEST['date_but'])) { //If go is clicked $fromDate = $_REQUEST['from']; $toDate = $_REQUEST['to']; $dateMonthYearArr = array(); $fromDateTS = strtotime($fromDate); $toDateTS = strtotime($toDate); $newdmy = array(); for ($currentDateTS = $fromDateTS; $currentDateTS <= $toDateTS; $currentDateTS += (60 * 60 * 24)) { $currentDateStr = date("Y-m-d",$currentDateTS); $dateMonthYearArr[] = $currentDateStr; /* $newcurrDate = date("Y-m-d",$currentDateTS); $newdmy[] = $newcurrDate;*/ } //print_r($dateMonthYearArr); echo "No of days: " . count($dateMonthYearArr); //if() { ?> <form method="post" action="result.php"> <input name="hide_date" type="hidden" value="<?php print_r($dateMonthYearArr); ?>"/> <table border="1" cellspacing="0" cellpadding="2"> <tr> <th scope="row">DATE</th> <?php for ($i = 0; $i < 10; $i++) { if(!empty($dateMonthYearArr[$i])) { ?> <td align="center"> <?php print_r($dateMonthYearArr[$i]); ?> </td> <?php } } ?> </tr> <tr><th scope="row">IN</th> <?php for ($i = 0; $i < 10; $i++) { if(!empty($dateMonthYearArr[$i])) {?> <td align="center"><input name="in_time[]" id="in_time[]" type="text" size="5"></td> <?php } }?> </tr> <tr><th scope="row">OUT</th> <?php for ($i = 0; $i < 10; $i++) { if(!empty($dateMonthYearArr[$i])) {?> <td align="center"><input name="out_time[]" id="out_time[]" type="text" size="5"></td> <?php } }?> </tr> <tr><th scope="row">Late</th><?php for ($i = 0; $i < 10; $i++) { if(!empty($dateMonthYearArr[$i])) {?> <td align="center"><input name="late_time[]" id="late_time[]" type="text" size="5"></td> <?php } }?> </tr> </table> <?php //} ?> <br><br> <!-- second tab--> <?php if(count($dateMonthYearArr) >= 11) { ?> <table border="1" cellspacing="0" cellpadding="2"> <tr><th scope="row">DATE</th> <?php for ($i = 10; $i < 20; $i++) { if(!empty($dateMonthYearArr[$i])) {?> <td align="center"><?php print_r($dateMonthYearArr[$i]); ?></td> <?php } } ?> </tr> <tr><th scope="row">IN</th> <?php for ($i = 10; $i < 20; $i++) { if(!empty($dateMonthYearArr[$i])) {?> <td align="center"><input name="in_time2" id="in_time2" type="text" size="5"></td> <?php } }?> </tr> <tr><th scope="row">OUT</th> <?php for ($i = 10; $i < 20; $i++) { if(!empty($dateMonthYearArr[$i])) {?> <td align="center"><input name="out_time2" type="text" size="5"></td> <?php } }?> </tr> <tr><th scope="row">Late</th> <?php for ($i = 10; $i < 20; $i++) { if(!empty($dateMonthYearArr[$i])) {?> <td align="center"><input name="late_time2" type="text" size="5"></td> <?php } }?> </tr> </table> <?php } ?> <br/><br/> <!-- Third table--> <?php if(count($dateMonthYearArr) > 21) { ?> <table border="1" cellspacing="0" cellpadding="2"> <tr> <th scope="row">DATE</th> <?php for ($i = 20; $i < count($dateMonthYearArr); $i++) { if(!empty($dateMonthYearArr[$i])) {?> <td align="center"><?php print_r($dateMonthYearArr[$i]); ?></td><?php } }?> </tr> <tr><th scope="row">IN</th> <?php for ($i = 20; $i < count($dateMonthYearArr); $i++) { if(!empty($dateMonthYearArr[$i])) { }?> <td align="center"><input name="in_time3" type="text" size="5"></td> <?php } ?> </tr> <tr><th scope="row">OUT</th> <?php for ($i = 20; $i < count($dateMonthYearArr); $i++) { ?> <td align="center"><input name="out_time3" type="text" size="5"></td> <?php } ?> </tr> <tr><th scope="row">Late</th> <?php for ($i = 20; $i < count($dateMonthYearArr); $i++) { ?> <td align="center"><input name="late_time3" type="text" size="5"></td> <?php } ?> </tr> </table> <?php } ?> <br><br> <p align="center"><input name="sub" type="submit" value="Save"></p> </form> <?php } ?> </body> </html>
result.php
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Untitled Document</title> </head> <body> <?php session_start(); if (!$_SESSION['uname']) { header("Location:login.php"); } require("connect.php"); $in_time[] = mysql_real_escape_string(implode(" ",$_POST['in_time'])); $out_time[] = mysql_real_escape_string(implode(" ",$_POST['out_time'])); echo "In time: "; print_r($in_time); echo "<br>"."out time: "; print_r($out_time); $curdate = $_POST['hide_date']; print_r($curdate); foreach($curdate as $key=>$val) { print_r($val); } $ins = mysql_query("INSERT INTO timetable VALUES ('', '".$_SESSION['uname']."', '".$val."', '".$in_time."', '".$out_time."', '') "); ?> </body> </html>
-
Two question? 1. When i click 'Go' , how to fill DATE row all dates of the date range in the two text box
2. how to keep textbox for all IN and OUT row
wen i click 'submit' the in out textbox must saved to DB
First help for 1st qustn
<?php session_start(); if (!$_SESSION['uname']) { header("Location:login.php"); } ?> <html><head><title>Attendance sheet</title> <link rel="stylesheet" href="att_style.css" type="text/css" > <script src="datetimepicker.js"> </script> <script type="text/javascript"> function IsNumber(strFieldValue, size, strAlert) { for ( var i=0; i < size; i++) { if(strFieldValue.charAt(i)!="" ) { if( strFieldValue.charAt(i) < "0" || strFieldValue.charAt(i) > "9") { if(strAlert != "")alert(strAlert) return false; } } } return true; } function IsValidTime(timeStr) { var timePat = /^(\d{1,2})\d{2})(\d{2}))?(\s?(AM|am|PM|pm))?$/; var matchArray = timeStr.match(timePat); if (matchArray == null) { alert("Time is not in a valid format."); return false; } hour = matchArray[1]; minute = matchArray[2]; second = matchArray[4]; ampm = matchArray[6]; if (second=="") { second = null; } if (ampm=="") { ampm = null } if (hour < 0 || hour > 23) { alert("Hour must be between 1 and 12. (or 0 and 23 for military time)"); return false; } if (hour <= 12 && ampm == null) { if (confirm("Please indicate which time format you are using. OK = Standard Time, CANCEL = Military Time")) { alert("You must specify AM or PM."); return false; } } if (hour > 12 && ampm != null) { alert("You can't specify AM or PM for military time."); return false; } if (minute<0 || minute > 59) { alert ("Minute must be between 0 and 59."); return false; } if (second != null && (second < 0 || second > 59)) { alert ("Second must be between 0 and 59."); return false; } return false; } </script> </head> <body> <form name="timeform" method="post" action="" > <label for="range_start">Start range:</label> <input name="from" id="frm_date" type="text" > <a href="javascript:NewCal('frm_date','ddmmyyyy')"><img src="cal.gif" alt="pick a date"></a> <label for="range_end">End range:</label> <input name="to" id="dpk" type="text" > <a href="javascript:NewCal('dpk','ddmmyyyy')"><img src="cal.gif" alt="pick a date"></a> <input name="date_but" type="submit" value="Go"> <a style="float:right" href="logout.php">Logout</a> <br/><br/> <?php if (isset($_REQUEST['date_but'])) { $fromDate = $_REQUEST['from']; $toDate = $_REQUEST['to']; $dateMonthYearArr = array(); $fromDateTS = strtotime($fromDate); $toDateTS = strtotime($toDate); for ($currentDateTS = $fromDateTS; $currentDateTS <= $toDateTS; $currentDateTS += (60 * 60 * 24)) { $currentDateStr = date("d-M-Y",$currentDateTS); $dateMonthYearArr[] = $currentDateStr; php } echo "No of days: " . count($dateMonthYearArr); ?> <table border="1" cellspacing="0" cellpadding="5" align="center"> <tr> <th scope="row">DATE</th> <div class="dat_row"> <td><?php print_r($dateMonthYearArr[0]); ?></td> <td><?php echo $dateMonthYearArr[1]; ?></td> <td><?php echo $dateMonthYearArr[2]; ?></td> <td><?php echo $dateMonthYearArr[3]; ?></td> </div> </tr> <tr> <th scope="row">IN</th> <td><input name="time" type="text" ></td> <td><input name="r2_in" type="text" ></td> <td><input name="r2_in" type="text" ></td> </tr> <tr> <th scope="row">OUT</th> <td><input name="time" type="text"></td> <td> </td> <td> </td> </tr> <tr> <th scope="row">Leave</th> <td> </td> <td> </td> <td> </td> </tr> </table><br/><br/> <input name="submit" type="submit" onClick="IsValidTime(document.timeform.time.value);" value="Submit"> <?php } ?> </form> </body> </html>
-
how to keep each date in the DATE row
-
Keep the dates in DATE row after i click 'go'
It must aligned correct for every month
<?php session_start(); if (!$_SESSION['uname']) { header("Location:login.php"); } ?> <html><head><title>Attendance sheet</title> <script src="datetimepicker.js"> </script> </head> <body> <form method="post" action="" > <label for="range_start">Start range:</label> <input name="from" id="frm_date" type="text" > <a href="javascript:NewCal('frm_date','ddmmyyyy')"><img src="cal.gif" alt="pick a date"></a> <label for="range_end">End range:</label> <input name="to" id="dpk" type="text" > <a href="javascript:NewCal('dpk','ddmmyyyy')"><img src="cal.gif" alt="pick a date"></a> <input name="submit" type="submit" value="Go"> <a style="float:right" href="logout.php">Logout</a> <br/><br/> <?php if (isset($_REQUEST['submit'])) { $fromDate = $_REQUEST['from']; $toDate = $_REQUEST['to']; $dateMonthYearArr = array(); $fromDateTS = strtotime($fromDate); $toDateTS = strtotime($toDate); for ($currentDateTS = $fromDateTS; $currentDateTS <= $toDateTS; $currentDateTS += (60 * 60 * 24)) { // use date() and $currentDateTS to format the dates in between $currentDateStr = date("d-M-Y",$currentDateTS); $dateMonthYearArr[] = $currentDateStr; //print $currentDateStr.”<br />”; } echo "<pre>"; print_r($dateMonthYearArr); echo "</pre>"; /* for($dateMonthYearArr = $fromDateTS; $dateMonthYearArr<=$toDate; $dateMonthYearArr++) { print_r($dateMonthYearArr); } */?> <table width="100%" border="1" cellspacing="0" cellpadding="0"> <tr> <th scope="row">DATE</th> <td> <?php print_r($dateMonthYearArr[]); ?></td> <td> <?php //echo $dateMonthYearArr[1]; ?></td> <td> <?php //echo $dateMonthYearArr[2]; ?></td> </tr> <tr> <th scope="row">IN</th> <td> </td> <td> </td> <td> </td> </tr> <tr> <th scope="row">OUT</th> <td> </td> <td> </td> <td> </td> </tr> <tr> <th scope="row">Leave</th> <td> </td> <td> </td> <td> </td> </tr> </table> <?php } ?> </form> </body> </html>
edit form is not updating its add as new row
in Frameworks
Posted · Edited by mdvignesh
edit action in my controller
in my contacts table I'm having 'c_id' instead of 'id'
I also add this public $primaryKey = 'c_id' in Contact.php model file
But still I get
column not found unknown column contact.id in where clause