divyakrishnan 20 Junior Poster

I want to get it as
0 year 3 months 2 days.
Can anyone give new code for that?

divyakrishnan 20 Junior Poster

Try this also

<?php 
  $i = 0;
    while ($row=mysql_fetch_array($result)){
  ?>
    <tr>
    <form name="form1" action="submitAction.php" method="post">
    <td width="72" ><input type="text" autocomplete=off readonly name="ProjectName<?php echo $row['No'];?>" value="<?php echo  $row['ProjectName'];?>" size="20" style="font-size: 9"></font></td>
    <td width="72" ><input type="text" autocomplete=off readonly name="DeviceType<?php echo $row['No'];?>" value="<?php echo  $row['DeviceType'];?>" size="15" style="font-size: 9"></font></td>
 <td width="64" ><input type="button" value="EDIT!" onClick="removeAlignment(<?php echo $i; ?>);"></font></td>
    <td width="67" style="font-size: 12">
    <select name="action" onChange="submitRequest(<?php echo $i; ?>);">
    <option value=>Ongoing </option>
    <option value="<?php echo $row['ProjectName'];?>">Complete</option>
    <option value="<?php echo $row['No'];?>">Update</option>
    </select>								
    </form>
      </td>
    </tr>
  <?php 
  $i++;
  }
  ?>
divyakrishnan 20 Junior Poster

Hi,
I am using c#.
I have a problem of finding the difference between 2 dates in terms of year,month and day.
For example Finding the difference of 2 dates(mm/dd/yy).
date1=12/3/2010
date2=3/5/2011

I used the following code

int year=date2.Year-date1.Year;
int month=date2.Month-date1.Month;
int day=date2.Day-date1.Day;

The output I am getting is
1 year 3 months 2 days.

But the actual output is

0 year 3 months 2 days.

How will I solve this?please help me..

Thanks

divyakrishnan 20 Junior Poster

Use Check boxes to select the particular <td>'s and display all selected <td>'s on another page.Then use following code to print.

<input type="button" value="Print This Page" onClick="window.print()" />
divyakrishnan 20 Junior Poster
divyakrishnan 20 Junior Poster
divyakrishnan 20 Junior Poster

Find out whether u can access http://localhost/phpmyadmin.
Refer the following link.
http://www.apachefriends.org/f/viewtopic.php?f=16&t=47332

divyakrishnan 20 Junior Poster

use
break;
after line no 11.
And check your output.

divyakrishnan 20 Junior Poster

What you want to do?You want to format the output?

divyakrishnan 20 Junior Poster

The name is mismatching...U got it friom the previous post rt?

divyakrishnan 20 Junior Poster

The name of the two submit buttons are the same.
Edit first button name as submit1.Also edit
isset($_POST) as isset($_POST)

Only that much.

divyakrishnan 20 Junior Poster

It is not like that.The field is a dynamic field..I got the solution..Thanks for your support...

divyakrishnan 20 Junior Poster

Check out the spelling of form fields in the previous page.
Confirm that the field name is 'message'

divyakrishnan 20 Junior Poster

Thank You Very much..
There is one more thing I want to do.
Can I update the fields like TVM/01/00 as TVM/01/2000?

divyakrishnan 20 Junior Poster

Hi,
I have a table field with var char data type having values like TVM/345/2000,TVM/01/00,TSR/42/01 etc.I want to extract the sub string from first location to the second '/' location as TVM/345/.
Is there any built in function to solve is?

Thanks

divyakrishnan 20 Junior Poster

Post your entire code.

divyakrishnan 20 Junior Poster

Use the following lines of code to check ur database connection

$con = mysql_connect('localhost','root','');
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }
else
{
 echo "Connected";
}
$sel=mysql_select_db("employdb1");
if (!$sel)
  {
  die('Could not Select: ' . mysql_error());
  }
else
{
 echo "Selected";
}

Run this file first and find out whether it is running properly or not

divyakrishnan 20 Junior Poster

Whether it showing "No request was made" option?
Check out the database connection using following code

<?php
$con = mysql_connect('localhost','root','');
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }
else
{
 echo "Connected";
}
?>

Print the value of the variables like user_id,$friend_id.

divyakrishnan 20 Junior Poster

I installed mysql-5.5.8-win32.How can I access it?Didn't find any GUI.

divyakrishnan 20 Junior Poster

What is the problem with your code?Can you explain it?

divyakrishnan 20 Junior Poster

Hi..
I am frequently using XAMPP's phpmyadmin for MYSQL database.
I want to install original Mysql database from their developer's site(http://www.mysql.com).
I am very confused that I found 6 types softwares.
Which one should I install?
I also need to access the software using GUI..

Any body can help me?
Thanks.

divyakrishnan 20 Junior Poster

Using PHP I dnt have any idea.

