Jump to content

miz_luvly@hotmail.com

Members
  • Posts

    41
  • Joined

  • Last visited

    Never

Everything posted by miz_luvly@hotmail.com

  1. Hi thanks guyz, I have managed to find the solution from dynamicdrive website. Once again thanks for your help.
  2. I have got a code which open links in the same window. Can someone tell me how to open links in a new window in the script below. Thanks in advance <script type="text/javascript"> <script type="text/javascript"> // 7 variables to control behavior var Car_Image_Width=140; var Car_Image_Height=225; var Car_Border=true; // true or false var Car_Border_Color="white"; var Car_Speed=4; var Car_Direction=true; // true or false var Car_NoOfSides=8; // must be 4, 6, 8 or 12 /* array to specify images and optional links. For 4 sided carousel specify at least 2 images For 6 sided carousel specify at least 3 For 8 sided carousel specify at least 4 For 12 sided carousel specify at least 6 If Link is not needed keep it "" */ Car_Image_Sources=new Array( "photo1.jpg","http://www.dynamicdrive.com", "photo2.jpg","http://www.javascriptkit.com", "photo3.jpg","", //this slide isn't linked "photo4.jpg","http://www.codingforums.com" // NOTE No comma after last line ); CW_I=new Array(Car_NoOfSides/2+1);C_ClcW=new Array(Car_NoOfSides/2); C_Coef=new Array( 3*Math.PI/2,0,3*Math.PI/2,11*Math.PI/6,Math.PI/6,3*Math.PI/2,7*Math.PI/4, 0, Math.PI/4,3*Math.PI/2,5*Math.PI/3,11*Math.PI/6,0,Math.PI/6,Math.PI/3); var C_CoefOf=Car_NoOfSides==4?0:Car_NoOfSides==6?2:Car_NoOfSides==8?5:9; C_Pre_Img=new Array(Car_Image_Sources.length); var C_Angle=Car_Direction?Math.PI/(Car_NoOfSides/2):0,C_CrImg=Car_NoOfSides,C_MaxW,C_TotalW, C_Stppd=false,i,C_LeftOffset,C_HalfNo=Car_NoOfSides/2; function Carousel(){ if(document.getElementById){ for(i=0;i<Car_Image_Sources.length;i+=2){ C_Pre_Img[i]=new Image();C_Pre_Img[i].src=Car_Image_Sources[i]} C_MaxW=Car_Image_Width/Math.sin(Math.PI/Car_NoOfSides)+C_HalfNo+1; Car_Div=document.getElementById("Carousel"); for(i=0;i<C_HalfNo;i++){ CW_I[i]=document.createElement("img");Car_Div.appendChild(CW_I[i]); CW_I[i].style.position="absolute"; CW_I[i].style.top=0+"px"; CW_I[i].style.height=Car_Image_Height+"px"; if(Car_Border){ CW_I[i].style.borderStyle="solid"; CW_I[i].style.borderWidth=1+"px"; CW_I[i].style.borderColor=Car_Border_Color} CW_I[i].src=Car_Image_Sources[2*i]; CW_I[i].lnk=Car_Image_Sources[2*i+1]; CW_I[i].onclick=C_LdLnk; CW_I[i].onmouseover=C_Stp; CW_I[i].onmouseout=C_Rstrt} CarImages()}} function CarImages(){ if(!C_Stppd){ C_TotalW=0; for(i=0;i<C_HalfNo;i++){ C_ClcW[i]=Math.round(Math.cos(Math.abs(C_Coef[C_CoefOf+i]+C_Angle))*Car_Image_Width); C_TotalW+=C_ClcW[i]} C_LeftOffset=(C_MaxW-C_TotalW)/2; for(i=0;i<C_HalfNo;i++){ CW_I[i].style.left=C_LeftOffset+"px"; CW_I[i].style.width=C_ClcW[i]+"px"; C_LeftOffset+=C_ClcW[i]} C_Angle+=Car_Speed/720*Math.PI*(Car_Direction?-1:1); if((Car_Direction&&C_Angle<=0)||(!Car_Direction&&C_Angle>=Math.PI/C_HalfNo)){ if(C_CrImg==Car_Image_Sources.length)C_CrImg=0; if(Car_Direction){ CW_I[C_HalfNo]=CW_I[0]; for(i=0;i<C_HalfNo;i++)CW_I[i]=CW_I[i+1]; CW_I[C_HalfNo-1].src=Car_Image_Sources[C_CrImg]; CW_I[C_HalfNo-1].lnk=Car_Image_Sources[C_CrImg+1]} else{ for(i=C_HalfNo;i>0;i--)CW_I[i]=CW_I[i-1]; CW_I[0]=CW_I[C_HalfNo]; CW_I[0].src=Car_Image_Sources[C_CrImg]; CW_I[0].lnk=Car_Image_Sources[C_CrImg+1]} C_Angle=Car_Direction?Math.PI/C_HalfNo:0;C_CrImg+=2}} setTimeout("CarImages()",50)} function C_LdLnk(){if(this.lnk)window.location.href=this.lnk} function C_Stp(){this.style.cursor=this.lnk?"pointer":"default";C_Stppd=true;} function C_Rstrt(){C_Stppd=false} </script> <div id="Carousel" style="position:relative"> <img src="placeholder.gif" width="371" height="225"> </div> <p><font face="Arial" size="-2">Free DHTML scripts provided by<br><a href="http://www.dynamicdrive.com">Dynamic Drive</a></font></p> Create a div with transparent place holder in your html <div id="Carousel" style="position:relative"> <img src="placeholder.gif" width="404" height="202"> </div> placeholder width: 4 sided: 1.42 * carousel image width + 3 6 sided: 2 * carousel image width +4 8 sided: 2.62 * carousel image width + 5 12 sided: 3.87 * carousel image width + 7 placeholder height: carousel image height+2 Insert onload in body tag <body onload="Carousel()"> *********************************************************/ // 7 variables to control behavior var Car_Image_Width=140; var Car_Image_Height=225; var Car_Border=true; // true or false var Car_Border_Color="white"; var Car_Speed=4; var Car_Direction=true; // true or false var Car_NoOfSides=8; // must be 4, 6, 8 or 12 /* array to specify images and optional links. For 4 sided carousel specify at least 2 images For 6 sided carousel specify at least 3 For 8 sided carousel specify at least 4 For 12 sided carousel specify at least 6 If Link is not needed keep it "" */ Car_Image_Sources=new Array( "photo1.jpg","http://www.dynamicdrive.com", "photo2.jpg","http://www.javascriptkit.com", "photo3.jpg","", //this slide isn't linked "photo4.jpg","http://www.codingforums.com" // NOTE No comma after last line ); /***************** DO NOT EDIT BELOW **********************************/ CW_I=new Array(Car_NoOfSides/2+1);C_ClcW=new Array(Car_NoOfSides/2); C_Coef=new Array( 3*Math.PI/2,0,3*Math.PI/2,11*Math.PI/6,Math.PI/6,3*Math.PI/2,7*Math.PI/4, 0, Math.PI/4,3*Math.PI/2,5*Math.PI/3,11*Math.PI/6,0,Math.PI/6,Math.PI/3); var C_CoefOf=Car_NoOfSides==4?0:Car_NoOfSides==6?2:Car_NoOfSides==8?5:9; C_Pre_Img=new Array(Car_Image_Sources.length); var C_Angle=Car_Direction?Math.PI/(Car_NoOfSides/2):0,C_CrImg=Car_NoOfSides,C_MaxW,C_TotalW, C_Stppd=false,i,C_LeftOffset,C_HalfNo=Car_NoOfSides/2; function Carousel(){ if(document.getElementById){ for(i=0;i<Car_Image_Sources.length;i+=2){ C_Pre_Img[i]=new Image();C_Pre_Img[i].src=Car_Image_Sources[i]} C_MaxW=Car_Image_Width/Math.sin(Math.PI/Car_NoOfSides)+C_HalfNo+1; Car_Div=document.getElementById("Carousel"); for(i=0;i<C_HalfNo;i++){ CW_I[i]=document.createElement("img");Car_Div.appendChild(CW_I[i]); CW_I[i].style.position="absolute"; CW_I[i].style.top=0+"px"; CW_I[i].style.height=Car_Image_Height+"px"; if(Car_Border){ CW_I[i].style.borderStyle="solid"; CW_I[i].style.borderWidth=1+"px"; CW_I[i].style.borderColor=Car_Border_Color} CW_I[i].src=Car_Image_Sources[2*i]; CW_I[i].lnk=Car_Image_Sources[2*i+1]; CW_I[i].onclick=C_LdLnk; CW_I[i].onmouseover=C_Stp; CW_I[i].onmouseout=C_Rstrt} CarImages()}} function CarImages(){ if(!C_Stppd){ C_TotalW=0; for(i=0;i<C_HalfNo;i++){ C_ClcW[i]=Math.round(Math.cos(Math.abs(C_Coef[C_CoefOf+i]+C_Angle))*Car_Image_Width); C_TotalW+=C_ClcW[i]} C_LeftOffset=(C_MaxW-C_TotalW)/2; for(i=0;i<C_HalfNo;i++){ CW_I[i].style.left=C_LeftOffset+"px"; CW_I[i].style.width=C_ClcW[i]+"px"; C_LeftOffset+=C_ClcW[i]} C_Angle+=Car_Speed/720*Math.PI*(Car_Direction?-1:1); if((Car_Direction&&C_Angle<=0)||(!Car_Direction&&C_Angle>=Math.PI/C_HalfNo)){ if(C_CrImg==Car_Image_Sources.length)C_CrImg=0; if(Car_Direction){ CW_I[C_HalfNo]=CW_I[0]; for(i=0;i<C_HalfNo;i++)CW_I[i]=CW_I[i+1]; CW_I[C_HalfNo-1].src=Car_Image_Sources[C_CrImg]; CW_I[C_HalfNo-1].lnk=Car_Image_Sources[C_CrImg+1]} else{ for(i=C_HalfNo;i>0;i--)CW_I[i]=CW_I[i-1]; CW_I[0]=CW_I[C_HalfNo]; CW_I[0].src=Car_Image_Sources[C_CrImg]; CW_I[0].lnk=Car_Image_Sources[C_CrImg+1]} C_Angle=Car_Direction?Math.PI/C_HalfNo:0;C_CrImg+=2}} setTimeout("CarImages()",50)} function C_LdLnk(){if(this.lnk)window.location.href=this.lnk} function C_Stp(){this.style.cursor=this.lnk?"pointer":"default";C_Stppd=true;} function C_Rstrt(){C_Stppd=false} </script> <div id="Carousel" style="position:relative"> <img src="placeholder.gif" width="371" height="225"> </div> <p><font face="Arial" size="-2">Free DHTML scripts provided by<br><a href="http://www.dynamicdrive.com">Dynamic Drive</a></font></p>
  3. i need help to build a SQL query/statement to select only records with a date from now and 1 month before and also from now and two months before? is going to be something like: select * from table where month(date_of_entry )= month(now(-2)) thanks in advance
  4. thanks for the help i have managed to solve some of the problem but i am still having trouble when searching for repname and rep2 but it works fine when searching on its own or with customer_name or account_no. just to get it clear i want to know why there was a problem with 'ands' when the other search criteria works fine. i am the same error as above
  5. Hi i need help with the following the script. Its driving me crazy. when i try to search for rep_name together with rep2 and search for rep_name and grade i get the following error: when i try to search by grade the search page return blank i am really really confused. can someone point me into the right direction as to where i am going wrong. please refer to the 2 scripts below many thanks <?php require 'conn.php'; require 'page_header.php'; $end=time(); include "start_timer.php"; include "end_timer.php"; ?> <html> <head> <title>Searching Rep DB</title> </head> <body bgcolor=#ffffff> <a href="logout.php">Log out</a><br><br> <FORM><INPUT TYPE="button" VALUE="Back" onClick="history.go(-1);return true;"> </FORM> <h1 align=center>Searching Reports</h1> <b>Flease fill in 1 or any combination to refine search.</b> <table border="0" width=100%> <form method="get" action="process_advance_search_admin.php"> <tr> <td colspan=2>search by Account No:<input type=text name='account_no' size=10 maxlength=255></td> </tr> <tr> <td colspan=2>search by Customer Name:<input type=text name='customer_name' size=30 maxlength=255></td> </tr> <tr> <td colspan=2>search by Date:<input type=text name='date' size=30 maxlength=255></td> </tr> <tr> <td colspan=2>search by Rep2:<input type=text name='rep2' size=30 maxlength=255></td> </tr> <tr> <td colspan=2>search by Grade: <select name="grade"> <option value="" selected>Please choose </option> <option value="A">A</option> <option value="B">B</option> <option value="C">C</option> <option value="D">D</option> <option value="N">N</option> </select> </td> </tr> <tr> <td colspan=2>search by Rep: <select name="repname"> <option value="" selected>Please select Name </option> <!-- option value="Alan Fishwick">Alan Fishwick </option --> <option value="Andrew Dawson">Andrew Dawson </option> <option value="Dominic Condon">Dominic Condon </option> <option value="James Hynds">James Hynds </option> <option value="Mark Flowers">Mark Flowers </option> <option value="Peter Coatham">Peter Coatham </option> <option value="Ray Deal">Ray Deal </option> <option value="Telephone Sales">Telephone Sales </option> <option value="Tim Farmiloe">Tim Farmiloe </option></td> </select> </tr> <tr> <td><input type=submit name='all' value='Search All Reports'></td> </tr> </table> </form> <a href="backup_reports1.xls" target="_blank">Archive</a> (05/06-08/06) </html> <?php require 'conn.php'; require 'page_header.php'; $end=time(); include "start_timer.php"; include "end_timer.php"; echo '<a href="logout.php">Log out</a><br><br>'; if (($_GET['account_no']!="") or ($_GET['customer_name']!="") or ($_GET['date']!="") or ($_GET['repname']!="") or ($_GET['GRADE']!="") or ($_GET['rep2']!="")) { $sql = "select distinct repactivity.*, customer_table.CUSTOMER_NAME, customer_table.GRADE, customer_table.address3, DATE_FORMAT(DATE_OF_ENTRY, '%d-%m-%Y %r') AS DATE_OF_ENTRY, concat(outstanding, ' ', outstanding2, ' ') AS follow_up from repactivity, customer_table where customer_table.ACCOUNT_NO=repactivity.account_no AND"; if ($_GET['account_no']!="") { $sql = $sql." repactivity.account_no LIKE '".$_GET['account_no']."%'"; } if ($_GET['customer_name']!="") { if ($_GET['account_no']!="") $sql = $sql." and"; $sql = $sql." CUSTOMER_NAME LIKE '".$_GET['customer_name']."%'"; } if ($_GET['date']!="") { if (($_GET['account_no']!="") or ($_GET['customer_name']!="")) $sql = $sql." and"; $sql = $sql." DATE_OF_APPROACH LIKE '%".$_GET['date']."%'"; } if ($_GET['grade']!="") { if ($_GET['repname']!="") $sql = $sql." and"; $sql = $sql." GRADE LIKE '".$_GET['grade']."%'"; } if ($_GET['rep2']!="") { if (($_GET['account_no']!="") or ($_GET['customer_name']!="") or ($_GET['date']!="") or ($_GET['repname']!="")) $sql = $sql." and"; $sql = $sql." rep2 LIKE '%".$_GET['rep2']."%'"; } if ($_GET['repname']!="") { if (($_GET['account_no']!="") or ($_GET['customer_name']!="") or ($_GET['date']!="") or ($_GET['rep2']!="")) $sql = $sql." and"; $sql = $sql." full_name LIKE '".$_GET['repname']."' Group by DATE_OF_ENTRY DESC"; } $result = mysql_query($sql); $number=mysql_num_rows($result); if (!$result) { echo 'Could not run query: ' . mysql_error(); } echo "<table border=1 bordercolor='tan' class='rep' width ='150%' " . "cellspacing='5'"."cellpadding='5'>\n"; echo "<tr border=1><th class='searchHeader'><caption> <b>Search Results</b><br>Total Reports = $number</caption> </th></tr>\n"; echo "<tr><td><b>Account No:</b></td> <td><b>Customer Name:</b></td> <td><b>Grade:</b></td> <td><b>Town:</b></td> <td><b>Date of Approach:</b></td> <td width='50%'><b>Report:</b></td> <td width='50%'><b>Outstanding:</b></td> <td><b>Type of Approach:</b></td> <td width='14%'><b>Rep Name: </b></td> <td width='14%'><b>Rep2: </b></td> <td><b>Date of entry: </b></td> <td><b>Updated Status:</b></td><td><b>No of follow-ups:</b></td> <td><b>View/add Follow-Up</b></td></tr>"; if ($result and !mysql_num_rows ($result)) { echo "<tr class='row1'><td>No results found that match the "; } else { while($row = mysql_fetch_array($result, MYSQL_BOTH)) { echo "<tr><!-- td>".$row['activity_id']."</td --> <td>".$row['account_no']."</td> <td>".$row['CUSTOMER_NAME']."</td> <td>".$row['GRADE']."</td> <td>".$row['address3']."</td> <td>".$row['DATE_OF_APPROACH']."</td> <td>".$row['report']."</td> <td>".$row['follow_up']."</td> <td>".$row['type_of_approach']."</td> <td>".$row['full_name']."</td> <td>".$row['rep2']."</td> <td>".$row['DATE_OF_ENTRY']."</td> <td>".$row['status']."</td> <td>".$row['reply']."</td> <td bgcolor='#FFFFFF'><a href='view_topic_report.php?activity_id=".$row['activity_id']."'>view here</a><BR></td></tr>"; // include ('view_topic_report.php?activity_id=$activity_id'); echo "</td>"; } } } ?>
  6. Hi all I have 2 scripts to display data in table format. the first script displays the main table with columns : account no, customer, report, rep name and view/add follow-up(this links to the second script) the second script is to display follow-ups. is there a way to display all the columns in a single table rather than having follow-ups to be on a seperate page. possibly merging the two scripts or some other way. Can someone plz help. I really cant make this to work. please refer check the two scripts below. I have done a html code of what i want, to make it more understandable. Anyhelp would be much appreciated. thanks the current displays is like this: <html> <head> </head> <body> <table border=1> <tr> <td> accouny no </td> <td> customer name </td> <td> report </td> <td> Rep name </td> <td> view/add follow-ups </td> </tr> <tr> <td> 12345 </td> <td> xyz </td> <td> abcd.... </td> <td> aaa </td> <td> <a href='followup.php?activity_id=".$row['activity_id']."'>view here</a> </td> </tr> </table> </body> </html> I am trying to display table in the following format: <html> <head> </head> <body> <table border=1> <tr> <td> accouny no </td> <td> customer name </td> <td> report </td> <td> Rep name </td> <td> follow-ups </td> </tr> <tr> <td> 12345 </td> <td> xyz </td> <td> abcd.... </td> <td> aaa </td> <td> 12/12/06 > Aaaa.... <br/> 22/1/07 > bbbb... <br/> </td> </tr> </table> </body> </html> Script 1 <?php require 'conn.php'; require 'page_header.php'; $end=time(); include "start_timer.php"; include "end_timer.php"; echo '<a href="logout.php">Log out</a><br><br>'; if (($_GET['account_no']!="") or ($_GET['customer_name']!="") or ($_GET['date']!="") or ($_GET['repname']!="")) { $sql = "select distinct repactivity.*, customer_table.CUSTOMER_NAME, DATE_FORMAT(DATE_OF_ENTRY, '%d-%m-%Y %r') AS DATE_OF_ENTRY, concat(outstanding, ' ', outstanding2, ' ') AS outstanding from repactivity, customer_table where customer_table.account_no=repactivity.account_no AND"; if ($_GET['account_no']!="") { $sql = $sql." repactivity.account_no LIKE '".$_GET['account_no']."%'"; } if ($_GET['customer_name']!="") { if ($_GET['account_no']!="") $sql = $sql." and"; $sql = $sql." CUSTOMER_NAME LIKE '".$_GET['customer_name']."%'"; } if ($_GET['date']!="") { if (($_GET['account_no']!="") or ($_GET['customer_name']!="")) $sql = $sql." and"; $sql = $sql." DATE_OF_APPROACH LIKE '%".$_GET['date']."%'"; } if ($_GET['repname']!="") { if (($_GET['account_no']!="") or ($_GET['customer_name']!="") or ($_GET['date']!="")) $sql = $sql." and"; $sql = $sql." full_name LIKE '".$_GET['repname']."' Group by DATE_OF_ENTRY DESC"; } if ($_GET['rep2']!="") { if (($_GET['account_no']!="") or ($_GET['customer_name']!="") or ($_GET['date']!="") or ($_GET['rep2']!="")) $sql = $sql." and"; $sql = $sql." rep2 LIKE '".$_GET['rep2']."%' group by DATE_OF_ENTRY DESC"; } $result = mysql_query($sql); $number=mysql_num_rows($result); if (!$result) { echo 'Could not run query: ' . mysql_error(); } echo "<table border=1 bordercolor='tan' class='rep' width ='150%' " . "cellspacing='5'"."cellpadding='5'>\n"; echo "<tr border=1><th class='searchHeader'><caption> <b>Search Results</b><br>Total Reports = $number</caption> </th></tr>\n"; echo "<tr><td><b>Account No:</b></td> <td><b>Customer Name:</b></td> <td><b>Date of Approach:</b></td> <td width='50%'><b>Report:</b></td> <td width='50%'><b>Outstanding:</b></td> <td><b>Type of Approach:</b></td> <td width='14%'><b>Rep Name: </b></td> <td width='14%'><b>Rep2: </b></td> <td><b>Date of entry: </b></td> <td><b>Updated Status:</b></td><!-- td><b>Updated On:</b></td --> <td><b>View/add Follow-Up</b></td></tr>"; if ($result and !mysql_num_rows ($result)) { echo "<tr class='row1'><td>No results found that match the "; } else { while($row = mysql_fetch_array($result, MYSQL_BOTH)) { echo "<tr><!-- td>".$row['activity_id']."</td --> <td>".$row['account_no']."</td> <td>".$row['CUSTOMER_NAME']."</td> <td>".$row['DATE_OF_APPROACH']."</td> <td>".$row['report']."</td> <td>".$row['outstanding]."</td> <td>".$row['type_of_approach']."</td> <td>".$row['full_name']."</td> <td>".$row['rep2']."</td> <td>".$row['DATE_OF_ENTRY']."</td> <td>".$row['status']."</td> <!-- td>".$row['updated_on']."</td --> <td bgcolor='#FFFFFF'><a href='followup.php?activity_id=".$row['activity_id']."'>view here</a><BR></td></tr>"; // include ('view_topic_report.php?activity_id=$activity_id'); echo "</td>"; } } } ?> script 2 <?php //Connect to server and select databse. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); // get value of id that sent from address bar $activity_id=$_GET['activity_id']; //$sql="SELECT view $tbl_name.*, customer_table.customer_name, customer_table.account_no from $tbl_name, customer_table where $tbl_name.account_no='$account_no' ORDER BY DATE_OF_ENTRY DESC"; $sql="select * from $tbl_name where activity_id='$activity_id'"; $result=mysql_query($sql); $rows=mysql_fetch_array($result); ?> <a href="logout.php">Logout</a><br> <FORM><INPUT TYPE="button" VALUE="Back" onClick="history.go(-1);return true;"> </FORM> <table width="400" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC"> <tr> <td><table width="100%" border="0" cellpadding="3" cellspacing="1" bordercolor="1" bgcolor="#FFFFFF"> <tr> <td bgcolor="#F8F7F1"><strong>Followup : </strong><? echo $rows['outstanding']; ?></td> </tr> <td bgcolor="#F8F7F1"><strong>By : </strong> <? echo $rows['full_name']; ?></td> </tr> <tr> <td bgcolor="#F8F7F1"><strong>Date/time : </strong><? echo $rows['DATE_OF_ENTRY']; ?></td> </tr> </table></td> </tr> </table> <BR> <?php $tbl_name2="forum_answer"; // Switch to table "forum_answer" $sql2="SELECT * FROM $tbl_name2 WHERE question_id='$activity_id'"; $result2=mysql_query($sql2); while($rows=mysql_fetch_array($result2)){ ?> <table width="400" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC"> <tr> <td><table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF"> <tr> <td bgcolor="#F8F7F1"><strong>Update</strong></td> <td bgcolor="#F8F7F1">:</td> <td bgcolor="#F8F7F1"><? echo $rows['a_id']; ?></td> </tr> <tr> <td width="18%" bgcolor="#F8F7F1"><strong>Name</strong></td> <td width="5%" bgcolor="#F8F7F1">:</td> <td width="77%" bgcolor="#F8F7F1"><? echo $rows['a_name']; ?></td> </tr> <tr> <td bgcolor="#F8F7F1"><strong>Answer</strong></td> <td bgcolor="#F8F7F1">:</td> <td bgcolor="#F8F7F1"><? echo $rows['a_answer']; ?></td> </tr> <tr> <td bgcolor="#F8F7F1"><strong>Date/Time</strong></td> <td bgcolor="#F8F7F1">:</td> <td bgcolor="#F8F7F1"><? echo $rows['a_datetime']; ?></td> </tr> </table></td> </tr> </table><br> <? } $sql3="SELECT $tbl_name.*, customer_table.customer_name, customer_table.account_no from $tbl_name, customer_table where customer_table.account_no=$tbl_name.account_no ORDER BY DATE_OF_ENTRY DESC"; $result3=mysql_query($sql3); $rows=mysql_fetch_array($result3); $view=$rows['view']; // if have no counter value set counter = 1 if(empty($view)){ $activity_id=$_GET['activity_id']; $view=1; $sql4="INSERT INTO $tbl_name(view) VALUES('$view') WHERE activity_id='$activity_id'"; $result4=mysql_query($sql4); } // count more value $addview=$view+1; $sql5="update $tbl_name set view='$addview' WHERE activity_id='$activity_id'"; $result5=mysql_query($sql5); mysql_close(); ?> <BR> <table width="400" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC"> <tr> <form name="form1" method="post" action="add_answer_reports.php"> <td> <table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF"> <tr> <td width="18%"><strong>Name</strong></td> <td width="3%">:</td> <td width="79%"><input name="a_name" type="text" id="a_name" size="45"></td> </tr> <tr> <td valign="top"><strong>Reply</strong></td> <td valign="top">:</td> <td><textarea name="a_answer" cols="45" rows="3" id="a_answer"></textarea></td> </tr> <tr> <td valign="top"><strong>Status</strong></td> <td valign="top">:</td> <td valign="top"><select name="status"><?php echo $myrow["status"] ?> <option value="" selected>Select</option> <option value="Complete">Complete</option> <option value="Ongoing">Ongoing</option> <option value="Discussed with Ray">Discussed with Ray & closed</option> </select> </td> </tr> <tr> <td> </td> <td><input name="activity_id" type="hidden" value="<? echo $activity_id; ?>"></td> <td><input type="submit" name="Submit" value="Submit"> <input type="reset" name="Submit2" value="Reset"></td> </tr> </table> </td> </form> </tr> </table> ?>
  7. hi guyz can some help solve the problem. Im really stuck :( thanks
  8. here is the code: [code] <?php require 'conn.php'; require 'page_header.php'; $end=time(); include "start_timer.php"; include "end_timer.php"; echo '<a href="logout.php">Log out</a><br><br>'; if (($_GET['account_no']!="") or ($_GET['customer_name']!="") or ($_GET['date']!="") or ($_GET['repname']!="")) { $sql = "select distinct repactivity.*, customer_table.CUSTOMER_NAME, DATE_FORMAT(DATE_OF_ENTRY, '%d-%m-%Y %r') AS DATE_OF_ENTRY, concat(outstanding, ' ', outstanding2, ' ') AS outstanding from repactivity, customer_table where customer_table.account_no=repactivity.account_no AND"; if ($_GET['account_no']!="") { $sql = $sql." repactivity.account_no LIKE '".$_GET['account_no']."%'"; } if ($_GET['customer_name']!="") { if ($_GET['account_no']!="") $sql = $sql." and"; $sql = $sql." CUSTOMER_NAME LIKE '".$_GET['customer_name']."%'"; } if ($_GET['date']!="") { if (($_GET['account_no']!="") or ($_GET['customer_name']!="")) $sql = $sql." and"; $sql = $sql." DATE_OF_APPROACH LIKE '%".$_GET['date']."%'"; } if ($_GET['repname']!="") { if (($_GET['account_no']!="") or ($_GET['customer_name']!="") or ($_GET['date']!="")) $sql = $sql." and"; $sql = $sql." full_name LIKE '".$_GET['repname']."' Group by DATE_OF_ENTRY DESC"; } if ($_GET['rep2']!="") { if (($_GET['account_no']!="") or ($_GET['customer_name']!="") or ($_GET['date']!="") or ($_GET['rep2']!="")) $sql = $sql." and"; $sql = $sql." rep2 LIKE '".$_GET['rep2']."%' group by DATE_OF_ENTRY DESC"; } $result = mysql_query($sql); $number=mysql_num_rows($result); if (!$result) { echo 'Could not run query: ' . mysql_error(); } echo "<table border=1 bordercolor='tan' class='rep' width ='150%' " .     "cellspacing='5'"."cellpadding='5'>\n"; echo "<tr border=1><th class='searchHeader'><caption> <b>Search Results</b><br>Total Reports = $number</caption> </th></tr>\n"; echo "<tr><td><b>Account No:</b></td> <td><b>Customer Name:</b></td> <td><b>Date of Approach:</b></td> <td width='50%'><b>Report:</b></td> <td width='50%'><b>Outstanding:</b></td> <td><b>Type of Approach:</b></td> <td width='14%'><b>Rep Name: </b></td> <td width='14%'><b>Rep2: </b></td> <td><b>Date of entry: </b></td> <td><b>Updated Status:</b></td><!-- td><b>Updated On:</b></td --> <td><b>View/add Follow-Up</b></td></tr>"; if ($result and !mysql_num_rows ($result)) { echo "<tr class='row1'><td>No results found that match the ";   }   else   { while($row = mysql_fetch_array($result, MYSQL_BOTH)) { echo "<tr><!-- td>".$row['activity_id']."</td -->       <td>".$row['account_no']."</td>       <td>".$row['CUSTOMER_NAME']."</td>       <td>".$row['DATE_OF_APPROACH']."</td>       <td>".$row['report']."</td>       <td>".$row['outstanding]."</td>       <td>".$row['type_of_approach']."</td>               <td>".$row['full_name']."</td>       <td>".$row['rep2']."</td>       <td>".$row['DATE_OF_ENTRY']."</td>       <td>".$row['status']."</td>       <!-- td>".$row['updated_on']."</td -->       <td bgcolor='#FFFFFF'><a href='followup.php?activity_id=".$row['activity_id']."'>view here</a><BR></td></tr>";   //    include ('view_topic_report.php?activity_id=$activity_id'); echo "</td>"; } } } ?> [/code] Thanks
  9. now i am getting this error: Warning: include(view_topic_report.php?activity_id=$activity_id) [function.include]: failed to open stream: No such file or directory in /home/vhost/farmiloesinjamaica.co.uk/html/final/process_advance_search_admin.php on line 78
  10. can you give an example how to put it on one page. BTW i have tried the following but im getting error:unexpected T_VARIABLE, expecting ',' or ';'  ...  on line -> [quote]       <td>".$row['name]."</td>       <td>".$row['DATE_OF_ENTRY']."</td>       <td>".$row['status']."</td>              ->  <td> "$row['include "followup.php?activity_id=$activity_id";']."</td> [/quote]
  11. hi huggiebear thanks for the reply, i think i havent explained it properly. basically I have one script which displays a table (columns are Account No: Customer Name: Date of Approach: Report: Outstanding: Type of Approach etc) and want to display follow-up reports in the same table, but I have a seperate script for follow-up reports where name, follow-up report and time can be added. How can I show follow-up reports in a column on the same table. e.g. [quote] Account No|CustomerName|DateofApproach|  Report |  followup 0000             xyz                 00-00-0000          abc       name> report>date [/quote] I hope it makes more sense. Please advise me of any other ways to make this possible. Thanks
  12. Hi all, I have a system where reports are added by people. I have a textarea in the form where people write outstanding/follow-ups and updates it as and when required. I have created another table where updates are added with datetime, name, and status. the main report is displayed on the table (columns are Account No: Customer Name: Date of Approach: Report: Outstanding: Type of Approach etc) but currently follow-up are on a seperate page in a threaded discussion like format (can be accessed by clicking on a hyperlink). Problem if possible, I want follow-ups to be displayed in a column on the same table as the rest of the report. Also I want to keep the existing data when more info is added with datetime. I would really appreciate if someone could help me. thanks Heres the code for follow-ups [code] <?php //Connect to server and select databse. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); // get value of id that sent from address bar $activity_id=$_GET['activity_id']; //$sql="SELECT view $tbl_name.*, customer_table.customer_name, customer_table.account_no from $tbl_name, customer_table where $tbl_name.account_no='$account_no' ORDER BY DATE_OF_ENTRY DESC"; $sql="select * from $tbl_name where activity_id='$activity_id'"; $result=mysql_query($sql); $rows=mysql_fetch_array($result); ?> <a href="logout.php">Logout</a><br> <FORM><INPUT TYPE="button" VALUE="Back" onClick="history.go(-1);return true;"> </FORM> <table width="400" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC"> <tr> <td><table width="100%" border="0" cellpadding="3" cellspacing="1" bordercolor="1" bgcolor="#FFFFFF"> <tr> <td bgcolor="#F8F7F1"><strong>Followup : </strong><? echo $rows['outstanding']; ?></td> </tr> <td bgcolor="#F8F7F1"><strong>By : </strong> <? echo $rows['full_name']; ?></td> </tr> <tr> <td bgcolor="#F8F7F1"><strong>Date/time : </strong><? echo $rows['DATE_OF_ENTRY']; ?></td> </tr> </table></td> </tr> </table> <BR> <?php $tbl_name2="forum_answer"; // Switch to table "forum_answer" $sql2="SELECT * FROM $tbl_name2 WHERE question_id='$activity_id'"; $result2=mysql_query($sql2); while($rows=mysql_fetch_array($result2)){ ?> <table width="400" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC"> <tr> <td><table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF"> <tr> <td bgcolor="#F8F7F1"><strong>Update</strong></td> <td bgcolor="#F8F7F1">:</td> <td bgcolor="#F8F7F1"><? echo $rows['a_id']; ?></td> </tr> <tr> <td width="18%" bgcolor="#F8F7F1"><strong>Name</strong></td> <td width="5%" bgcolor="#F8F7F1">:</td> <td width="77%" bgcolor="#F8F7F1"><? echo $rows['a_name']; ?></td> </tr> <tr> <td bgcolor="#F8F7F1"><strong>Answer</strong></td> <td bgcolor="#F8F7F1">:</td> <td bgcolor="#F8F7F1"><? echo $rows['a_answer']; ?></td> </tr> <tr> <td bgcolor="#F8F7F1"><strong>Date/Time</strong></td> <td bgcolor="#F8F7F1">:</td> <td bgcolor="#F8F7F1"><? echo $rows['a_datetime']; ?></td> </tr> </table></td> </tr> </table><br> <? } $sql3="SELECT $tbl_name.*, customer_table.customer_name, customer_table.account_no from $tbl_name, customer_table where customer_table.account_no=$tbl_name.account_no ORDER BY DATE_OF_ENTRY DESC"; $result3=mysql_query($sql3); $rows=mysql_fetch_array($result3); $view=$rows['view']; // if have no counter value set counter = 1 if(empty($view)){ $activity_id=$_GET['activity_id']; $view=1; $sql4="INSERT INTO $tbl_name(view) VALUES('$view') WHERE activity_id='$activity_id'"; $result4=mysql_query($sql4); } // count more value $addview=$view+1; $sql5="update $tbl_name set view='$addview' WHERE activity_id='$activity_id'"; $result5=mysql_query($sql5); mysql_close(); ?> <BR> <table width="400" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC"> <tr> <form name="form1" method="post" action="add_answer_reports.php"> <td> <table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF"> <tr> <td width="18%"><strong>Name</strong></td> <td width="3%">:</td> <td width="79%"><input name="a_name" type="text" id="a_name" size="45"></td> </tr> <tr> <td valign="top"><strong>Reply</strong></td> <td valign="top">:</td> <td><textarea name="a_answer" cols="45" rows="3" id="a_answer"></textarea></td> </tr> <tr> <td valign="top"><strong>Status</strong></td> <td valign="top">:</td> <td valign="top"><select name="status"><?php echo $myrow["status"] ?>        <option value="" selected>Select</option>        <option value="Complete">Complete</option>        <option value="Ongoing">Ongoing</option>        <option value="Discussed with Ray">Discussed with Ray & closed</option>       </select> </td> </tr> <tr> <td>&nbsp;</td> <td><input name="activity_id" type="hidden" value="<? echo $activity_id; ?>"></td> <td><input type="submit" name="Submit" value="Submit"> <input type="reset" name="Submit2" value="Reset"></td> </tr> </table> </td> </form> </tr> </table> <? /* if($_POST["Submit"]) { $activity_id=$_GET['activity_id']; $sql6= "update table reactivity set status=(select status from forum_answer) where activity_id='$activity_id'";       $result = mysql_query($sql); } */ ?> [/code]
  13. [!--quoteo(post=387330:date=Jun 23 2006, 07:40 PM:name=hackerkts)--][div class=\'quotetop\']QUOTE(hackerkts @ Jun 23 2006, 07:40 PM) [snapback]387330[/snapback][/div][div class=\'quotemain\'][!--quotec--] This is how you do query in php, [code]$colunm = $_GET['column']; $abc = $_GET['abc']; $query = "select $column from table where comapny like '%$abc%'"; $result = mysql_query($query) or die("Query failed: " . mysql_error());[/code] [/quote] Thanks for your help, how do i display selected columns close together. I am dispalying results in a table, when I select 1st and 9th column I get huge space in between how do i get rid of that. Should be displayed like this: Search Results column1 column9 cxc No gfg No rtrt No Thanks Sab
  14. Hi I want to know how to select columns from mysql usng php. I know I can select columns in mysql using the following statement: [code]Select column1, column2 from table where company like '%abc%'[/code] how do i do the same using php, is it going to be: [code]select '".$_GET['column']."' from table where comapny like '%".$_GET['abc']."%'[/code] basically I have a survey table with 12 columns, I want users to only search and view columns they want e.g. user1 wants to view companies with higher market position, user2 wants to see brands, companies and display items, user3 wants to see companies with multi branches and their top selling brands. Is it possible and can someone point me to the right direction. Thanks in advance Sab
  15. please refer to: Posted Jun 16 2006, 08:37 AM Can anyone help plzzz Thanks in advance Sab
  16. [!--quoteo(post=384564:date=Jun 16 2006, 09:20 AM:name=redarrow)--][div class=\'quotetop\']QUOTE(redarrow @ Jun 16 2006, 09:20 AM) [snapback]384564[/snapback][/div][div class=\'quotemain\'][!--quotec--] [code] logout.php <? require "conn.php"; Session_start(); $_SESSION['logged_in'] = 0; $_SESSION['username'] = $_POST['username']; $_SESSION['log_id'] = log_id; setcookie('login_cookie', false, time() - 3600, '/secure/', '.index1.php'); if($_GET["cmd"]=="update") { $logout_datetime=date('Y-m-d h:i:sa', time()); $logout_datetime=$_POST['logout_datetime']; mysql_query("UPDATE access_log SET logout_datetime = '$logout_datetime' WHERE log_id=log_id and username=username"); or die (mysql_error()); } session_destroy(); header("Location: index1.php"); ?> [/code] The link to update and log out. [code] <a href="logout.php?&cmd=update&log_id=$log_id">Logout</a> [/code] [/quote] [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]I have tried that but now I get the following: [code]+--------+----------+---------------------+---------------------+ | log_id | username | login_datetime | logout_datetime | +--------+----------+---------------------+---------------------+ |     50 |          | 2006-06-19 17:06:49 | 0000-00-00 00:00:00 | |     51 |          | 2006-06-19 17:07:25 | 0000-00-00 00:00:00 | |     52 |          | 2006-06-19 17:08:16 | 0000-00-00 00:00:00 | |     53 |          | 2006-06-19 17:09:33 | 0000-00-00 00:00:00 | |     54 |          | 2006-06-19 17:10:08 | 0000-00-00 00:00:00 | +--------+----------+---------------------+---------------------+[/code] Username is blank and logout column remain '0000-00-00 00:00:00' here is the table structure if helps: [code]+-----------------+-------------+------+-----+---------------------+------------ ----+ | Field           | Type        | Null | Key | Default             | Extra     | +-----------------+-------------+------+-----+---------------------+------------ ----+ | log_id          | int(25)     | NO   | PRI | NULL                | auto_increm ent | | username        | varchar(25) | NO   |     |                     |     | | login_datetime  | datetime    | NO   |     | 0000-00-00 00:00:00 |     | | logout_datetime | datetime    | NO   |     | 0000-00-00 00:00:00 |     | +-----------------+-------------+------+-----+---------------------+------------[/code] Any suggestions plzzz thanks[/quote]
  17. [!--quoteo(post=381779:date=Jun 9 2006, 04:00 AM:name=sab)--][div class=\'quotetop\']QUOTE(sab @ Jun 9 2006, 04:00 AM) [snapback]381779[/snapback][/div][div class=\'quotemain\'][!--quotec--] Thanks digitalgod it worked. :) [/quote] Hi Here I am again, I thought i have managed to make it work but i didnt. the problem is when I update logout time for specific user, the whole column get updated for example: [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]+--------+----------+---------------------+---------------------+ | log_id | username | login_datetime | logout_datetime | +--------+----------+---------------------+---------------------+ | 1 | abc | 2006-06-07 17:10:35 | 2006-06-16 14:11:29 | | 2 | def | 2006-06-07 17:11:49 | 2006-06-16 14:11:29 | | 4 | ghi | 2006-06-16 12:05:02 | 2006-06-16 14:11:29 | | 5 | jkl | 2006-06-16 12:08:27 | 2006-06-16 14:11:29 |[/quote] the code is: [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]<? require "conn.php"; Session_start(); $_SESSION['logged_in'] = 0; $_SESSION['username'] = $_POST['username']; $_SESSION['log_id'] = log_id; setcookie('login_cookie', false, time() - 3600, '/secure/', '.index1.php'); mysql_query("UPDATE access_log SET logout_datetime = now() WHERE log_id=log_id and username=username"); or die (mysql_error()); session_destroy(); header("Location: index1.php"); ?>[/quote] here is my login script: [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]<? ob_start(); session_start(); $_SESSION['time_start']=$start; $_SESSION['log_id']= log_id; if(isset($_SESSION['username']) && isset($_SESSION['password'])) { header ("Location: page.php"); $sql = mysql_query("INSERT INTO users (first_name, last_name, email_address, username, password, info, signup_date) VALUES('$first_name', '$last_name', '$email_address', '$username', '$db_password', '$info2', now())") or die (mysql_error()); } //end if logged in if(isset($_POST['submit'])) { if(!$_POST['username']) die("Error: You must enter your username before logging in."); if(!$_POST['password']) die("Error: You must enter your password before logging in."); mysql_query("INSERT INTO access_log (username,login_datetime) VALUES('$username', now())") or die (mysql_error()); $get_user = mysql_query("SELECT * FROM `users` WHERE username = '".$_POST['username']."' AND user_password = '".md5($_POST['password'])."'"); $q = mysql_fetch_object($get_user); if(!$q) die("Login Failure: An error occured, please verify your username and password are correct."); //set session variables $_SESSION['logged_in'] = 1; $_SESSION['log_id']= $_POST['log_id']; $_SESSION['username'] = $_POST['username']; session_write_close(); header("Location: page.php"); } else { //show login form ?> <html> <head><title>Rep sign-up page</title> </head> <body> <h4>Existing user please login</h4> <form name="login" method="post" action="<? $_SERVER['PHP_SELF']; ?>"> <table> <tr> <td>Username:<input type="text" id="username" name="username"></td> </tr> <tr> <td>Password:<input type="password" id="password" name="password"></td> </tr> <tr> <td>Submit: <input type="submit" value="Login" name="submit" id="submit"></td> </tr> </table> </form> </body> </html> <? }//end else ?>[/quote] Can some1 help plzzz. thanks in advance
  18. If you dont know how login scripts work, I would recommend that you to look at tutorials thats where you will learn how php works and how to create logins etc. Below is my favourite tutorial where I learned quite a lot and it assisted me with other php scripts aswell. So if you like you can visit: [a href=\"http://www.tutorialized.com/tutorial/PHP-Simple-login-script/9963\" target=\"_blank\"]http://www.tutorialized.com/tutorial/PHP-S...gin-script/9963[/a] Good Luck Sab
  19. Hi I have a form where reps add reports. I also have a link where reps can lookup account no by entering their name and customer name. once account no is found they have to type that number in the form. Is possible to auto-select account no from lookup page and add it to the account no textbox on the form. i have added a link in account lookup page but not sure what to do next to make it work. [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]Account No|Customer Name |Town | Post Code |Rep Name | Click to add xxxx | abc |xyz | xxxx xxx |aaaaa |ADD [/quote] here is the code: [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--] <?php require 'conn.php'; if (($_GET['customer_name']!="")) { $sql = "select * from rep_table WHERE repname like '".$_GET['repname']."' and"; if ($_GET['customer_name']!="") { $sql = $sql." CUSTOMER_NAME LIKE '".$_GET['customer_name']."%'"; } $result = mysql_query($sql); if (!$result) { echo 'Could not run query: ' . mysql_error(); } echo "<table border=1 align='center' class='rep' width ='' " . "cellspacing='0'"."callpadding='5'>\n"; echo "<tr><th class='searchHeader'><caption><b> Search Results</b></caption> </th></tr>\n"; echo "<tr><td align='center'><b>Account No:</td><td><b>Customer Name:</td><td><b>Town:</td><td><b>Post Code:</td><td><b>Rep Name:</b></td><td>Click to add</td></tr>"; if ($result and !mysql_num_rows ($result)) { echo "<tr class='row1'><td colspan='4'>No results found that match the "; echo "search term(s)"; echo '</br><font color="red">please go back and try again</font></br>'; } else { while($row = mysql_fetch_array($result, MYSQL_BOTH)) { $ACCOUNT_NO=$row["ACCOUNT_NO"]; $CUSTOMER_NAME=$row["CUSTOMER_NAME"]; $ADDRESS3=$row["ADDRESS3"]; $POST_CODE=$row["POST_CODE"]; $Rep_Name=$row["Rep_Name"]; echo "<tr><td align='center'>$ACCOUNT_NO</td> <td>$CUSTOMER_NAME</td> <td>$ADDRESS3</td> <td>$POST_CODE</td> <td>$Rep_Name</td> <td><a href='repform.php?cmd=update&account_no=$ACCOUNT_NO'>ADD</a></td></tr>"; } } } echo "</table>"; ?> [/quote] thanks in advance Sab
  20. [!--quoteo(post=381503:date=Jun 8 2006, 12:49 PM:name=digitalgod)--][div class=\'quotetop\']QUOTE(digitalgod @ Jun 8 2006, 12:49 PM) [snapback]381503[/snapback][/div][div class=\'quotemain\'][!--quotec--] just replace the part that says WHERE id = 1 with WHERE username = and that variable or session you used to store the username something like mysql_query("UPDATE access_log SET logout_datetime = date('Y-m-d h:i:sa', time()) WHERE username = '$username' "); [/quote] Thanks digitalgod it worked. :)
  21. [!--quoteo(post=381091:date=Jun 7 2006, 01:15 PM:name=digitalgod)--][div class=\'quotetop\']QUOTE(digitalgod @ Jun 7 2006, 01:15 PM) [snapback]381091[/snapback][/div][div class=\'quotemain\'][!--quotec--] mysql_query("UPDATE access_log SET logout_datetime = date('Y-m-d h:i:sa', time()) WHERE id = 1 "); should do the trick [/quote] The query still not updating logout_datetime column :( +--------+----------+---------------------+---------------------+ | log_id | username | login_datetime | logout_datetime | +--------+----------+---------------------+---------------------+ | 1 | abc | 2006-06-07 17:10:35 | 0000-00-00 00:00:00 | | 2 | abc | 2006-06-07 17:11:49 | 0000-00-00 00:00:00 | +--------+----------+---------------------+---------------------+ 2 rows in set (0.05 sec) any suggestions?
  22. [!--quoteo(post=380946:date=Jun 7 2006, 06:12 AM:name=sab)--][div class=\'quotetop\']QUOTE(sab @ Jun 7 2006, 06:12 AM) [snapback]380946[/snapback][/div][div class=\'quotemain\'][!--quotec--] But I get error if I put two timestamps. Can you explain how to go about and do this. thanks [/quote] I have solved half of the problem, I have managed to insert login time but how do i insert logout time can any1 help plzzz. thanks in advance here is my logout code: session_start(); $_SESSION['logged_in'] = 0; setcookie('login_cookie', false, time() - 3600, '/secure/', 'index.php'); mysql_query("update access_log set logout_datetime = date('Y-m-d h:i:sa', time()) "); session_destroy(); header("Location: index.php"); ?>
×
×
  • 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.