urtrivedi 276 Nearly a Posting Virtuoso

you must wrap around single quotes

....,'$initial_date',.....
karthik_ppts commented: helpful reply +6
urtrivedi 276 Nearly a Posting Virtuoso

echo $query before execution and copy it and run in phpmyadmin.
also post that output query here.

urtrivedi 276 Nearly a Posting Virtuoso

I assume your employee table has datetime field named trans_date_time (you must change it to exact name at 2 place in following query).

select a.EmployeeID, TransactionAmount  from 
employee a left outer join (
select EmployeeID, max(trans_date_time)  as max_dt_time
 from employee where EmployeeID IN ('E123','E234') group by EmployeeID) b 
on a.employeeid=b.employeeid and a.trans_date_time=b.max_dt_time

If you do not have time component and if employees has more than one transaction in same date then this query will fail

debasisdas commented: agree +13
urtrivedi 276 Nearly a Posting Virtuoso

how is your structure

1) is there any possibility that an employee transacted more than once in same date
or
2)for one date employee will have only one transaction

select your case 1 or 2

urtrivedi 276 Nearly a Posting Virtuoso

I think you do not need mysql_prep

try following code without mysql_prep

$initial_date = $_POST['date'];
urtrivedi 276 Nearly a Posting Virtuoso

you must give another name and ID to inner test button, LIKE test1, test2 etc

urtrivedi 276 Nearly a Posting Virtuoso

actually your format is yyyy-dd-mm

so change your strftime like

strftime("%Y-%d-%m", $datevariable);"

or change your date picker setting to yyyy-mm-dd, then you can directly insert date variable without strftime.

urtrivedi 276 Nearly a Posting Virtuoso

I think you must give 1 after LR for last cell only, so that next character will be printed on new line.

$this->Cell($w[5], 6, $row1['approved_status'], 'LR', 1, 'L', $fill);
urtrivedi 276 Nearly a Posting Virtuoso

I assume that you have phpmyadmin installed in both your local server and live server.

So open phpmyadmin,
select database,
export
select tables and all parameters you want
export to sql file format

now you have your sql file.

Now open phpmyadmin of live server
create database if it is not there
press import
select sql file
and you are done

urtrivedi 276 Nearly a Posting Virtuoso

echo query before executing (as i did it below), then run page in browser, copy query and run in phpmyadmin, see where query updates account.
I think your account number is not matching.

<?php
   
$connect=mysql_connect('localhost','root','');
mysql_select_db('bank',$connect);


if(isset($_POST['account_number']))
    $account_number=$_POST['account_number'];
else
    $account_number='';
	
$query = "UPDATE account_details SET approved_status='1' WHERE account_number='$account_number'";
echo $query."<br>";
$result= mysql_query($query) or die(mysql_error());

   if ($result)
   {
      echo "Account has been successfully approved";
   }
   
  
   
?>
urtrivedi 276 Nearly a Posting Virtuoso

Problem is in your first form it is not posting values properly

urtrivedi 276 Nearly a Posting Virtuoso
<html>
<body>
<script type=text/javascript>
var n=0;

document.write("<table border=1 width=100px>");
while(n<=10)
{

document.write("<tr><td align='center'>"+n);
document.write("</td></tr>")
n++;

}
document.write("</table>");

</script>
</body>
</html>
urtrivedi 276 Nearly a Posting Virtuoso

1) Heredoc may not work (I am not sure) with loops. so I removed heredoc and used simple php string.
2) For FOR loop you should use another iterator, like is repalced i with j, because your while loop is already using i .

<?                      
    $conn = mysql_connect("mysql-g35a.mysqldbserver.com", "goodgu", "Goodguys123");
	$select = mysql_select_db("goodgu");
	$sql = 'SELECT * FROM `feedback` ORDER BY `Index` DESC LIMIT 0, 30 '; 
	$result = mysql_query($sql);
	$num = mysql_numrows($result);
	
	
	
	
	while($i < $num){
		
		$name=mysql_result($result,$i,"name");
		$make=mysql_result($result,$i,"make");
		$model=mysql_result($result,$i,"model");
		$year=mysql_result($result,$i,"year");
		$comment=mysql_result($result,$i,"service");
		$rating=mysql_result($result,$i,"rating");
		$date=mysql_result($result,$i,"date");
		
		echo "<table width='570' border='0'>
		  <tr>
    		<td width='208' bgcolor='#FF0000'>$name</td>
		    <td width='352' bgcolor='#FFFFFF'> Rating: ";

                for($j =0; $j<$rating; $j++){
                    echo "<img src='images/star.jpg'>";
                 }


		echo "&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Date 			of service: $date</td>
		  </tr>
		  <tr>
		    <td bgcolor='#FFFFCC'> 
			$year $make $model</td>
		    <td valign='top' bgcolor='#FFFF99'>$comment</td>
		  </tr>
			</table>";


$i++;
	}//end while
    ?>