divyakrishnan 20 Junior Poster

Try this code It using Java script

<!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=iso-8859-1" />
<title>Untitled Document</title>
<script>
function check()
{
var len=document.f.ck.length;
var ck=document.f.ck;
var l=0;
for(var i=0;i<len;i++)
{
if(ck[i].checked==true)
{
l++;
}
if(l>3)
{
ck[i].checked = false ;
}
}



}
</script>
</head>

<body>
<form id="form1" name="f" method="post" action="">
  <p>
    <input name="ck" type="checkbox" id="ck" value="checkbox" onclick="check()"/> 
  PHP</p>
  <p>
    <input name="ck" type="checkbox" id="ck" value="checkbox" onclick="check()"/> 
  JSP</p>
  <p>
    <input name="ck" type="checkbox" id="ck" value="checkbox" onclick="check()"/> 
  JAVA</p>
  <p>
    <input name="ck" type="checkbox" id="ck" value="checkbox" onclick="check()"/> 
  CSS</p>
  <p>
    <input name="ck" type="checkbox" id="ck" value="checkbox" onclick="check()" /> 
    HTML</p>
  <p>
    <input type="submit" name="Submit" value="Submit" />
  </p>
</form>
</body>
</html>
divyakrishnan 20 Junior Poster
divyakrishnan 20 Junior Poster
divyakrishnan 20 Junior Poster
divyakrishnan 20 Junior Poster
divyakrishnan 20 Junior Poster

visit the following link.
http://www.w3schools.com/ajax/ajax_example.asp

Try this example with <body onunload> event.
Edit the php file to destroy the session.

divyakrishnan 20 Junior Poster

Load some PHP script at the time of onunload event using ALAX.Use session_destroy function to destroy the session.

divyakrishnan 20 Junior Poster

Try this..

<?php 
$myarray=array(0=>"a,1",1=>"b,2",2=>"a,2");
$a=implode(",",$myarray);

$a=explode(",",$a);
$b=array();
$k=0;
for($i=0;$i<sizeof($a);$i++)
{
if($i%2==0)
{

  $b[$k]=$a[$i];
  $k++;
}
}
$c=array_unique ( $b);
print_r($c);

?>
divyakrishnan 20 Junior Poster

What r u storing on array?post the array values..

divyakrishnan 20 Junior Poster

Or include the page you want to display using include() function

divyakrishnan 20 Junior Poster

Yes I tried that also..But not getting..

divyakrishnan 20 Junior Poster

Use check box to select specific records.Mark the check boxs to be wanted print.

divyakrishnan 20 Junior Poster

What u want?want to set print option to print the report?

divyakrishnan 20 Junior Poster

Create the table before loading other parts of the code.

divyakrishnan 20 Junior Poster

Thank u very much..It is a very good tutorial.

divyakrishnan 20 Junior Poster

U just find out whether your MYSQL server is running or not.
Go to control panel,Administrative Tools,then click Services.There u can find out the MYSQL service.You can start or restart it.After that run the project.

divyakrishnan 20 Junior Poster

Post your php file ps_pagination.php

divyakrishnan 20 Junior Poster

Use the following script

<?php
     
    require 'connect.php';
    $userg = mysql_query("SELECT avatar FROM members")
    or die("Failed to fetch your details.");
     
    if (isset($_SESSION['MM_Username'])){
    echo "Welcome ".$_SESSION['MM_Username'];
?>

<img src="<?php echo mysql_result($userg,0,"avatar" ); ?>" width="50%" height="50%">


<?php
    
     
    }
    ?>
divyakrishnan 20 Junior Poster
divyakrishnan 20 Junior Poster

Hi..
This is a simple script I have used.Hop this will be help full for u.

<html>
<head>
<script type="text/javascript">
function image_zoom_in(id)
{
   document.getElementById(id).height="150";
   document.getElementById(id).width="200";
   
}

function image_zoom_out(id)
{
   document.getElementById(id).height="150";
   document.getElementById(id).width="30";
   
}
</script>
</head>
<body bgcolor="skyblue">
<div align="center"> <table><tr><td><font color=maroon size="18"><b>PhotoGallery</b></font></td></tr></table> 

<br>
<br>
<br>
<table border=5 bordercolor=maroon>
<tr>
<td>
<a  href="#" onMouseOver="image_zoom_in('a1')" onMouseOut="image_zoom_out('a1')">
<img id="a1" src="p1.jpg" width="30" height="150" />
</a>
</td>
<td>
<a href="#" onMouseOver="image_zoom_in('a2')" onMouseOut="image_zoom_out('a2')">
<img id="a2" src="p2.jpg" width="30" height="150" />
</a>
</td>
<td>
<a  href="#" onMouseOver="image_zoom_in('a3')" onMouseOut="image_zoom_out('a3')">
<img id="a3" src="p3.jpg" width="30" height="150" />
</a>
</td>

