urtrivedi 276 Nearly a Posting Virtuoso

Problem is with keyword index, Your table's column name is index so it is giving an error. following is the code with escape character `

SET @counter:=0;
SET @previndex:=0;
SET @prevorderindex:=0;

SELECT `index`, orderindex,
@counter:=(CASE WHEN @previndex=`index` AND @prevorderindex=orderindex THEN @counter +1 ELSE 1 END) srno,
@previndex:=`index`,
@prevorderindex:=orderindex
FROM orders1
ORDER BY `index`,orderindex
urtrivedi 276 Nearly a Posting Virtuoso

which version of mysql you are using. Subselect works from 4.1.

urtrivedi 276 Nearly a Posting Virtuoso

I have checked above code in phpmyadmin it is working fine. What error you are facing

urtrivedi 276 Nearly a Posting Virtuoso

I am attaching a document which may help you in undestanding and mapping your needs to it.

urtrivedi 276 Nearly a Posting Virtuoso

You may use substr function

urtrivedi 276 Nearly a Posting Virtuoso

You must keep id column unique at database level. Without checking the duplication at frontend, you must attempt to insert a new row. If id exist in database it will throw an error with error code which you should trace in your code. if error code is for duplicate id then display appropropriate message and allow user to change id.

urtrivedi 276 Nearly a Posting Virtuoso

There is no rule for using multiple join. It depends on the structure of your table. If your table has any column which referes to pk of same table. then you need to use multiple join in order to retrive information.

urtrivedi 276 Nearly a Posting Virtuoso

You print your failing query string on screen.
Copy it and execute in mysql query browser or phphmyadmin or msql prompt directly. There you will find the actual problem.

System.out.println("insert into Reservation values(" + maxResID + "," + maxGuestID +",'"+ChkPrepaid.getSelectedObjects()+",'"+txtCheckInDate.getText()+"','"+txtCheckOutDate.getText()+ "'");
urtrivedi 276 Nearly a Posting Virtuoso

I dont think so.

urtrivedi 276 Nearly a Posting Virtuoso

I am not sure about that option. You just look the file property from windows explorer, ie size of MDF file and size of LDF file. I guess size of LDF will be very large in your case.

urtrivedi 276 Nearly a Posting Virtuoso
$result = mysql_query("SELECT name FROM user WHERE month(dob) = '$current_month' AND day(dob) >= '$current_day' ")
urtrivedi 276 Nearly a Posting Virtuoso
SELECT id ,venu
FROM [dbo].SOL_ACTV_VENU
where venu in (select venu from FROM [dbo].SOL_ACTV_VENU
group by  venu 
having count(venu) > 1
order by sum(stud)

)
urtrivedi 276 Nearly a Posting Virtuoso

change select venu from......

Exactly what do you want.
for example for venu 6 you have two id (11,13), for venu 2 who have only one id (4) .
Now tell me what you want to display.

urtrivedi 276 Nearly a Posting Virtuoso

group by venu

urtrivedi 276 Nearly a Posting Virtuoso

your er diagram could be of two types
1) logical: used to understand database conceptually, may not reflect actual no of table in database. for e.g when showing many to many relation we may show only 2 related entities in diagram
2) physical: user to show all table used in database. you can say all sql tables may be mapped to physical er diagram for e.g when showing many to many relation we may show all 3 entities in diagram

urtrivedi 276 Nearly a Posting Virtuoso

Generally log file occupies more space in sql server 2000, I dont know about later version. You need to shrink your database. Some time shirnk option does not help much. try following steps. Keep backup of whole database before doing anything.

HOW TO DELETE/REDUCE LOG FILE SIZE IN SQL SERVER 2000
HOW TO DELETE / REDUCE / SHRINK SQL SERVER 2000 DATABASE LOG FILE SIZE

I was devleoping SNGPL Remmittence Reporting system during my job @ NIFT. After about 4 months we noticed that SQL Server 2000 log file size of reporting system was above 35 GB which was of no use. So, we tried to shrink log file size using the recommened methods but no result. Then i developed the following strategy which reduced the log file(LDF) and took it back to just 512KB-1MB.


1. Detach your target database and copy its MDF and LDF file from actual location to some different location. (e.g. SQL Server 2000 installed at C:\Program Files\Microsoft SQL Server\ stores its data files in C:\Program Files\Microsoft SQL Server\MSSQL\Data\)
2. Create a new database with the same name and same MDF and LDF files.
3. Stop sql server, delete the new MDF and LDF file and copy the original MDF (the file you moved to some different location in step 1) to this location.
4. Restart SQL Server and open Query Analyzer to run following scripts. Select Database "master" from the drop down in query analyzer.