urtrivedi 276 Nearly a Posting Virtuoso
Array
(
)

It means your page is not receiving post values. so check the html or the page which is calling your report page.

urtrivedi 276 Nearly a Posting Virtuoso

You have not read my last post properly,
You must use single quote instead of double quote. Also you need to use braces {}
like '{$arr_promoter_count[$a]}'
do you use \" only use '


Post your table structure in sql format here, I will try to debug your query here.

urtrivedi 276 Nearly a Posting Virtuoso

Yes

urtrivedi 276 Nearly a Posting Virtuoso

I think your post is not proper so write following code at line 15, and check what all is posted to your script.

Also copy intialise $date directly without using var_dump

echo "<pre>";
print_r($_POST);
echo "</pre>";

$date =$_POST['date'];
echo $date;
urtrivedi 276 Nearly a Posting Virtuoso

1) Here in insert query \" double quote is not allowed you must use single quote
2) no need to check record exist or not, just use on duplicate key.
(Note: on duplicate key works only in MYSQL, and you must define primary key or unique for the table)

$res=mysql_query("insert into sales_roadshow1      (evnt_id , evnt_start , evnt_end , evnt_status , evnt_type , evnt_title)                            values	('{$arr_event_id[$a]}','{$arr_start_date[$a]}','{$arr_end_date[$a]}','{$arr_status[$a]}','{$arr_event_kind[$a]}','{$arr_event_title_chi[$a]}') on duplicate key update `evnt_title`  = '".$this_event_title."'") ;
urtrivedi 276 Nearly a Posting Virtuoso

Run following sql queries in phpmyadmin sql window. This is how you can create view.

create view  mytableview  as select col1,col2,col3, col4 floor((to_days(curdate())-to_days(date_of_birth))/5) as age
from table

This is how you can use view, if you update date of birth view will give the latest value. no need recalucate or update.

select col1,col2,col3,age from mytableview
urtrivedi 276 Nearly a Posting Virtuoso

you can create view where you can calculate age using above formula and other required columns,
Then you many use your view everywhere, now you just have to use column name age, no need to give formula again.

urtrivedi 276 Nearly a Posting Virtuoso
SELECT a.studId,
a.classId,
a.yearClassTaken as year,
a.grade,
FROM `tblstudent_grades` a inner join 
(SELECT studId,
classId,
max(yearClassTaken) as year,
FROM `tblstudent_grades` group by studId,classId) b on a.studid=b.studid and a.classid=b.classid and a.yearClassTaken =b.year
urtrivedi 276 Nearly a Posting Virtuoso

<?PHP tag is not required at line 18 in your file, you are already in php tag.

<?PHP
.
.
.
.
.
// Count table rows 
$count=mysql_num_rows($result);

/////*************<?php THIS TAG IS NOT REQUIRED***************

while($rows=mysql_fetch_array($result))
{

?>
<tr>
<td align="center" bgcolor="#FFFFFF"><input name="checkbox[]" type="checkbox" id="checkbox[]" value="y" /></td>
.
.
.
.
urtrivedi 276 Nearly a Posting Virtuoso

I would go for separte relational table for expertise and approches. Otherwise you have to struggle a lot to save, extract, report, query data in current case.
Also if your CEO ask to allow 5 expertise and 3 approches then all effort are to be made again.

urtrivedi 276 Nearly a Posting Virtuoso

too much detailed information is posted.

urtrivedi 276 Nearly a Posting Virtuoso

You are trying to mix two different areas into one.
Its true that you may store files in binary format in databases, but that feature is rarerly used.
Better option is
you may keep your files on server and save address (path) of that file in database column.

Access restriction is also possible.

urtrivedi 276 Nearly a Posting Virtuoso
$test2=$test1
karthik_ppts commented: yes +6
urtrivedi 276 Nearly a Posting Virtuoso

1) keep process page separte from user form.
2) use cookies to ignore execution of process code twice.

urtrivedi 276 Nearly a Posting Virtuoso

for MENU you may user superfish.
for tabs you may use JQUERY-UI-TABS

urtrivedi 276 Nearly a Posting Virtuoso

what is the source type, is it php or any other process page?

I have done using php-jquery and post method

