urtrivedi 276 Nearly a Posting Virtuoso
<div id=firstdrop > 
<select >
<option value=1> one</option>
<option value=2> two</option>
<option value=3> three</option>
<option value=4> four</option>
 </select> 
</div>
<div id=seconddrop>

</div>
<script language=javascript>
document.getElementById("firstsecond").innerHTML=document.getElementById("firstdrop").innerHTML;
</script>
urtrivedi 276 Nearly a Posting Virtuoso
1) look the sequence
   customer is at A
   he placed order 1
   order 1 delivered to place A
   customer changed address (you update master table) A->B
   he place order 2
   order 2 delivered to place B
   now you look for order 1 in reports
   it will show order was delivered to address B (is it true?)

2) This is delivery so you do not need to keep amount related things, only quantity is enough. 
But in case of invoice, You must store and show qty, rate, discount, total_amout item wise.
urtrivedi 276 Nearly a Posting Virtuoso

1) also keep address part in deleiver and order, because all customers are not regular customer, may want delivery at another address

2 ) you may keep amount column in deliver(qty*price)
3) as discussed in previous posts, you may add order_id_reference in delelivery_note

urtrivedi 276 Nearly a Posting Virtuoso

If you are doing for class project than its fine. You do not need to show order_id_reference. It may be used to track orders if required.

But in real case one delivery may consists of many orders. So in that case you will need order, delivery relation table, that is one delivery many orders.

You should keep total column, and store calculated values in it, it means we are showing in report what ever stored in database. Always avoid calculations in reports (this is my personal opinion).

urtrivedi 276 Nearly a Posting Virtuoso

Thanks ardav, I though He wanted upto last date of week, Here is corrected code

<?php 		

$textdt="01 jan 2011";
$currdt= strtotime( $textdt);
$nextmonth=strtotime($textdt."+1 month");
$i=0;
$flag=true;

do 
{
    $weekday= date("w",$currdt);
    $endday=abs($weekday-6);
    $startarr[$i]=$currdt;
    $endarr[$i]=strtotime(date("Y-m-d",$currdt)."+$endday day");
    $currdt=strtotime(date("Y-m-d",$endarr[$i])."+1 day");

	if($endarr[$i]>=$nextmonth)
	{
		$endarr[$i]=strtotime(date("Y-m-d",$nextmonth)."-1 day");;
		$flag=false;		
	}

	echo "Week ".($i+1). "-> start date = ". date("Y-m-d",$startarr[$i])." end date = ". date("Y-m-d",$endarr[$i])."<br>";
    $i++;
 	  		     
}while($flag);



?>
urtrivedi 276 Nearly a Posting Virtuoso

Last date is show as expected by AAMIT.

urtrivedi 276 Nearly a Posting Virtuoso

I think keep structure of delievery as it is. You may add one column in delivery that is order_id_reference. while creating delivery note you can show list of order and could be selected, which will copy all details of customerid, address and all that. You may also bring items and ordered quantity.

Here user may add/edit/modify details (delivery may not look same as order)

urtrivedi 276 Nearly a Posting Virtuoso
<?php 		

$textdt="01 june 2011";
$dt= strtotime( $textdt);
$currdt=$dt;
$nextmonth=strtotime($textdt."+1 month");
$i=0;

do 
{
    $weekday= date("w",$currdt);
    $nextday=7-$weekday;
    $endday=abs($weekday-6);
    $startarr[$i]=$currdt;
    $endarr[$i]=strtotime(date("Y-m-d",$currdt)."+$endday day");
    $currdt=strtotime(date("Y-m-d",$endarr[$i])."+1 day");

    echo "Week ".($i+1). "-> start date = ". date("Y-m-d",$startarr[$i])." end date = ". date("Y-m-d",$endarr[$i])."<br>";
     $i++;
 	  		     
}while($endarr[$i-1]<$nextmonth);



?>
diafol commented: like this :) +13
urtrivedi 276 Nearly a Posting Virtuoso

Login to phpmyadmin (with working login info). Server:localhost, privileges. add user and host. Do this carefully.