urtrivedi 276 Nearly a Posting Virtuoso

I found solution in mysql.

set @counter:=0;
set @previndex:=0;
set @prevorderindex:=0;

select index, orderindex, 

@counter:=(case when @previndex=index and @prevorderindex=orderindex then @counter +1 else 1 end) srno, 

@previndex:=index,
@prevorderindex:=orderindex

 from tablename 

order by index,orderindex;
urtrivedi 276 Nearly a Posting Virtuoso

set @counter:=6000;
select *, @counter:=(@counter +1) rownum from tablename;

urtrivedi 276 Nearly a Posting Virtuoso

You are passing only quantity in value tag of check box. for deleting and inserting you need to have some primary key information in value of checkbox. post[id] array will contain only checked rows. you must set value of checkbox in following manner value = '{$row[0]},$row[4]' . I am assuming row[0] contains primary key of table.

I have given you the foreach loop for updating the table, now you can use same loop for both insertion and deletion. foreach loop will work independtly no need to keep it in while loop
following code should be kept in action page of your form.

$keylist="";	
foreach ($_POST['id'] as $tablename_value) 	
{	    
 	$arr=split(",",$tablename_value);
 	//$arr[0] is primary key $ROW[0]
 	//$arr[1] is quantity value $ROW[4]
 	$deletequery="DELETE FROM TABLE1 WHERE PKCOLUMN='{$arr[0]}'";
 	$insertquery="insert into table2 (pkcol,quantitycol) values('{$arr[0]}','{$arr[1]}')";
}
urtrivedi 276 Nearly a Posting Virtuoso

I didnt find such website till date. otherwise you need to purchase gsm modem and you may connect your mobile to it and then can send a message. but that will also need some investment. Nothing comes free.

urtrivedi 276 Nearly a Posting Virtuoso

You need not to do it in query, you can do that it one loop using php code. Also you need to add order by statment at the end of your query. i.e. order by index,orderindex

$resulthdr = oci_parse($connection, $queryhdr);


if (!(oci_execute($resulthdr)))
	showerror();

print "\n<font face='sans-serif' size=1 color=#000000>";     
print "\n<table>" ;
print "\n<tr>";
print "\n<td width=225 align=left>INDEX</td>";
print "\n<td width=150 align=left>ORDER INDEX</td>";				
print "\n<td width=225 align=left>ORDER NO</td>";
print "\n</tr>";

$prevorder="";
 while($rowhdr=oci_fetch_assoc($resulthdr))
 {
  	if($prevorder==$rowhdr['INDEX'].",".$rowhdr['ORDERINDEX'])
  	{
		$orderno++;	  	 		
 	}
 	else
 	{
 		$orderno=1;
	}
	print "\n<tr>";
	print "\n<td width=225 align=left>{$rowhdr['INDEX']}</td>";
	print "\n<td width=150 align=left>{$rowhdr['ORDERINDEX']}</td>";				
	print "\n<td width=225 align=left>{$orderno}</td>";
	print "\n</tr>";
	$prevorder=	$rowhdr['INDEX'].",".$rowhdr['ORDERINDEX'];
}
print "</table>";
print "</font>";
urtrivedi 276 Nearly a Posting Virtuoso

You need to purchase packages from service provider, who will provide you the api and ip addresses for interfacing your website and their website for sending sms. www.smsmuic.co.in

urtrivedi 276 Nearly a Posting Virtuoso

I assume following code will work for you. Place this code in your action file where you are updating your database.

$keylist="";
	foreach ($_POST['cc'] as $key => $value) 
	{
	    if($i==0)		 
	 		$keylist.=$key;
	    else
			$keylist.=",".$key;
		$i++;
	}	

	$updquery="update central set checkcolname='Y' where keycolumnname in ($keylist)";

//	exeucte_update_query($updquery); use proper syntax
urtrivedi 276 Nearly a Posting Virtuoso

I have some doubt

Exactly what do you want?

Do you have column for checkbox say yes/no or 0/1 in central table ?

If user checks the check box of some row, then submits the form what you want to do?

do you want to reflect check values in database when user open abouve page?

Please clearify.

urtrivedi 276 Nearly a Posting Virtuoso
<?php
$link = mysql_connect('localhost', 'mysql_user', 'mysql_password');
if (!$link) {
    die('Could not connect: ' . mysql_error());
}
mysql_select_db('mydb');

mysql_query("INSERT INTO userinfo (col1) values ('value1')");
$keyid= mysql_insert_id());