<?php 		
	
 	if(trim($_POST['type'])=='batch')
	{
	 	//you may user $_POST['batchid'] variable to filter result
	 	//onthe basis of condtion you can echo your select element here
		echo "<select>";
		echo "<option value=''>--select-</option>";
		echo "<option value='1'>one</option>";
		echo "<option value='2'>two</option>";
		echo "<option value='3'>three</option>";				
		echo "</select>";
		exit;
	}
	else
	{

	
	
?>
<html>
<head>
<script type="text/javascript" src='../../modules/jquery/jquery.js'></script>
</head>
<form name='frm' id='frm' action="a.php" method="POST" onsubmit="return val();">
     <table>
    

     <tr><td>   <strong>Batch</strong> *</td>
		<td>
		<select name=sel id=sel>
	    <!--option value=''> All</option-->		
		<option value='b1'> batch 1</option>
		<option value='b2'> batch 2</option>
		<option value='b3'> batch 3</option>				
		</select>
		</td>
        </tr>
        
        
        
      <tr><td>   <strong>Mobile</strong> *</td>
		<td ID=loadstudents>
		&nbsp;</td>
        </tr>

        </table>
        <input type="submit" value="submit" oncddlick="return val();" />
    </form>


<script type="text/javascript">

 

function loadall(){

    bt=document.getElementById("sel").value;
	
	if(bt=='')
		return;
	
	$.post("<?php echo $_SERVER['PHP_SELF'];?>",{batchid:bt,type:"batch"}, function(data){

 	document.getElementById("loadstudents").innerHTML=data;
}) ;

}

$('#sel').change(loadall);

loadall();
</script>

    </html>
    
    <?php
    }
    ?>
urtrivedi 276 Nearly a Posting Virtuoso
select '03-01-2011 to 08-03-2011' AS Year,
OrderDetails.ProductCode AS ProductCode,
OrderDetails.ProductName AS ProductName,
Count(distinct OrderDetails.OrderID) As Orders,
sum( OrderDetails.qty) As total_qty,
sum( OrderDetails.amount) As total_amount,
FROM OrderDetails WITH(NOLOCK) 
INNER JOIN Orders WITH(NOLOCK) ON OrderDetails.OrderID = Orders.OrderID
LEFT JOIN Products_Extended pe ON OrderDetails.ProductID = pe.ProductID 
WHERE Orders.OrderStatus = 'Shipped'
Orders.OrderDate between  '2011-03-08' and '2011-01-03'
GROUP BY
'03-01-2011 to 08-03-2011' ,
OrderDetails.ProductCode,
OrderDetails.ProductName
urtrivedi 276 Nearly a Posting Virtuoso

are you sure include_fns.php is in same folder as your source file. if not find proper path of that file.

urtrivedi 276 Nearly a Posting Virtuoso

I have changed code but I think you are not still sure what you want in last 2 columns in case of rtype='RA', so I have used default condition.

select
ESN ,
 Supplier,
 RType ,
 WarrantyPeriod ,
 TodaysDate ,
 Returndate ,
 Receivedate ,	 
DATEDIFF(day,  case when RTYPE='CRA' AND Supplier in ('AC8' ,'BEI','JAB','TRC')   THEN  RECEIVEdate 
                    when Supplier in ('FIH') THEN  dateadd(day,-3,RECEIVEdate)
                    WHEN  RTYPE='RA' THEN RECEIVEdate END, todaysdate) TOTALDAYS

,CASE WHEN DATEDIFF(day,  case when RTYPE='CRA' AND Supplier in ('AC8' ,'BEI','JAB','TRC')   THEN  RECEIVEdate 
                    when Supplier in ('FIH') THEN  dateadd(day,-3,RECEIVEdate)
                    WHEN  RTYPE='RA' THEN RECEIVEdate END, todaysdate)
<WarrantyPeriod THEN 'YES' else 'N0' END WarrantyDecision 
from mytable

I am also not sure why you have today's date columns, I have used current system date below.

select
ESN ,
 Supplier,
 RType ,
 WarrantyPeriod ,
getdate() TodaysDate ,
 Returndate ,
 Receivedate ,	 
DATEDIFF(day,  case when RTYPE='CRA' AND Supplier in ('AC8' ,'BEI','JAB','TRC')   THEN  RECEIVEdate 
                    when Supplier in ('FIH') THEN  dateadd(day,-3,RECEIVEdate)
                    WHEN  RTYPE='RA' THEN RECEIVEdate END, getdate()) TOTALDAYS

,CASE WHEN DATEDIFF(day,  case when RTYPE='CRA' AND Supplier in ('AC8' ,'BEI','JAB','TRC')   THEN  RECEIVEdate 
                    when Supplier in ('FIH') THEN  dateadd(day,-3,RECEIVEdate)
                    WHEN  RTYPE='RA' THEN RECEIVEdate END, getdate())

<WarrantyPeriod THEN 'YES' else 'N0' END WarrantyDecision 
from mytable
urtrivedi 276 Nearly a Posting Virtuoso

Your mistakes,
1) with case you can not write condition
2) ignore using single quotes when comparing numbers
3) $ sign is not applicable to pure javascript. use variables without $ sign

<html>
<body>
<script type="text/javascript">

var age = Number(prompt("Enter Your Age: "));



if(age>=1 && age<=8) {
document.write('Paramihan ng Toys!');
}

