urtrivedi 276 Nearly a Posting Virtuoso

you need to create after insert trigger on employee table, in which you should write update statement for department table

update department set no_of_employees =no_of _employees+1 where dept_id=new.dept_id

then you create delete trigger
update department set no_of_employees =no_of _employees-1 where dept_id=old.dept_id

then you create update trigger
update department set no_of_employees =no_of _employees+1 where dept_id=new.dept_id
update department set no_of_employees =no_of _employees-1 where dept_id=old.dept_id


http://dev.mysql.com/doc/refman/5.0/en/triggers.html

urtrivedi 276 Nearly a Posting Virtuoso
urtrivedi 276 Nearly a Posting Virtuoso

For sheet to work, I think you must have loop in lopp

for 1 to n worksheet
while cell empty
end while
end for


and for duplicate checking ur codes may hang due to deadlock, you can follow the link given here
http://stackoverflow.com/questions/108403/solutions-for-insert-or-update-on-sql-server

urtrivedi 276 Nearly a Posting Virtuoso

One query is not related to another query unless you execute both together in (one combined query).

You must have some flag in table to track the changes, buy using this flag u can filter your result.

urtrivedi 276 Nearly a Posting Virtuoso

what do u mean by "hasnt been selected"

urtrivedi 276 Nearly a Posting Virtuoso

1) Modify your script as given below. You can not generate number all time user press button. Instead you must generate number only once, outside the function.

2) Also random number generated is float, so you must round it to match properly

var number = Math.round((Math.random() * 9) )+ 1;

function guessed() 
{
	
	var guessField = document.getElementById('guess');
	var choice = guessField.value;
	
	var win = 0;
	
	while (win == 0)
	{
		if (choice > number)
		{
			var output = document.getElementById('output');
			output.value = 'Guess lower';
			win = 0;
		}
		else if (choice < number)
		{
			var output = document.getElementById('output');
			output.value = 'Guess higher';
			win = 0;
		}
		else
		{
			var output = document.getElementById('output');
			output.value = 'Correct, you win!';
			win = 1;
		}
		
		return false;
	}
}
urtrivedi 276 Nearly a Posting Virtuoso

I think this must work

SELECT ma5.alert_value,period_id,year_id
FROM company_alert ma5
LEFT JOIN qiddb.company_info mb5 ON (mb5.stock_code=ma5.stock_code)
LEFT JOIN ref_sector mc5 ON (mc5.sector_code=mb5.sector_code)
WHERE ma5.alert_id='DSO' AND mc5.sector_code='s06' 
AND (

ma5.year_id*10+ma5.period_id between 2009*10+3 and 2010*10+1 

)


GROUP BY year_id,period_id

2009*10+3 and 2010*10+1 you just change parameter of year period through ur front end

urtrivedi 276 Nearly a Posting Virtuoso

it your choice when u call, I have just shown demo. U run it separately and check it works or no

urtrivedi 276 Nearly a Posting Virtuoso

You try this code in separate page, then try to do in ur logic.

<?php 
//find out how many check box u have from database,
 $noofcheckboxes =5 ;

?>

<script lang='javascript'>
	//on page load we assume that 0 boxes checked
	var checkedcount=0;
	
	//this fuction is called when any box is checked or unchecked, it wil update checkedcount variable
	function checkinfo(chkbox)
	{
			
			if(chkbox.checked==true)
				checkedcount++;
			else
				checkedcount--;
	
	}
	     
	//this fucntion is called when form is submitted
	function checkdata()
	{
		
		if(checkedcount==0)
		{	
			alert("Please select At least Customer ");//At least one record must be checked for delete
			return false;
		}
		alert("ok");//
	}
</script>

<body >
<form>

<input type=checkbox id=cust_id[0]   name=cust_id[0] value=c1 onclick='javascript:checkinfo(this);' > cust 1<br>
<input type=checkbox id=cust_id[1]   name=cust_id[1] value=c2 onclick='javascript:checkinfo(this);' > cust 2<br>
<input type=checkbox id=cust_id[2]   name=cust_id[2] value=c3 onclick='javascript:checkinfo(this);' > cust 3<br>
<input type=checkbox id=cust_id[3]   name=cust_id[3] value=c4 onclick='javascript:checkinfo(this);' > cust 4<br>
<input type=checkbox id=cust_id[4]   name=cust_id[4] value=c5 onclick='javascript:checkinfo(this);' > cust 5<br>