mysql_query("INSERT INTO auth_user (uid,col1) values ('{$keyid}','value1')");

?>
urtrivedi 276 Nearly a Posting Virtuoso

Try following code

<?php
	$headers= "MIME-Version: 1.0\n";
	$headers.="Content-type: [b]text/html;[/b] charset=iso-8859-1\n";
	$headers.="cc: cc@daniweb.com\n";				
	$tomail="tosomeone@daniweb.com";

	$message="<bold>This is message for email</bold>\n\n<br><br>";
	$message.="<i>Nb : This message may be written in complete html format .</i>";
	mail($tomail,"This is mail subject ",$message,$headers);

?>
urtrivedi 276 Nearly a Posting Virtuoso

Following code is for 3 columns and n no of rows. it will print you ID as
1 2 3
4 5 6
....

<?php 
	$isrowopen=false;
	$totalrows=0;
	while ($prows = mysql_fetch_array($rs_pending)) 
	{   
		$totalrows++;
		if((($totalrows)%3)==1)
		{
		     print "\n<tr>";
	          $isrowopen=true;			     
	    }
	    ?>
	
	    <td>#<?php echo $prows['id']?></td>

	    <?php
		if((($totalrows)%3)==0)
		{			
		     print "\n</tr>";
			$isrowopen=false;						
		} 
	}         
	
	if ($isrowopen && (($totalrows)%3)==1)
			print "\n\t\t<td>&nbsp;</td><td>&nbsp;</td></tr>";	     
	else if ($isrowopen && (($totalrows)%3)==2)
		print "\n\t\t<td>&nbsp;</td></tr>";	     
?>
urtrivedi 276 Nearly a Posting Virtuoso

I think there is not problem in keeping 2 separate files especially when you code is so lengthy. I am not able to understand that what problem you are facing with 2 separate files.
In your merged file there is some problem with php braces{} one end brace is missing. so better you resolve your problem without merging.

urtrivedi 276 Nearly a Posting Virtuoso

You may simply ignore foriegn keys in select statment. and still you will be able to use them in where or join condition.

urtrivedi 276 Nearly a Posting Virtuoso

Make changes highligted below

$sql = "SELECT d.title, d.mktime, COUNT(r.id) FROM documents AS d LEFT JOIN clickreg AS r ON r.docid = d.id 
[b]group by d.title, d.mktime [/b]"
urtrivedi 276 Nearly a Posting Virtuoso

If you are using "select * " then change the query, you must specifically select the columns you want in your view from various tables. If still two columns from diffrerent table has same name then give alias to one of them.

urtrivedi 276 Nearly a Posting Virtuoso

make the change in your query as hightligted below

$data = "UPDATE inventors SET month='$month',
day='$day', year='$year', [b]date='{$year}-{$month}-{$day}'[/b] 
WHERE lastname=".'"'.$lastname.'"';
urtrivedi 276 Nearly a Posting Virtuoso

"20.106.50" This is not a valid ip address . find actual ip address. save php ini file after modification and then restart apache services

urtrivedi 276 Nearly a Posting Virtuoso

[mail function]
; For Win32 only.
SMTP = IP ADDRESS OF YOUR MAIL SERVER;
smtp_port = 25

If You write localhost you must configure your local server for mail operation.

urtrivedi 276 Nearly a Posting Virtuoso

I understand your requirement. Thats what I have mentioned in my algorithm.
Feature of above alorithm are as follows
1) Your scirpt will find all users with their email ids, (you must store email id of user in user table).
2) scipt will find all expire records for each user.
3) It will build email message for each user.
4) It will set alert_sent flag to YES to avoid repeatation of email message.( this column must be added in your expire record table)
5) It will use PHP mail function to send built message.
6) The above script will be scheduled on your web server to execute and send mail to the users everyday. mailing facity must be configured on Your web server.

7) user authendtication or login is not required

I hope you will get my point.

urtrivedi 276 Nearly a Posting Virtuoso

you can put your code along with other source file or any other location say cron folder. You may remove session login code from the begining of source file. because the new script will be executed by the system and not by the user. Mail function of php does not require email login.
Also You need to keep one column in exipry record table say "alert_mail_sent". after sending mail you need to set flag to yes.
If you dont do above things then user will get mail every day.

Modified code is as follows

find users query

	while (all users)
	{
		htmlmessage=""

		while ( find all expired records where mail is not sent for current user (as you are doing in your code for logged user only))
		{

		   create htmlmessage string intead of echoing output directly to browser.
		   set mail sent flag for current user and current record to yes (mysql update)
		}
                if(htmlmessage!="")
			mail('usermaiid',htmlmessage);
   
  
	}