else if(age>9 && age<18) {
document.write('Pataasan ng Grades!');
}

else if(age>19 && age<25) {
document.write('Padamihan ng Syota!');
}

else if(age>26 && age<35) {
document.write('Pagandahan ng Asawa!');
}

else if(age>36 && age<45) {
document.write('Palakiha ng Income!');
}

else if(age>46 && age<55) {
document.write('Padamihan, Pagandahan at Pabataan ng kabit!');
}

else if(age>56 && age<70) {
document.write('Padamihan ng sakit!');
}
else if(age>71) {
document.write('Pabonggahan ng Libing!');
}
else {
document.write("Invalid Age!");
}


</script>
</body>
</html>
urtrivedi 276 Nearly a Posting Virtuoso

you forgot to give name and id to form. Here is proper code.

<form name='a' id='a' action="a.php" method="POST" onsubmit="return val();">
urtrivedi 276 Nearly a Posting Virtuoso

Date is little complex thing to begin with. You are intialising Y to date and comparing with integer.
So If you learning JS, then start with simple types. Use chrome, you may find javascript debugger in chrome tools.

Reference http://www.w3schools.com/js/default.asp

urtrivedi 276 Nearly a Posting Virtuoso

for php mysql
you may use www.0fees.net

urtrivedi 276 Nearly a Posting Virtuoso

we must separte variables by comma to consider for comparision.
If you enclose them with quote, then whatever between quotes is taken as one variable.
a) '1,3' searches for whole 1,3 as one unit

b) 1,3 searches for two separate variables 1 and 3

c) '1','3' has same effect as b above.

urtrivedi 276 Nearly a Posting Virtuoso

try to write following portion of query without single quote

meetings.unit_id IN ($session_unitidgrouping)
urtrivedi 276 Nearly a Posting Virtuoso

remove comma (,) before where

urtrivedi 276 Nearly a Posting Virtuoso

You can not embed php tag inside php code, so following is the correct line

print "<tr><td><font color=\"#0080FF\" face=\"sans-serif\" size=\"2\"><b>emp nbsp</b><input type='text' name='txt1' size='10' style=text-transform:uppercase maxlength='7' value=\"{$_POST[txt1]}\" ></font></td></tr>";
urtrivedi 276 Nearly a Posting Virtuoso

You post your output of query here, also check that output query in phpmyadmin, see how it works

$query="you query";
echo $query;
urtrivedi 276 Nearly a Posting Virtuoso

are you able to run page.
If yes then you must view source and look where the quotes are misplaced.

urtrivedi 276 Nearly a Posting Virtuoso

try to add slashes instead of real escape

$title= addslashes($_POST[title]);	
$description= addslashes($_POST[description]);
urtrivedi 276 Nearly a Posting Virtuoso

if you are sure that value of $session_unitidgrouping will always like x,y,z where x y z are integers (not characters).

I mean separted by comma, then you must use IN keyword, not LIKE.

Here is your new query

$query="select meetings.meeting_date, meetings.unit_id as unitid	from meetings	where meetings.status_id = '20' and  

meetings.unit_id	in ($session_unitidgrouping) 

Order by meetings.meeting_date asc";
urtrivedi 276 Nearly a Posting Virtuoso

If you are writing all options on your own (hard coding) then you have to write all conditions,
but if you have table in mysql, then you can use for loop.

urtrivedi 276 Nearly a Posting Virtuoso

one table,
I hope you have unitmaster table. whose pk is related in parts table say unitid, because each part may be having differenct unit id

Stock update may have one more problem
If you allow user to change or delete record, that should also change stock levels

urtrivedi 276 Nearly a Posting Virtuoso

follow this post I think you will get your answer

http://www.daniweb.com/web-development/php/threads/287110

urtrivedi 276 Nearly a Posting Virtuoso

I am modifying 23,24,25 line of your code. Id must be unique so you are giving same id to all rows.
Use commentid to set id of TD.

<div onmouseover="show(document.getElementById('link<?php echo $row['commentId']?>'));" 
onmouseout="hide(document.getElementById('link<?php echo $row['commentId']?>'));">               
<?php echo $row['comment_cm'] ?>               
<a href="aa.php" id="link<?php echo $row['commentId']?>" >Edit</a>
devindamenuka commented: good answer +1
urtrivedi 276 Nearly a Posting Virtuoso

as I said you can not use LIKE keyword, as you know that once "user_name" votes, then all having starting with "user_name23", "user_name64", "user_name4tg", will not able to vote.

so best way is use = sign

rated  = '$_SESSION[username]'

LIKE is used only when you are searching something that you are not much sure.

urtrivedi 276 Nearly a Posting Virtuoso

post your latest html page and mail.php page here using advance editor

also you are using echo $_GET but in url you can see variable name is message

so change to $_GET in contact form .php