<br>
<input type=button onclick='checkdata()' value=check >
<br>

</form>
</body>
urtrivedi 276 Nearly a Posting Virtuoso

I assume that you have only one form on page,
so to solve your problem, change all

document.forms.useraction.action

to

document.useraction.action
urtrivedi 276 Nearly a Posting Virtuoso
fputs($fp, "{$_POST['Fullname']},{$_POST['Jobtitle']}, {$_POST['email']} ,{$_POST['file']} ,\n");

Use braces {} to encapsulate variables in string

urtrivedi 276 Nearly a Posting Virtuoso
SELECT SUM(ma5.alert_value) 
FROM company_alert ma5 
LEFT JOIN qiddb.company_info mb5 ON (mb5.stock_code=ma5.stock_code) 
LEFT JOIN ref_sector mc5 ON (mc5.sector_code=mb5.sector_code)
WHERE ma5.alert_id='VPAEH' AND mc5.sector_code=ref.sector_code AND 
ma5.year_id BETWEEN '2009' AND '2010' 
AND (
ma5.period_id BETWEEN 'q3' AND 'q1' 
   or 
ma5.period_id BETWEEN 'q1' AND 'q3' 
)

I think between will work proper only for number not string like q1 q3, you must compare like 1, 3 etc

any way I have added or condition for ur period, Parenthesis are very important

urtrivedi 276 Nearly a Posting Virtuoso

tcpdf libraries are something to ready made using which u can generate barcode reports.
If you still want to use your own logic, then specify teh exact problem, which part of code is failing in your case.

urtrivedi 276 Nearly a Posting Virtuoso

you must use html element array

<input type="text" class="edit bk" name="links[]"  id="links[]" style="width:350px">

Here is used [] IN NAMING html

now in php you will get array of links and u can use it as follows

$totaltextbox=count($_POST[links])
for ($i=0;$i<$totaltextbox;$i++)
{
  if(trim($_POST['links'][$i])=="")
       echo $_POST['links'][$i]."<br>"   ;
}
urtrivedi 276 Nearly a Posting Virtuoso
if (trim($link_one)!="")
    $db->query( "INSERT INTO " . PREFIX . "_post_links (matchid, link) VALUES('{$row}', '{$link_one}')" );

if (trim($link_two)!="")
   $db->query( "INSERT INTO " . PREFIX . "_post_links (matchid, link) VALUES('{$row}', '{$link_two}')" );

if (trim($link_three)!="")
   $db->query( "INSERT INTO " . PREFIX . "_post_links (matchid, link) VALUES('{$row}', '{$link_three}')" );


if (trim($link_four)!="")
   $db->query( "INSERT INTO " . PREFIX . "_post_links (matchid, link) VALUES('{$row}', '{$link_four}')" );
reco21 commented: Well done +1
urtrivedi 276 Nearly a Posting Virtuoso
<html>
 
 
<script language="javascript"> 
 
	function validate(dt1,dt2)
	{
		
		var jdt1=Date.parse('20 Aug 2000 '+dt1);
		var jdt2=Date.parse('20 Aug 2000 '+dt2);
		alert(jdt1);
		if(jdt1==NaN)
		{
			alert('invalid start time');
			return false;
		}
		if(jdt2==NaN)
		{
			alert('invalid end time');
			return false;
		}
	  	if (jdt1>jdt2)
		{
			alert('start is greater');
		}
		else
		{
			alert('start is less equal');
		}
	
		
	}
	
</script>
 
<body>
<div>
 
 
<form name=frm id=frm action=temp.php method="get" accept="text/csv">
<P>&nbsp;</P>
start <INPUT id=txt1 name=txt1 value='10:30:05 am'>&nbsp; <br>
end <INPUT id=txt2 name=txt2  value='10:40:05 am'>&nbsp; 
<input type=button value=ok id=button2 name=button2 onclick ='validate(document.frm.txt1.value,document.frm.txt2.value)'>&nbsp;&nbsp; 
 </P>
</form></div>
<script language='javascript'> 
</script>
<div id="txtHint">&nbsp;
</div>
<P></P>
 
</body>
</html>
karthik_ppts commented: Helpful post +6
urtrivedi 276 Nearly a Posting Virtuoso
select date_format(datecolname, '%d-%m-%Y') as formated_date from tablename
urtrivedi 276 Nearly a Posting Virtuoso

you can create two separate pages for say
1) current
2) archive

the difference is only in query

for current