urtrivedi 276 Nearly a Posting Virtuoso

Copy above file to one another file.
Now you need this file to modify according to following algorithm.

find users query

while (all users)
{
	htmlmessage=""

	while ( find all expired records for current user (as you are doing in your code for logged user only))
	{

		   create htmlmessage string intead of echoing output directly to browser.
	}
	mail('usermaiid',htmlmessage);
   
  
}

You need to schedule above script to execute daily in midnight or any time you need using crontab on linux server and using schedule task on windows server.

urtrivedi 276 Nearly a Posting Virtuoso

what is the actual problem, Your query is giving error or giving unexpected result

urtrivedi 276 Nearly a Posting Virtuoso

Following query should work
I m assuming that both table contains year column

select sum(elec.votes)/sum(stat.rating)  as percentage
from elec inner join on elec.year=stat.year
where stat.year=2009
urtrivedi 276 Nearly a Posting Virtuoso

try following code

$B_insert = "INSERT INTO B (B_add, B_pcode)	        VALUES ('$val_add', '$val_pcode')";
$result = mysql_query($B_insert) or die (mysql_error());  
[B]$bid=mysql_insert_id();[/B]

$C_insert = "INSERT INTO C (C_state)	      VALUES ('$val_state')";
$result = mysql_query($C_insert) or die (mysql_error());  
[B]$cid=mysql_insert_id();[/B]

$A_insert = "INSERT INTO A (A_fname, B_id, C_id)	    VALUES ('$val_fname', [B]'{$bid}', '{$cid}'[/B])";
$result = mysql_query($A_insert) or die (mysql_error());
urtrivedi 276 Nearly a Posting Virtuoso

Change your function as shown below

function newField()
{
document.getElementById('container').innerHTML = '<div id="myFile" style="width:100px;overflow:hidden;border:thin solid" title=\'' + document.getElementById('myFile').innerHTML+ '\'>thisisaverylongfilename.jpg</div>';
}

You may use document.getElementById('myFile').innerText

urtrivedi 276 Nearly a Posting Virtuoso

In my previous posts I told you not to use self.location
I am giving you code according to your pages. also you have not to create multiple forms
you can do it using only one form. You need to change your code in fpdfreport.php, use $_REQUEST or $_POST instead of $_GET.
pLEAESE do not build urls anymore, just post the form. also avoid self page posting

code for reportcaller.php

<script lang='javascript'>


      function validate(reportno)
      {
	      if(reportno==1)
		{
			if(document.frm.userid.value=="")
			{
				alert('select userid');
				return false;

			}
			if(document.frm.wno.value=="")
			{
				alert('select wno');
				return false;

			}
			if(document.frm.ndate.value=="")
			{
				alert('enter date');
				return false;

			}
			document.frm.action="timesheet.php";
		}

	  
              if(reportno==2)
		{
			if(document.frm.para1.value=="")
			{
				alert('enter para1');
				return false;

			}
			if(document.frm.para2.value=="")
			{
				alert('enter para1');
				return false;

			}

			document.frm.action="expensesheet.php";
		}

	
	      document.frm.submit();
      }
</script>

     <form=frm method=post  target="_blank">
      
	user ID <select name=USERID>
		<option value="">select user
		<option value=231>ADITI
		<option value=342>UPENDRA
		<option value=423>DANIWEB
	</select>

	Date <input type=text name=ndate>

	wno <select name=wno>
		<option value="">select wno
		<option value=1>1
		<option value=2>2
		<option value=3>3
	</select>
      para 1 <input type=text name=para1>
      para 2 <input type=text name=para2>
      <input type=button name=btntime value='Time Report' onclick='validate(1)' >

      <input type=button name=btnexpense value='Expense Report' onclick='validate(2)' >
   </form>

Form will post whole data to your actual fpdf report file. do not call same file and do not set url. You only take care in validate
function that user has selected required parameters or not.

algorithm for timesheet.php

1) execute query=mysql_query("select * from table where userid='$_POST[userid]' and date='$_POST[ndate]' and wno='$_POST[wno]'); 
2 run query 
3) set fpdf object using result 
4) output fpdf->output

algorithm for …

urtrivedi 276 Nearly a Posting Virtuoso

I tried my best to debug but your case is needed to debug in realtime environment. At least you try to open report in new window and not same window. If you still need my help. Then you need to upload zip files of all related source files and database scripts.
One more thing you can do that check your pages in different browsers may be in mozilla and chrome.
I am only helping you because it is difficult to find much online help on fpdf and I struggled a lot for fpdf before

