Jump to content

Tje

Members
  • Posts

    20
  • Joined

  • Last visited

Everything posted by Tje

  1. i've use php-event-calender for showing event from table.when i click on event date, it's dispay table details for relevent date correctly in localhost.but it's didn't show details in live server. index.php <div id="Calendar"> </div> <div id="Events"> </div> <script language="javascript" src="calendar.js"></script> calender.php <?php error_reporting(0); include("config.php"); /// get current month and year and store them in $cMonth and $cYear variables (intval($_REQUEST["month"])>0) ? $cMonth = intval($_REQUEST["month"]) : $cMonth = date("m"); (intval($_REQUEST["year"])>0) ? $cYear = intval($_REQUEST["year"]) : $cYear = date("Y"); // generate an array with all dates with events $sql = "SELECT * FROM reservation WHERE arrival LIKE '".$cYear."-".$cMonth."-%'"; $result = db::getInstance()->query($sql); while ($row = $result->fetch()) { $events[$row["arrival"]]["f_name"] = $row["f_name"]; $events[$row["arrival"]]["l_name"] = $row["l_name"]; } // calculate next and prev month and year used for next / prev month navigation links and store them in respective variables $prev_year = $cYear; $next_year = $cYear; $prev_month = intval($cMonth)-1; $next_month = intval($cMonth)+1; // if current month is December or January month navigation links have to be updated to point to next / prev years if ($cMonth == 12 ) { $next_month = 1; $next_year = $cYear + 1; } elseif ($cMonth == 1 ) { $prev_month = 12; $prev_year = $cYear - 1; } if ($prev_month<10) $prev_month = '0'.$prev_month; if ($next_month<10) $next_month = '0'.$next_month; ?> <table width="100%" style="width:800px;height:600px;background-color:#FFFFFF;"> <tr> <td class="mNav"><a href="javascript:LoadMonth('<?php echo $prev_month; ?>', '<?php echo $prev_year; ?>')"><<</a></td> <td colspan="5" class="cMonth"><?php echo date("F, Y",strtotime($cYear."-".$cMonth."-01")); ?></td> <td class="mNav"><a href="javascript:LoadMonth('<?php echo $next_month; ?>', '<?php echo $next_year; ?>')">>></a></td> </tr> <tr> <td class="wDays">M</td> <td class="wDays">T</td> <td class="wDays">W</td> <td class="wDays">T</td> <td class="wDays">F</td> <td class="wDays">S</td> <td class="wDays">S</td> </tr> <?php $first_day_timestamp = mktime(0,0,0,$cMonth,1,$cYear); // time stamp for first day of the month used to calculate $maxday = date("t",$first_day_timestamp); // number of days in current month $thismonth = getdate($first_day_timestamp); // find out which day of the week the first date of the month is $startday = $thismonth['wday'] - 1; // 0 is for Sunday and as we want week to start on Mon we subtract 1 for ($i=0; $i<($maxday+$startday); $i++) { if (($i % 7) == 0 ) echo "<tr>"; if ($i < $startday) { echo "<td> </td>"; continue; }; $current_day = $i - $startday + 1; if ($current_day<10) $current_day = '0'.$current_day; // set css class name based on number of events for that day if ($events[$cYear."-".$cMonth."-".$current_day]<>'') { $css='withevent'; $click = "onclick=\"LoadEvents('".$cYear."-".$cMonth."-".$current_day."')\""; } else { $css='noevent'; $click = ''; } echo "<td class='".$css."'".$click.">". $current_day . "</td>"; if (($i % 7) == 6 ) echo "</tr>"; } ?> </table> events.php <?php error_reporting(0); include("config.php"); $sql = "SELECT * FROM reservation WHERE arrival = '".mysql_real_escape_string($_REQUEST["date"])."' AND status='pending'"; $result = db::getInstance()->query($sql); while ($row = $result->fetch()) { echo "<h2>"."Reservation ID :"." ".$row["res_id"]."</h2>"; echo "<b>"."Client Name :"."</b>"."<span>".$row["f_name"]." ".$row["l_name"]."</span>"."</br>"; echo "<b>"."Address :"."</b>"."<span>".$row["address"]."</span>"."</br>"; echo "<b>"."City :"."</b>"."<span>".$row["city"]."</span>"."</br>"; echo "<b>"."Zip :"."</b>"."<span>".$row["zip"]."</span>"."</br>"; echo "<b>"."Country :"."</b>"."<span>".$row["country"]."</span>"."</br>"; echo "<b>"."E-mail :"."</b>"."<span>".$row["email"]."</span>"."</br>"; echo "<b>"."Contact No :"."</b>"."<span>".$row["contact"]."</span>"."</br>"; echo "<b>"."In Date :"."</b>"."<span>".$row["arrival"]."</span>"."</br>"; echo "<b>"."Out Date :"."</b>"."<span>".$row["departure"]."</span>"."</br>"; echo "<b>"."Total Price :"."</b>"."<span>".$row["tot_price"]."</span>"."</br>"; echo "<b>"."Room Id :"."</b>"."<span>".$row["room_id"]."</span>"."</br>"; echo "<b>"."No Of Beds :"."</b>"."<span>".$row["no_beds"]."</span>"."</br>"; } ?> live server show calender and event date fine.but didn't show event details for that date.it's show correctly in localserver.
  2. i checked my code with isset().but same happen.i click on checkbox1,checkbox2 and submit.it's insert to g1 and g2.when i click on checkbox 4, checkbox8 its also added to g1 and g2.like add_service.jpg
  3. I have displayed check box values(ugroup field) from ugroups table.now what i want to do is,when user select multiple check boxes and submit it should be insert into relavent feild in table.now it's insert check boxes values.but not in relevant field.this is my code.Please help me. //select ugroup's from group table. <?php $result = "SELECT id,ugroup FROM group"; $res_result = db::getInstance()->query($result); ?> <form action="db_sql/db_add_page.php" method="get"> Tittle :<input type="text" size="100" name="tittle" /> Description :<textarea cols="80" id="editor1" name="description" rows="10"></textarea> //Display ugroups in textboxes and checkboxes <?php while( $line=$res_result->fetch(PDO::FETCH_ASSOC)) { echo '<input type="checkbox" name="group[]" value=" '. $line['ugroup'] .'" />'; echo'<input type="text" name="ugroup" disabled="disabled" value=" '. $line['ugroup'] .'" size="7" "/>'; echo ' '; } ?><input type="submit" value="Submit"> </form> db_add_page.php if(isset($_POST)) { $tittle = $_POST['tittle']; $description = $_POST['description']; $ugroup = $_POST['group']; $acc_status = "INSERT INTO add_services (id,tittle,description,g1,g2,g3,g4,g5,g6,g7,g8) VALUES(NULL,'".$tittle."','".$description."','".$ugroup[0]."','".$ugroup[1]."','".$ugroup[2]."',' ".$ugroup[3]."','".$ugroup[4]."','".$ugroup[5]."','".$ugroup[6]."','".$ugroup[7]."')"; $rate = db::getInstance()->exec($acc_status); if(!$rate){ echo '<script type="text/javascript">alert("Update Error !");</script>'; }else{ header('Location:../add_page.php'); echo '<script type="text/javascript">alert("Successfuly Updated User Group !");</script>'; } }
  4. Hi, I want to display row 0 row 2 row 3 and row 4 values in to text field.this is my code.but it's display "Undefined offset: 1 in C:\wamp\www\member\sys-admin\groups.php on line 15 ,Undefined offset: 2 in C:\wamp\www\member\sys-admin\groups.php on line 16 ,Undefined offset: 3 in C:\wamp\www\member\sys-admin\groups.php on line 17". <?php $r_sql = "SELECT ugroup FROM ugroups "; $r_result = db::getInstance()->query($r_sql); $row = $r_result->fetch(PDO::FETCH_NUM); $g1 = $row['0']; $g2 = $row[1]; $g3 = $row[2]; $g4 = $row[3]; ?> html <strong>G 1</strong><input name="g1" type="text" id="g1" style="width:300px;" value="<?php echo $g1; ?>" /> <strong>G 2</strong> <input name="g2" type="text" id="g2" style="width:300px;" value="<?php echo $g2; ?>" /> <strong>G 3</strong><input name="g3" type="text" id="g3" style="width:300px;" value="<?php echo $g3; ?>" /> <strong>G 4</strong><input name="g4" type="text" id="g4" style="width:300px;" value="<?php echo $g4; ?>" />
  5. hey, I've found a code for split to excel sheet.now how i integrate mysql table selection for this code? <?php require_once 'PHPExcel.php'; require_once 'PHPExcel/IOFactory.php'; // Create new PHPExcel object $objPHPExcel = new PHPExcel(); // Create a first sheet, representing sales data $objPHPExcel->setActiveSheetIndex(0); $objPHPExcel->getActiveSheet()->setCellValue('A1', 'Something'); // Rename sheet $objPHPExcel->getActiveSheet()->setTitle('Name of Sheet 1'); // Create a new worksheet, after the default sheet $objPHPExcel->createSheet(); // Add some data to the second sheet, resembling some different data types $objPHPExcel->setActiveSheetIndex(1); $objPHPExcel->getActiveSheet()->setCellValue('A1', 'More data'); // Rename 2nd sheet $objPHPExcel->getActiveSheet()->setTitle('Second sheet'); // Redirect output to a client’s web browser (Excel5) header('Content-Type: application/vnd.ms-excel'); header('Content-Disposition: attachment;filename="name_of_file.xls"'); header('Cache-Control: max-age=0'); $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5'); $objWriter->save('php://output'); ?>
  6. #moderator It's work fine .but i want to open second table values in new worksheet.like below image
  7. I have a PHP code to download one mysql table to excel sheet.what i want to do is download 2 tables in to same excel sheet.those tables are should be in different excel worksheet.please help me. this code work fine.it's download one table <?php ob_start(); session_start(); include('dbconnection.php'); $usr= $_SESSION['fname']; header('Content-Type: text/csv'); header('Content-Disposition: attachment;filename=exported-data.csv'); $select_table=mysql_query("select * from regfarmer WHERE ffname='$usr'"); $rows = mysql_fetch_assoc($select_table); if ($rows) { getcsv(array_keys($rows)); } while($rows) { getcsv($rows); $rows = mysql_fetch_assoc($select_table); } function getcsv($no_of_field_names) { $separate = ''; foreach ($no_of_field_names as $field_name) { if (preg_match('/\\r|\\n|,|"/', $field_name)) { $field_name = '' . str_replace('', $field_name) . ''; } echo $separate . $field_name; $separate = ','; } echo "\r\n"; } ?>
  8. I'm new to PHP.can someone fix this for me??please
  9. Hi, I'm trying to insert calculate values to DB.this is my code <?php require('dbconnection.php'); $a=$_POST['a']; $b=$_POST['b']; class cal{ public function insert($a,$b){ if((($a)&&($b))!="") { $c=$a*$b; $sql = "INSERT INTO cropplant (sbetweenQ ,sbetweenC ,sbetweenTC ) VALUES ('$a', '$b', '$c')"; $query = mysql_query($sql); if(!$query) { echo '<script type="text/javascript">alert("DB Update error ! please Re-enter your details.");</script>'; }else { echo '<script type="text/javascript">alert("New Cropplant Added Successfuly.");</script>'; } }else{ echo"please enter all"; } } } ?> what is the error in this code.please help
  10. Hi, this is my javascript code.i'm trying to validate input date.but this form submit when entering wrong date format. function Validatedate() { var chkdate = document.getElementById("fbdy").value if(document.getElementById("fbdy").value == "") { alert("Please enter the Date..!!") if(chkdate.match(/^[0-9]{4}\-(0[1-9]|1[012])\-(0[1-9]|[12][0-9]|3[01])/)) { alert('date format is correct'); } else { alert("date format is wrong") } return false } else{ return true } } <form> <input type="text" id="fbdy" name="fbdy"/> <input type="submit" value="Register" onclick="Validatedate()" /> <form> please help me
  11. Hi, in my code radio button disable when passing value is "0" <script type="text/javascript"> $('input[type="radio"]').prop('disable', function() { return $(this).next().text().match(/\((\d+)\)/)[1] == 0; }); </script> it's ok.what i want to do is,color a label or label text when this function true. <label > <input type="radio" name="radio" id="rd" value="" /> Click </label> please help me
  12. This is admin panel function(manage users).Every registered users names are display in this table.When click this show button it's open pop-up.i want to display all the user details in this pop-up. --this is my php table -- $connect = mysql_connect("localhost","root",""); if(!$connect){echo("<script>alert('DBMS connection error');</script>");} if(!mysql_select_db("biz", $connect)){echo("<script>alert('Unable to find DB');</script>>");} echo "test"; $result = mysql_query("SELECT yname FROM reg"); mysql_close($connect); while($row=mysql_fetch_array($result)) { echo '<tr class="odd gradeX"> <td>'.$row["yname"].'</td> <td><input type="image" src="images/view.png" width="40" height="40" name="view" id="view" class="center" data-toggle="modal" value="show" data-target="#signin1"/></td> </tr>'; } echo '</table>'; this is user details pop-up... $connect = mysql_connect("localhost","root",""); if(!$connect){echo("<script>alert('DBMS connection error');</script>>");} if(!mysql_select_db("biz", $connect)){echo("<script>alert('Unable to find DB');</script>>");} $result1 = mysql_query("SELECT radio,yname,mail,cpw,tp,city FROM reg WHERE mail='SSS@SSS.SS'"); $row1 = mysql_fetch_assoc($result1); mysql_close($connect); <form id="form1"> User Type :Business Name :<?php echo $row1['yname'] ?> Email Address :abc@gmail.com Password :xxxxxx </form> (only name come from DB.others are still hard code).please help
  13. I'm trying to display relevant user details when click after user details button.it is css pop up window.i want to know how to catch relevant user when click the button.my primary key is email. $connect = mysql_connect("localhost","root",""); if(!$connect){echo("<script>alert('DBMS connection error');</script>>");} if(!mysql_select_db("biz", $connect)){echo("<script>alert('Unable to find DB');</script>>");} $result1 = mysql_query("SELECT radio,yname,mail,cpw,tp,city FROM reg WHERE mail='SSS@SSS.SS'"); $row1 = mysql_fetch_assoc($result1); mysql_close($connect); <form class="form-signin" role="form"> User Type :Business Name : <?php echo $row1['yname'] ?> Email Address :abc@gmail.com Password :xxxxxx Telephone no :0777777777 </form> this is what i did.Now it's display same name(kasun) for every users details. please help.
  14. Hi, I'm trying to display a message first before redirect to other page, but my code just directly redirect the page without display the message.please help me. if($num_rows == 0) { echo '<script type="text/javascript">alert("Please Enter Correct Details!");</script>'; header ('Location :login.php'); }
  15. what i really want to do is when user click this remind me check box,system should be remind his email and password 1hour.please help me
  16. Hi, My login form is running correctly.i want to add remind me function.please help me. <form class="form-signin" role="form" id="form1" method="post" action="log.php"> <h2 class="form-signin-heading text-center bluetxt">Sign In</h2> <input type="text" id="email1" class="form-control" name="email1" placeholder="Email address" autofocus /><br /> <input type="text" id="pwd1" class="form-control" name="pwd1" placeholder="Password" value=""/><br/> <label class="checkbox"> <input type="checkbox" value="remember" name="remember"> Remember me </label> <input type="submit" value="Login" onclick="ValidationLog()" style="color:#FFF;" class="btn btn-lg btn-primary btn-block"/> </form> <?php $mail = $_POST['email1']; $pwd = $_POST['pwd1']; $con = mysql_connect("localhost","root",""); if(!$con) { die('Could not connect:'.mysql_error()); } mysql_select_db("biz",$con); if((($mail)&&($pwd))==""){ header( 'Location:index.php' ); }else{ $result = mysql_query("SELECT mail,pw FROM reg WHERE mail = '$mail' AND pw = '$pwd'"); $num_rows = mysql_num_rows($result); mysql_close($con); if($num_rows == 0) { } else{ header( 'Location:user/' ); } } ?>
  17. Thanks...It's working
  18. Thanks.it's work.. i use $_SESSION['mail'] from loggin..
  19. Hi, i'm trying to doing update all table values(name,tel no,country,state,city) without email. using already logged user email(where clase).please help me. php <?php $con=mysqli_connect("localhost","root","","biz"); if (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); } $rd=$_POST['optionsRadiosInline']; $Yname=$_POST['name']; $tp=$_POST['telephone']; $scntry=$_POST['country']; $st=$_POST['state']; $cty=$_POST['city']; if($Yname==""){ header('Location :profile.php'); }else{ echo $st; echo $cty; $result=mysql_query($con,"SELECT mail FROM reg "); $num_rows = mysql_num_rows($result); $row = mysql_fetch_assoc($result); $mail = $row['mail']; if($result){ mysqli_query($con,"UPDATE reg SET radio='$rd',yname='$Yname',tp='$tp',cntry='$scntry',state='$st',city='$cty' WHERE mail='$mail'"); header( 'Location:index.php' ); }else{ echo "first query error"; } } mysqli_close($con); ?> html <form id="form2" method="post" action="up_user.php"> <div class="form-group"> <label class="radio-inline"> <input type="radio" name="optionsRadiosInline" id="optionsRadiosInline1" value="Private" checked=""> Private </label> <label class="radio-inline"> <input type="radio" name="optionsRadiosInline" id="optionsRadiosInline2" value="Business"> Business </label> </div> <label class="">Name</label> <input type="text" class="form-control" placeholder="Your Name" required autofocus name="name" id="name"><br/> <!-- <label class="">Email</label> <input type="email" class="form-control" placeholder="Email address" required name="email" id="email" ><br/>--> <label class="">Telephone Number</label> <input type="text" class="form-control" pattern="\d+" placeholder="Telephone" name="telephone" required name="telephone" id="telephone"><br/> <label>Select Country</label> <select id="country" name="country" onChange="load_options(this.value,'state');"> <option value="">Select country</option> </select> &nbsp <label>Select State</label> <select id="state" name="state" onChange="load_options(this.value,'city');"> <option value="">Select state</option> </select> <label>Select city</label> <select id="city" name="city"> <option value="">Select City</option> </select> <img src="loader.gif" id="loading" align="absmiddle" style="display:none;"/> <br/> <div class="row"> <div class="col-md-4 col-md-offset-4"> <button class="btn btn-lg btn-primary btn-block" type="submit">Update Information</button> </div> </div> </form>
  20. Hi, i'm trying to display db(name,email,telephone no) values in textbox.please help me. ::HTML part:: <form class="form-signin" role="form" id="form1" action="post_user.php"> <label class="">Name</label> <input type="text" class="form-control" placeholder="Your Name" value="" required name="yname" id="yname" autofocus ><br/> <label class="">Email</label> <input type="text" class="form-control" name="email" id="email" placeholder="Email address" required > <br/> <label class="">Telephone Number</label> <input type="text" class="form-control" pattern="\d+" placeholder="Telephone" name="telephone" required><br/> <div class="col-md-4 col-md-offset-4"> <button class="btn btn-lg btn-primary btn-block" type="submit">Submit Ad</button> </div> </form> ::post_user.php:: <?php $con = mysql_connect("localhost","root",""); if(!$con) { die('Could not connect:'.mysql_error()); } mysql_select_db("biz",$con); $mail=$_POST['email']; $query = mysql_query("SELECT yname,mail,tp FROM reg WHERE mail = '$mail' "); while($row = mysql_fetch_array($query)) { echo $row['yname']; echo $row['mail']; echo $row['tp']; } mysql_close($con); ?>
×
×
  • 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.