urtrivedi 276 Nearly a Posting Virtuoso

where is the code, post it here,
I think you need to wrap your value attribute of button with quotes

<input type=button name=btn1 id=btn1 value="<?php echo $sizes; ?>" >
urtrivedi 276 Nearly a Posting Virtuoso

USE SINGLE QUOTE AROUND SRC attribute

out.println("File has been uploaded successfully");
		out.println("<html>");
		out.println("<body>");
		out.println("<table><tr><td width='210'></td><td> <img border=2 src='image/"+itemName.toString().trim()+"' width=800 height=600></td></tr></table>");
		out.println("</body>");
		out.println("</html>");
urtrivedi 276 Nearly a Posting Virtuoso

if you have php myadmin, select your table, click export ->go, it will give you table mysql script, paste it here

I think you have not seen my post properly, its no only -21, I have interchanged the columns
see carefully

and add_date < DATE_ADD(current_date, INTERVAL -21 DAY)
urtrivedi 276 Nearly a Posting Virtuoso

Have you checked if somebody paste the number then what happens?

urtrivedi 276 Nearly a Posting Virtuoso

can u post mysql table script with data

urtrivedi 276 Nearly a Posting Virtuoso

I think you should get the result in some php variable.

or I think follwing link may help you

http://devzone.zend.com/node/view/id/651

urtrivedi 276 Nearly a Posting Virtuoso

I am not sure about the best solution. This happened to mean for person address directory. I had to go for manual correction. Though I developed a tool in php, which list thing is alphabetic order,
If I found more than two rows I used to delete all rows but keeping one row of them.

I do not think there is any automatic way to removing duplicates.

urtrivedi 276 Nearly a Posting Virtuoso

It is good to develop tools for generating forms. It is essential for self growth. But those who do not have time to do all this, they should use ready to use tools. For managing mysql table data operation, I use free version of php datagrid428 (support is stopped for free version). It is still left with so many bugs, They have removed bugs in latest version, but latest version is not a free one.

urtrivedi 276 Nearly a Posting Virtuoso
and add_date < DATE_ADD(current_date, INTERVAL -21 DAY)
urtrivedi 276 Nearly a Posting Virtuoso

What you want to use, myql query , php code or combination of both?

urtrivedi 276 Nearly a Posting Virtuoso

submit your query, and mysql table script with data

urtrivedi 276 Nearly a Posting Virtuoso

I assume that you are submitting to self page.

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

are you sure you can login to phpmyadmin without password. I think in your main code file you must user mysqli_query instead of mysql_query, for that matter all function you must change.

urtrivedi 276 Nearly a Posting Virtuoso

I am assuming your method is POST, otherwise you may change it to GET

<select name="prop_type" onchange="display(this,'Private Apartments','Landed Property', 'Hdb Flat', 'Commercial', 'Hudc Apartments');">

<option >Please Select</option>

<option value="Private Apartments" <?php echo ($_POST['prop_type']=="Private Apartments")?"selected":"";?>>Private Apartments</option>

<option value="Landed Property" <?php echo ($_POST['prop_type']=="Landed Property")?"selected":"";?>>Landed Property</option>

<option value="Hdb Flat" <?php echo ($_POST['prop_type']=="Hdb Flat")?"selected":"";?>>Hdb Flat</option>

<option value="Commercial" <?php echo ($_POST['prop_type']=="Commercial")?"selected":"";?>>Commercial </option>

<option value="Hudc Apartments" <?php echo ($_POST['prop_type']=="Hudc Apartments")?"selected":"";?>>Hudc Apartments </option>

<option value="invisible" <?php echo ($_POST['prop_type']=="invisible")?"selected":"";?>>Invisible</option>


</select>
urtrivedi 276 Nearly a Posting Virtuoso

no such facility is there in html.
You may user jquery-ui, datepicker, its easy to use

urtrivedi 276 Nearly a Posting Virtuoso

problem is in dbfucntions.php, post it here

urtrivedi 276 Nearly a Posting Virtuoso

