urtrivedi 276 Nearly a Posting Virtuoso

Try following query

select et.equipment_type,
max(case when name='Managed_Ip' then value end) as SNMP_port,
e.equipment_name as equipment_name,
[B]cs.customer_name[/B]

from equipment_feature ef inner join equipments e on(e.equipment_id=ef.equipment_id) inner

join equipment_types et on (e.equipment_type_id=et.equipment_type_id)
inner join 
  [B](select 'customer_id' colname,customer_id,customer_name from customer
    union
    select 'site_id' colname,site_id as customer_id, site_name as customer_name from site)
 cs on(ef.name=cs.colname and ef.value=cs.customer_id)[/B]
urtrivedi 276 Nearly a Posting Virtuoso

Make sure you have set mysql connection "db_handle", in the begining of the code.
and make use of it for getting the result
$result = mysql_query($SQL,$db_handle);

urtrivedi 276 Nearly a Posting Virtuoso

1) Check whether your template file contains @FCC_BODY@ text or not
2) open you database (may be phpmyadmin) and execute your query, whether it gives result or not. "SELECT * FROM articles WHERE show = 'yes'"

urtrivedi 276 Nearly a Posting Virtuoso

if your domain name is http://www.yoursite.com/somepage
then now try it without www

http:/yoursite.com/somepage

urtrivedi 276 Nearly a Posting Virtuoso

Let me know whether you are able to download fpdf.zip attached with this reply.

urtrivedi 276 Nearly a Posting Virtuoso

Your query is

Select * from table1 Where myid='PO-1-09/09';

You should post exact query instead of sample or example, to rectify it.

I think query should be

Select * from orders Where trim(invoiceid)='PO-1-09/09';
urtrivedi 276 Nearly a Posting Virtuoso

Post whole structure of your table

urtrivedi 276 Nearly a Posting Virtuoso

You can concate your query string conditionally

$query = "your query ";

if (your condition =true)
{
     $query=$query." your more condition";
}

execute_query($query);
urtrivedi 276 Nearly a Posting Virtuoso

product_name varchar(50),
product_type char(1),//C for category and I for ITEM
price numeric(8,2)


product_level
parent_id numeric(5),
child_id numeric(5),
level numeric(2)

example of PRODUCT_MASTER TABLE
PRODUCT_ID, PRODUCT_NAME, PRODUCT_TYPE, PRICE
0 , 'PRODUCTS', 'C',NULL //ROOT NODE
1, 'CATE 1','C', NULL // CATEGORY 1
2, 'CATE 2' ,'C', NULL // CATEOGORY 2
3, 'CATE 11', 'C', NULL // SUB CATEGORY UNDER 1
4, 'ITEM 11-1','I', 50.00// ITEM UNDER SUB CATEOGRY 11
5, 'ITEM 2-1','I', 150.00 // DIRCT ITEM UNDER CATEGORY 2

WE CAN GO TO ANY LEVEL OF CATEGORIZATION

example of PRODUCT_LEVEL // THIS IS TO KEEP TRACK OF ALL
GRAND PARENT OF ITEM,
AT WHICH LEVEL CHILD EXISTS, INCLUDING SELF RECORD WITH LEVEL 0. USING JOIN WE CAN GET OTHER INFORMATION

CHILD_ID, PARENT_ID, LEVEL
0, 0, 0

1, 1, 0
1, 0, 1

2, 2, 0
2, 0, 1

3,3,0
3,1,1
3,0,2

4,4,0
4,3,1
4,1,2
4,0,3

5,5,0
5,2,1
5,0,2


ALL DATA INSERTION NEED TO TAKEN CARE AT FRONT END. I have implemented this design successfully.

urtrivedi 276 Nearly a Posting Virtuoso

I have a question why you chose to create 3 separate tables for Stock, bond and mutual funds. According to me you can create one table with same columns and one more column say stock_type (Stock,Bond,Mutal), you can also create one master table for stock type so that, in future if any other type of stock is added you can easily manange without disturbing database design.
Also I would suggest to keep period id instead of 5ytd, or 10tyd like columns.

urtrivedi 276 Nearly a Posting Virtuoso

I dont know the actual method but I think following may work.

str_replace("code","<span style='your style'>",$yourtext);
str_replace("/code","</span>",$yourtext);

You mus use full tag in your code i.e. \[code\]