urtrivedi 276 Nearly a Posting Virtuoso

My doubts
I have gone through your code, I think there is some problem with navigation. You site flow looks little bit confusing. Some questions are there in my mind.
1) you send me two timesheet.php one is outside and other in report folder which is actually containing fpdf source. but this "report/timesheet.php" file is never called.
2) you have also mention expensesheet.php in calling page. but it is not there in zip file.
please clear my above two doubts.

My observations
1) You are having one form tag but you have not specified action attribute.
2) in your first post of this thread you said, you are opening the report in new window but, here in form tag you have not specified target attribute.
3) on submitting your form you are changing self.location. I dont favour this.

My suggesstions

following are steps that i follow in my fpdf pages.

Report calling page

<script lang='javascript'>
	function validate()
	{
		/*
		here check using javascript code
		whether user passed all parameters in
		required format
		*/
		document.frm.submit();
	}
</script>

<form=frm method=post action="fpdfreport.php" target="_blank">
<input type=text name=para1>
<input type=text name=para2>
<input type=text name=para3>
<input type=button onclick='validate()'>
</form>

fpdf Report page algorithm (only php code no html)

1) execute query=mysql_query("select * from table where p1='$_POST[para1]' and p2='$_POST[para2]' and p3='$_POST[para3]');

2 run query

3) set fpdf object using result

4) output fpdf->output
urtrivedi 276 Nearly a Posting Virtuoso

I am highlighting the change(added content="text/html" in meta tag instead of only "html") in following line for your calling page. But for debugging I need your table, sample data (which you may export from phpmyadmin), and all related source files at least The bigger HTML calling page.
You may make a zip file for this files and upload here.
Also try removing media="screen" attribute from the link tag.

<?phpsession_start();if(isset($_GET['wno']))$_SESSION['weekNum']=$_GET['wno'];require("afterlogout.php");require("globals.php");?><html xmlns="http://www.w3.org/1999/xhtml" dir="ltr"><head>	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>	<meta name="description" content=""/>	<meta name="keywords" content="" />	<meta name="author" content="" />	<link rel="stylesheet" type="text/css" href="style.css" media="screen" />    <style type="text/css"><!--.style1 {font-size: 120%}.style5 {	font-size: medium;	font-weight: bold;}<?php
session_start();
if(isset($_GET['wno']))
$_SESSION['weekNum']=$_GET['wno'];
require("afterlogout.php");
require("globals.php");
?>
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr">
<head>


[bold]	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>[bold]



	<meta name="description" content=""/>
	<meta name="keywords" content="" />
	<meta name="author" content="" />
	<link rel="stylesheet" type="text/css" href="style.css" media="screen" />
    <style type="text/css">
<!--
.style1 {font-size: 120%}
.style5 {
	font-size: medium;
	font-weight: bold;
}
urtrivedi 276 Nearly a Posting Virtuoso

You may follow steps given below. Still if you are not getting out of the problem then paste your code here.

1) The page in which you have written fpdf code for generating pdf, make sure there is no space or enter mark before and after php tags.
2) start your report code like given below.

<?php
	header('Cache-Control: maxage=3600');
	header('Pragma: public');	

	/*
		fpdf source code
	*/
?>

3) If possible write report login in separted page and call that page from report landing page.
4) do not write any echo or html statement in report logic page.
5) In your report calling page (where you are losing html output), check whether you have kept following html code

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
urtrivedi 276 Nearly a Posting Virtuoso

Following query will show all trainers, and their Sezona.NogSezona if they have idsezona =3 else it will show null

SELECT Trener.BrTrenerskeIskaznice , ISNULL(Sezona.NogSezona, '') 
FROM Trener LEFT JOIN Licenca ON Trener.BrTrenerskeIskaznice = Licenca.BrTrenerskeIskaznice  [b]and Licenca.IDSezona=3 [/b]
LEFT JOIN Sezona ON Sezona.IDSezona = Licenca.IDSezona
urtrivedi 276 Nearly a Posting Virtuoso

TRY FOLLOWING QUERY

SELECT ISNULL(Sezona.NogSezona, '') 
FROM Trener LEFT JOIN Licenca ON Trener.BrTrenerskeIskaznice = Licenca.BrTrenerskeIskaznice 
LEFT JOIN Sezona ON Sezona.IDSezona = Licenca.IDSezona 
[B]WHERE[/B] Licenca.IDSezona=3
urtrivedi 276 Nearly a Posting Virtuoso

Please post your table sturcture of both tables. also specify the primary key and foriegin key

urtrivedi 276 Nearly a Posting Virtuoso