Submit date is name for your date column which you want to check for 21 days.
(you must change it ). Here function is date_add and not submit_date.

urtrivedi 276 Nearly a Posting Virtuoso

I think you do not need php , you can simply do it in mysql query itself

SELECT * from table_name 
where date_add(submit_date ,interval 21 day ) <= current_date
urtrivedi 276 Nearly a Posting Virtuoso

Here you can see I have executed query only once, and shortened for loop.

$operator="";
$condition="";
for( $i = 0; $i < count($words); ++$i ){
	$condition.=$operator." CONCAT(FirstName, ' ',LastName) LIKE  CONVERT(_utf8 '%".$words[$i]."%' USING latin1) COLLATE latin1_swedish_ci";
	$operator=" OR ";
}
$sql = "SELECT *,CONCAT(FirstName, ' ',LastName) as fullname FROM `ajax_demo_table`   ";

if ($condition!="")
$sql .= " where ($condition) ";
urtrivedi 276 Nearly a Posting Virtuoso

Even if you use another process reg page you can still send the entered data back to main form in case of error.

If you want to send data to same form, you may use cookies to overcome resend issues.

Ajax can work in any way, one page or two page.

I personally feel one page coding is always little complicated (either for processing or for ajax).

So go for separate process handler.

urtrivedi 276 Nearly a Posting Virtuoso

you may use session variable but take care naming variable, name them accoring to page name.
I think its better to store paging, searching info in clients computer using cookies, rather than using session variable.

urtrivedi 276 Nearly a Posting Virtuoso

I think you close this thread and open new thread with your new problem subject line

urtrivedi 276 Nearly a Posting Virtuoso

Before using datagrid428, when I was paging myself. I used to use cookie to store search criteria and page numbers.

urtrivedi 276 Nearly a Posting Virtuoso

DO you know about php datagrid428 (its free). YOu can create forms where you can add/edit/delete/print/export with ease and paging option. Also you can connect php with any database well known.

I would recommend to not waste time in writing code. go for it.

Warning: free version is with some bugs and they have stopped supporting users of free version. But basic functionality still works.

urtrivedi 276 Nearly a Posting Virtuoso

I could not comment on that, I have no idea about it.

urtrivedi 276 Nearly a Posting Virtuoso

where is rest html code

urtrivedi 276 Nearly a Posting Virtuoso

from your database, select two location whose distance you know very well, then run your query.
I think after looking the result, you can identify whether its giving in meters or kms

urtrivedi 276 Nearly a Posting Virtuoso
$chkdt = "Wed Jun 15 2011 00:00:00 GMT 0530 (India Standard Time)";
$chkdtarr=explode("GMT",$chkdt);
$newdt= strtotime($chkdtarr[0]);
echo $newdt;
echo "<br>".date("m/d/Y",$newdt);
urtrivedi 276 Nearly a Posting Virtuoso

Insert this user in database, you may insert more other to test

Insert into USERS (USERNAME,PASSWORD,READ,WRITE,REMOVE,ISADMIN) values ('naveed','naveed',1,1,0,0);

NOw in attached complaint form. I have written code in four triggers
form-new instance
block-pre insert
block-pre update
block-pre delete

urtrivedi 276 Nearly a Posting Virtuoso

generally we use term FLAG for boolean kind of variable. FLAG is not a part of any programming language. Its just something to understand things in better manner.

Here I have used boolean variable or flag named $FOUND. Before starting loop I set it to false. If it goes in loop I set it to true, means that at least one record found. If query cause no record, the flag will remain false and it will print that message.

You may also use mysql_num_rows(), if you do not want to use flag

I am not sure your problem is solved or not, if yes then mark it solved.

masterjiraya commented: thnaks this thread has been solved +3
urtrivedi 276 Nearly a Posting Virtuoso