<td>
<a  href="#" onMouseOver="image_zoom_in('a5')" onMouseOut="image_zoom_out('a5')">
<img id="a5" src="p7.jpg" width="30" height="150" />
</a>
</td>

<td>
<a  href="#" onMouseOver="image_zoom_in('a4')" onMouseOut="image_zoom_out('a4')">
<img id="a4" src="p4.jpg" width="30" height="150" />
</a>
</td>

<td>
<a  href="#" onMouseOver="image_zoom_in('a6')" onMouseOut="image_zoom_out('a6')">
<img id="a6" src="p8.jpg" width="30" height="150" />
</a>
</td>

</tr>
</table>
</div>

</body>
</html>
divyakrishnan 20 Junior Poster
karthik_ppts commented: helpful link +5
divyakrishnan 20 Junior Poster
divyakrishnan 20 Junior Poster

Also put a closing brace '}' on line no 47

karthik_ppts commented: useful +5
divyakrishnan 20 Junior Poster

using FTP u can upload the files to another server.

$file1 = "example.jpg";
$file2 = fopen("ftp://username:password@sitename.com/" . $file1, "w");
$txt= file_get_contents($file1);
fwrite($file2, $file1, strlen($txt));
fclose($file2);

Using CURL also u can upload the files

visit the following links
http://dtbaker.com.au/random-bits/up...rl-in-php.html

divyakrishnan 20 Junior Poster

Hi
I want to set focus to a text field on a php page which is loaded by ajax.
The javascript file for ajax is shown below

<script>
function menu_change(str)
{
	 
	
  if (window.XMLHttpRequest)
  {
	  // code for IE7+, Firefox, Chrome, Opera, Safari
  		xmlhttp=new XMLHttpRequest();
  }
  else
  {
	  // code for IE6, IE5
  	xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	
  }
  xmlhttp.onreadystatechange=function()
  {
    if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
		
    	        document.getElementById("myDiv").innerHTML=xmlhttp.responseText;
				
    }
  }
if(str==1)
  {
    xmlhttp.open("POST","index_search.php",true);
  }
xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
xmlhttp.send("fname=1");

}

</script>

The php file index_search.php is shown below.

<body>
<form action="index.php" method="get" name="f" >
  <div align="center">
    <table width="633" height="232" border="0">
	<caption class="lab">
	<h2 class="style1">
	INDEX SEARCH</h2>
	</caption>
      
      <tr>
        <td width="206" height="53" class="style24">Enter Keyword to Search </td>
        <td width="417">
          <input name="srch_txt" type="text" id="t" class="input_st2"  size="35" >
        </td>
      </tr>
      
      <tr>
        <td height="39" class="style24">Specify Text Position </td>
        <td colspan="2" >
          <input name="txt_pos" type="radio" value="start" />
          <span class="style25">Starting          </span>
          <input name="txt_pos" type="radio"  value="end" />
          <span class="style25">
                  Ending</span>
        <input name="txt_pos" type="radio"  value="any" checked="checked" />
        <span class="style25">Anywhere</span>
        <input name="txt_pos" type="radio"  value="equal" />
        <span class="style25">Exactly</span> </td>
      </tr>
      

      <tr>
        <td height="54" colspan="3"><div align="center">
                     <input name="index_srch" type="hidden" class="butt_s"   id="simple_srch"   value="Find"   />

            <input name="index_srch2" onclick="indx()" type="button" class="butt_s"   id="simple_srch"   value="Find"   />
            
        </div></td>
      </tr>
      <tr>
        <td colspan="3">&nbsp;</td>
      </tr>
    </table>
  </div>
</form>
</body>

I used document.f.srch_txt.focus() .But it not working..

Can someone show me how?
Thanks

divyakrishnan 20 Junior Poster

Hi trivedi,

Thanks for your response. I tried my query with suggestions you made,still returning the same error. If the sum function is removed the query has no error. The problem is with the sum aggregate function.Please help me to solve it.

Thanks In advance

divyakrishnan 20 Junior Poster

Hi,

I have a problem with the following query

select tbl_employee.E_Name,sum(tbl_Salary.Amt),tbl_Dpt.DeptName from tbl_employee inner join tbl_Salary on tbl_employee.eid = tbl_Salary.eid inner join tbl_Dpt on tbl_Salary.eid = tbl_Dpt.eid where tbl_employee.eid ='E101'


When the query is executed,the following error is displayed

"Column ' tbl_employee.E_Name' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause."

I have tried it using group by having clause,but same error is displaying.

Any one please help me to figure out the problem.

Thanks In advance


divyakrishnan 20 Junior Poster

The query is working on Mysql..
My problem is solved now.
Thank you for your help and support.