select * from tablename where deadline>current_date()

for archive

select * from tablename where deadline<=current_date()
urtrivedi 276 Nearly a Posting Virtuoso

following code is fine

header('Location: http://www.example.com/'); //redirects user
exit;

you can ask your server administrator HOW TO SET DNS property. They might help you to map ip<->domain.

urtrivedi 276 Nearly a Posting Virtuoso
$list=implode(",",$q);

$query=" SELECT * 
FROM table 
WHERE ID in ($list)";
urtrivedi 276 Nearly a Posting Virtuoso
SELECT `date`,`destination`,`callsec`,`tbl_cost`,`callsec`*`tbl_cost` AS price,
trim(substring(destination,1,length(tbl_code))) billcode , trim(tbl_code) feecode
 FROM  billing left JOIN `fees`  ON  trim(substring(destination,1,length(tbl_code))) =trim(tbl_code)

1) What is output of this query?

2) check Do you have code starting with 083 or 83 in fees table?

urtrivedi 276 Nearly a Posting Virtuoso

Following query may work but this may cause to slow down performance.

SELECT `date`,`destination`,`callsec`,`tbl_cost`,`callsec`*`tbl_cost` AS price FROM  billing left JOIN `fees`  ON  substring(destination,1,length(tbl_code)) =tbl_code
urtrivedi 276 Nearly a Posting Virtuoso
SELECT * FROM billing order by tbl_code
SELECT * FROM  fees order by tbl_fee

You run this 2 queries separately and post both exact results here (few top rows)

urtrivedi 276 Nearly a Posting Virtuoso

When I run your command it show the same result the whole time.

What do you mean by that, The query is perfect.

urtrivedi 276 Nearly a Posting Virtuoso

1) what are columns name of both tables?
2) Is you table 2 holding value as 'fee 011' (will it always have fee prefix in all records) or table 2 is holding 011, 012 like that

urtrivedi 276 Nearly a Posting Virtuoso

I think you must save html code for each element in database. For example you keep few default input element in database say (id, html_code)

Populate all id with html_code on left side as sample, so when some one click any id button. copy corresponding code to your new design division.

In jquery you will easily find inner html to save in database.

I hope I am on the right track.

urtrivedi 276 Nearly a Posting Virtuoso

remove this line from loginform.inc, you have already included core.inc.php.

require 'core.inc.php';

or use

require_once('core.inc.php');
urtrivedi 276 Nearly a Posting Virtuoso

I think this could help you.

$row_rs_propdetails['add_date']=strtotime($row_rs_propdetails['add_date']);//this will convert mysql text date to php date object
echo  date('Y-m-d',$row_rs_propdetails['add_date'] );//now show date object in required format
urtrivedi 276 Nearly a Posting Virtuoso

batchmaster
batchid, batchname
1, batch1
2, batch2
3, batch3

studentmaster
studid,studname,batchid, emailid
1, abc, 1, ab@yahoo.com
2, pqr, 1, pr@yahoo.com
3, xyz, 1, xz@gmai.com
4, rms, 2, rms@gmail.com
5, opm, 2, pmo@gmail.com
6, abc, 2, bc@yahoo.com

In any table to avoid chaos or confusion we shold always select one primary key. primary key is used to identify each row distinctly, means when u say studid 6, you will find row with studid id 6 easily,
But if you same studname abc, then you will not able to decide which record to refer, 1 or 6.

Here In table batchmaster
we select batchid as primary key and in studentmaster we select studid as PK


Foreign key
It is used to refer details of other table to avoid duplicate entries. To mention batch for rms we only refer to its batch id and not whole batchname.

so batchid column in studentmaster table is know as foreign key as its details are found in some foreign table, we just store reference to it

UNique key
Some time in table you will need row values to be unique like emailid, userid like that. but you already have one primary key i n studentmaster so, we will set emailid to unique key.

Unique key help us to avoid entry of duplicate email ids in studentmaster

…
urtrivedi 276 Nearly a Posting Virtuoso

download php-tcpdf libraries, it has feature to build barbodes with pdf report.

urtrivedi 276 Nearly a Posting Virtuoso

you need to quote around date and text, only numbers are allowed to write without qoutes

so
1) do not change your datatype
2) post your query (not output) only php mysql query with variables names, i will prepare query for you.

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 think you do not need mysql_prep

try following code without mysql_prep

$initial_date = $_POST['date'];
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

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

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

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
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

too much detailed information is posted.

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

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

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;