post structure of ex_cat, and ex_tax
or try with ` around word group, because group is reserved word

$sql="INSERT INTO ex_cat (username,exp_id,used_category,`group`,type)
SELECT ex_tax.username,ex_tax.exp_id,ex_tax.category,ex_tax.`group`,ex_tax.type
FROM ex_tax WHERE ex_tax.username='$uname' AND ex_tax.exp_id='$exp_id' AND ex_tax.used='1'";
urtrivedi 276 Nearly a Posting Virtuoso

I have separated table, and now using one found flag.

<?php 		



$q=$_GET['q'];
$words=explode(' ',$q);
$con = mysql_connect('localhost', 'root', 'jaishal1110')or  die('Could not connect: ' . mysql_error());

mysql_select_db("test", $con)or die('cannot connect');

//$sql = 'SELECT * FROM `ajax_demo_table`  WHERE `FirstName` LIKE CONVERT(_utf8 \'%'.$q.'%\' USING latin1) COLLATE latin1_swedish_ci OR `LastName` LIKE CONVERT(_utf8 \'%'.$q.'%\' USING latin1) COLLATE latin1_swedish_ci'; 
$q = preg_replace('/\s\s+/', ' ', $q); // remove extra space
for( $i = 0; $i < count($words); ++$i ){
$sql = "SELECT *,CONCAT(FirstName, ' ',LastName) as fullname FROM `ajax_demo_table` WHERE CONCAT(FirstName, ' ',LastName) LIKE  CONVERT(_utf8 '%".$words[$i]."%' USING latin1) COLLATE latin1_swedish_ci ";
//echo $sql;

$result = mysql_query($sql) or die('cannot query '.$result);
echo "<table border='1'>";

//if(mysql_fetch_array($result)>=1){
echo"
<tr>
<th>Firstname</th>
<th>Lastname</th>
<th>Age</th>
<th>Hometown</th>
<th>Job</th>
</tr>";
$found=false;
while($row = mysql_fetch_array($result))
  {
$found=true;
  echo "<tr>";
  echo "<td>" . $row['FirstName'] . "</td>";
  echo "<td>" . $row['LastName'] . "</td>";
  echo "<td>" . $row['Age'] . "</td>";
  echo "<td>" . $row['Hometown'] . "</td>";
  echo "<td>" . $row['Job'] . "</td>";
  echo "</tr>";
//  echo "<tr><td colspan=5><hr></font></td></tr>";
  }if(!$found){
echo "<tr><td><b>NO<b> similar names with <font color=red><b>".$words[$i].'</b></font></td></tr>';

}
echo "</table><hr>";


}

//end of while
//}

//}
//echo "</table><hr>";
mysql_close($con);

?>
urtrivedi 276 Nearly a Posting Virtuoso

Then you script is working fine. Now I am not able to understand what more you are expecting from it.

urtrivedi 276 Nearly a Posting Virtuoso

I think problem is due to onkeyup event, it is constantly changing query.

<input type="text" name="users" onkeyup="showUser(this.value)">

change onkeyup to onblur

<input type="text" name="users" onblur="showUser(this.value)">
urtrivedi 276 Nearly a Posting Virtuoso

upload sql script with definition and data of ajax_demo_table

urtrivedi 276 Nearly a Posting Virtuoso

here is my configuration.php

<?php if(!session_start()) session_start();
	//if(!isset($_SESSION['VisitorID'])) $_SESSION['VisitorID'] = 4;?>

Only this much? Is it complet code

urtrivedi 276 Nearly a Posting Virtuoso

problem is in configuration.php, do not echo or print in configuration. Or do not write any html code in it.

urtrivedi 276 Nearly a Posting Virtuoso

post your php code of index.php file

urtrivedi 276 Nearly a Posting Virtuoso
<?php 		
$arr1 = array('1','2','3','4','5','6','7','158','12');
$arr2 = array('2','5','4','8','12','6','7','154','124','131');

echo "<pre>";

$insert =array_diff($arr2,$arr1);
$update =array_intersect($arr2,$arr1);
//print_r($update);

foreach($update as $key)
{
	echo $key." update <br>";
}
echo "<br><br>";
foreach($insert as $key)
{
	echo $key." insert<br>";
}
echo "</pre>";
?>
urtrivedi 276 Nearly a Posting Virtuoso

it could happen if your $example is having nothing