urtrivedi 276 Nearly a Posting Virtuoso

You first execute this query directly on mysql, using phpmyadmin or any other tool, check for syntax error. when you find proper final query then try it in php.

urtrivedi 276 Nearly a Posting Virtuoso

Ramy is right, that you must create another table for detail and then you need to join them.

But if you like to continue with this design then you have to use union keyword to get your result. I Dont know about the performance,

select game,count(*) total  from
	(select game1 as game from kings
	union 
	select game2 as game from kings
	union 
	select game3 as game from kings
	union 
	select game4 as game from kings
	union 
	select game5 as game from kings
	union 
	select game6 as game from kings
	union 
	select game7 as game from kings
	)
group by game order by count(*) desc
urtrivedi 276 Nearly a Posting Virtuoso

Call logout.php
I am assuming that you have written code for deletion in logout.php

define onUnload()
{
window.location ='logout.php';
}
urtrivedi 276 Nearly a Posting Virtuoso

Try following code

<html>
<script lang='javascript'>

var checkedcount=0;

function validate()
{
	if (checkedcount<=0 || checkedcount>4 )
	{
	 	alert('Select one to four options!');
		return false;
	}
}

function checkinfo(chkbox)
{
	
	if(chkbox.checked==true)
		checkedcount++;
	else
		checkedcount--;

}

</script>
<body>	
	<form name=frm action=some.php method=post>
	<input type=checkbox id=chk[0]   name=chk[0] value=0 onclick='javascript:checkinfo(this);' > Option 0<br>
	<input type=checkbox id=chk[1]   name=chk[1] value=1 onclick='javascript:checkinfo(this);' > Option 0<br>
	<input type=checkbox id=chk[2]   name=chk[2] value=2 onclick='javascript:checkinfo(this);' > Option 0<br>
	<input type=checkbox id=chk[3]   name=chk[3] value=3 onclick='javascript:checkinfo(this);' > Option 0<br>
	<input type=checkbox id=chk[4]   name=chk[4] value=4 onclick='javascript:checkinfo(this);' > Option 0<br>
	<input type=checkbox id=chk[5]   name=chk[5] value=5 onclick='javascript:checkinfo(this);' > Option 0<br>

                   <input type="submit" name="Submit" value="Next" class="button" onClick="return validate();">


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

You must add hidden field on confimation page

<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
   Your choice: <input type="radio" name="choice" value="yes"> Yes <input type="radio" 

name="choice" value="no" /> No
[B]<input type="hidden" name="mGinNo"  id="mGinNo" value="<?php  echo $_REQUEST['mGinNo'];?>"> [/B]    <button type="submit">Send</button>

</form>
urtrivedi 276 Nearly a Posting Virtuoso

This is many to many relation ship. So instead of creating page for account_course table, you should allow user to enter students for course in course entry page, and allow user to enter course for students in student entry page. I mean header detail kind of form. I hope I understood your question properly.

urtrivedi 276 Nearly a Posting Virtuoso

What exactly do you want in new query?

urtrivedi 276 Nearly a Posting Virtuoso
print'<option value="{$nt[ugname]}">'.$nt[ugname].'';
print'</option>';

If you have any key column other than ugname then you can use that as value.

urtrivedi 276 Nearly a Posting Virtuoso

It may happen if second page is refreshed continuously. After inserting you redirect browser to another or first page. Also use cookies.

urtrivedi 276 Nearly a Posting Virtuoso

Search for "xinha" Editor

urtrivedi 276 Nearly a Posting Virtuoso

Try following javscript code in your all html page in the begining and see what happens.
If you have many pages then you can keep following code in one javascript file and then just refer that file from every html page.
You need not to use php for this.

<html>
<head>
<link rel="stylesheet" type="text/css" id="style1" href="quarter1.css" />

<script type="text/javascript">
	var today=new Date();
	var month =today.getMonth()+1;
	alert(month);
	if(month>=1 && month<=3)
		document.getElementById("style1").href="quarter1.css";	
	if(month>=4 && month<=6)
		document.getElementById("style1").href="quarter2.css";	
	if(month>=7 && month<=9)
		document.getElementById("style1").href="quarter3.css";	
	else
		document.getElementById("style1").href="quarter4.css";	

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

I think you need not to check if you have created constraints properly.
But still if you want to check, then to chekc PK try to insert record with existing PK value, and to check FK try to insert record with FK value that does not exist in master table referred.

urtrivedi 276 Nearly a Posting Virtuoso

You can keep access level column in user master table.
Whenever user login save his/her acces level in session variable and which ever page you want to secure check condition at the beginning of the page. also you can hide/show buttons and links according to access level saved in a session variable.

urtrivedi 276 Nearly a Posting Virtuoso

I think your code has little problem, try following:

<?php

$uidTotal = mysql_connect("localhost", "user", "pass");
mysql_select_db("table", $uidTotal);

[B]$uid=3;[/B]

$result = mysql_query("SELECT * FROM tracking WHERE uid = [B]{$uid}[/B]", $uidTotal);
$a = mysql_num_rows($result);

echo "[B]{$a}[/B] \n";

?>
urtrivedi 276 Nearly a Posting Virtuoso

Please define your problem more precisely and with example.

urtrivedi 276 Nearly a Posting Virtuoso

You can try following, but I am not able to understand what is id in "parent_id=id".

insert into categories(....) values select 1,'aaa','some text', parent_id date,date from categories where parent_id=id;

Are you going to execute above query in php or mysql directly?

urtrivedi 276 Nearly a Posting Virtuoso

I guess you are writing that selectect statement in trigger. I think only insert update delete statements are allowed in triggers.

urtrivedi 276 Nearly a Posting Virtuoso

You can execute following query to determine whether new reservation for any room is confilicting with existing reservation for that room.

select * from reservtable where '{$fromdate}' <= check_out_date and '{$todate}'>= check_out_date and room='{$roomno}'
urtrivedi 276 Nearly a Posting Virtuoso

Please post the exact case with table structure and trigger code.

urtrivedi 276 Nearly a Posting Virtuoso

following query will give ids of product which have invetory column's value as 0 select distinct idproduct where inventory=0 from optionsInventory follwing query deletes all product records which do not have invertory column value as 0

delete from optionsInventory where idproduct not in (
 select distinct idproduct where inventory=0 from optionsInventory)
urtrivedi 276 Nearly a Posting Virtuoso

$dbname = "cvarcher_members";

1) Are you sure about spelling of "varchar"?
2) Have echoed query that is $update variable before executing then exectuted in phpmyadmin sql section?

Do not use dummy resolve actual query by echoing $update before exeuting in php.

urtrivedi 276 Nearly a Posting Virtuoso

You can use FPDF library
Download its zip file from net. I don't remember the link. If you dont find it. tell me i wll send you its zip folder. following is the sample code to generate pdf for php code. Here code is reading data from file, you can execute a query instead for your case.

require('fpdf.php');

class PDF extends FPDF
{
//Load data
function LoadData($file)
{
    //Read file lines
    $lines=file($file);
    $data=array();
    foreach($lines as $line)
        $data[]=explode(';',chop($line));
    return $data;
}

//Simple table
function BasicTable($header,$data)
{
    //Header
    foreach($header as $col)
        $this->Cell(40,7,$col,1);
    $this->Ln();
    //Data
    foreach($data as $row)
    {
        foreach($row as $col)
            $this->Cell(40,6,$col,1);
        $this->Ln();
    }
}

//Better table
function ImprovedTable($header,$data)
{
    //Column widths
    $w=array(40,35,40,45);
    //Header
    for($i=0;$i<count($header);$i++)
        $this->Cell($w[$i],7,$header[$i],1,0,'C');
    $this->Ln();
    //Data
    foreach($data as $row)
    {
        $this->Cell($w[0],6,$row[0],'LR');
        $this->Cell($w[1],6,$row[1],'LR');
        $this->Cell($w[2],6,number_format($row[2]),'LR',0,'R');
        $this->Cell($w[3],6,number_format($row[3]),'LR',0,'R');
        $this->Ln();
    }
    //Closure line
    $this->Cell(array_sum($w),0,'','T');
}

//Colored table
function FancyTable($header,$data)
{
    //Colors, line width and bold font
    $this->SetFillColor(255,0,0);
    $this->SetTextColor(255);
    $this->SetDrawColor(128,0,0);
    $this->SetLineWidth(.3);
    $this->SetFont('','B');
    //Header
    $w=array(40,35,40,45);
    for($i=0;$i<count($header);$i++)
        $this->Cell($w[$i],7,$header[$i],1,0,'C',1);
    $this->Ln();
    //Color and font restoration
    $this->SetFillColor(224,235,255);
    $this->SetTextColor(0);
    $this->SetFont('');
    //Data
    $fill=0;
    foreach($data as $row)
    {
        $this->Cell($w[0],6,$row[0],'LR',0,'L',$fill);
        $this->Cell($w[1],6,$row[1],'LR',0,'L',$fill);
        $this->Cell($w[2],6,number_format($row[2]),'LR',0,'R',$fill);
        $this->Cell($w[3],6,number_format($row[3]),'LR',0,'R',$fill);
        $this->Ln();
        $fill=!$fill;
    }
    $this->Cell(array_sum($w),0,'','T');
}
}

$pdf=new PDF();
//Column titles
$header=array('Country','Capital','Area (sq km)','Pop. (thousands)');
//Data loading
$data=$pdf->LoadData('countries.txt');
$pdf->SetFont('Arial','',14);
$pdf->AddPage();
$pdf->BasicTable($header,$data);
$pdf->AddPage();
$pdf->ImprovedTable($header,$data);
$pdf->AddPage();
$pdf->FancyTable($header,$data);
$pdf->Output();
?>
urtrivedi 276 Nearly a Posting Virtuoso

Try using newline character "\n" after each line.
But I am not sure whether email client will allow active html in message or not.

urtrivedi 276 Nearly a Posting Virtuoso

It is just sr no for readingindex 1,2,3.... etc
If you are not comfortable with it then you can generate new primary key reading_srno (This will go from 1,2,3......n regardless of readingindex)
fk_readingindex is fk from header table

new design
Reading_dtl(Reading_srno,fk_ReadingIndex, ReadingType, F1, F2, F3)

Primary keys are shown in bold letter
Foreign keys are shown in italics

urtrivedi 276 Nearly a Posting Virtuoso

You can do it in following manner
insert into table3 (pid,cid) select a.pid,b.cid from table1 a cross join table2 b

As darkagn said, your case doesnt need this to be done. Its already there

urtrivedi 276 Nearly a Posting Virtuoso

You can do it using alter table table1 add (courseId numeric(10))
then update table1 set courseid=courseno then alter table table1 drop "pkoldname" then alter table table1 add primary key pknewname (courseid) You can also user enterprise manager to do above operation using gui.

urtrivedi 276 Nearly a Posting Virtuoso

Triggers are generally of two types Statement level and row level.
Right now I dont remember syntax.

But if you want to create trigger at row level
You can access values using inserted cursor and deleted cursor.

if row is inserted new values can be accessed as
inserted.col1, inserted.col2...... etc

if row is update new values can be accessed as
inserted.col1, inserted.col2...... etc
and old values can be accessed as
deleted.col1, deleted.col2...... etc

if row is deleted deleted values can be accessed as
deleted.col1, deleted.col2...... etc

Please refer manual for details

urtrivedi 276 Nearly a Posting Virtuoso

If I had to design the database I would have done it in following manner.
Project (ProjectId,ProjectName,Status)
1,Project A, Open

Zone(ZoneId,ZoneName,ProjectId,IS_VARIABLE)
1,ZONE A, 1, 0
2,ZONE A, 2, 0
3,ZONE A, 3, 0
4,ZONE A, 4, 1

Reading_hdr(ReadingIndex,date,ZoneId)
1,27-mar-2008,1
2,28-mar-2008,4

Reading_dtl(ReadingIndex, srno, ReadingType, F1, F2, F3)
/* Reading type could be in, out or fix. no extra columns are required
I am assuming database is mysql so you can set enum type.
*/
1,1,fix,23,53,54
2,1,in,30,63,63
2,2,out,30,69,64

This table you can join using join operators, can using case when then statement you can create a crosstab query.

Primary keys are shown in bold letter
Foreign keys are shown in italics

urtrivedi 276 Nearly a Posting Virtuoso

Your client is really very intelligent. I suggest you not to do any kind of reasearch on this project as you have only worked on MS Access. You must take some help from an experienced person. I think php-mysql platform will suit best to your clients requirement.

urtrivedi 276 Nearly a Posting Virtuoso

Your syntax is working fine it has no problem. If you are getting an error then post that error message.

urtrivedi 276 Nearly a Posting Virtuoso

Post your table structure and sample data