urtrivedi 276 Nearly a Posting Virtuoso

what do u mean by error, what kind of error it is?

urtrivedi 276 Nearly a Posting Virtuoso

I think this should work now, check query first.

$get_swork2 = "select ad.firstname, ad.lastname, ad.customerid, ad.dhtmlgoodies_category, ad.dhtmlgoodies_subcategory, ad.caryear, aj.email, sr.servicearea, sr.clientID, sr.customerid, datediff(current_date,max(sr.date))  days_passed ,max(sr.date) last_date
from servicesrendered sr 
inner join additional_cars ad on sr.customerid=ad.customerid and sr.clientid=ad.clientid
inner join ajax_client aj on sr.customerid=aj.customerid 
where sr.servicearea=' Oil Change ' and trim(aj.email) <>''  group by ad.firstname, ad.lastname, ad.customerid, ad.dhtmlgoodies_category, ad.dhtmlgoodies_subcategory, ad.caryear, aj.email, sr.servicearea, sr.clientID, sr.customerid";

 $get_swork2_res = mysql_query($get_swork2); 

  if (mysql_num_rows($get_swork2_res) > 0) 
  { 
     while ( $swork2_info = mysql_fetch_array($get_swork2_res)) 
    { 

/////fetch data
      $firstname = $swork2_info['firstname']; 
      $lastname = $swork2_info['lastname']; 
      $customerid = $swork2_info['customerid'];
      $dhtmlgoodies_category = $swork2_info['dhtmlgoodies_category']; 
      $dhtmlgoodies_subcategory = $swork2_info['dhtmlgoodies_subcategory']; 
      $caryear = $swork2_info['caryear']; 
      $recipientAddr=$swork2_info['email']; 
      $days_passed=$swork2_info['days_passed'];
      $date=$swork2_info['last_date'];
 
    /*  
     //following php code not requied now so commented
     $timestamp = strtotime($date);
      $startDate=$timestamp; 
      $limit=90;//the number of days counting down from
      $z=floor((time() - $startDate)/86400);
      $days_left=$limit-abs($z);*/

      if ($days_passed == 90)
      {
        $subject=" no days";

      }
      else if ($days_passed == 85)
      {

         $subject="5 days"  ;
      }

      else if ($days_passed == 105)//if past 15 days
      {
	 $subject="15 days";
         
      }
      else
      {
          continue;//we do not want to send mail if its not 0, 5 or -15, go to next record
      }




///////send mail
//mail begins
         $fromAddr = 'noreply@autotechpro.net';
	 $today_date = date("M-d-Y"); 
	 $today_is =date('l, F j, Y');
	 $email2 ='admin@autotechpro.net';
	 $subjectStr = 'Courtsey Automatic Oil Change reminder';
	
$mailBodyText = <<< HHHHHHHHHHHHHH
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<title>mail</title>
<style type="text/css">
            h1, h2, td, p {
                font-family: helvetica, arial, sans-serif;
            }
        </style>
</head>
  <body>
Dear $firstname $lastname:<p>
This is an automatic courtsey Oil Change reminder. Our records indicate that as of today, …
urtrivedi 276 Nearly a Posting Virtuoso

<form name="Candidates_name" method=POST id='Candidates_name' onSubmit="return form_validation(this);">

in above line you pass self element as parameter using this keyword, which you can access in you js function.

<input type=text name=txt1 id=txt1 onblur='myformattext(this)'>

here it will pass txt1 element to function myformattext, when user leaves textbox txt1

this is keyword, and form is not,

urtrivedi 276 Nearly a Posting Virtuoso

1) id, name IS JUST for identifaction of form.
2) method may be post or get
3) onsubmit is event it will call js fucntion when form is submitted.
your form_validation function must return value (true/false). if it returns false the form will not submitted.

You may refer to w3schools.com pages, the explain it in very nice manner

urtrivedi 276 Nearly a Posting Virtuoso

If your data is not confidential, then go to phpmyadmin, export all four tables used in sql format, and attach that file here. I will run this query here and let you know the solution.

We will also manage 3 reminders in same code

urtrivedi 276 Nearly a Posting Virtuoso

You made 2 mistakes
1) you are not calling formvalid function, so I have kept its code in first validate function (no need of 2 functions)
2)you are trying to access meta7, meta8, meta9, actually you have only meta0 and meta1. checkbox value is different and checkbox index is different thing.

check following code

<HTML>
<TITLE>Vote</TITLE>
<HEAD>
<script LANGUAGE="JavaScript">
function form_validation(form)
 {
   
ErrorText= "";
  if ((form.name[0].checked==false)  && (form.name[1].checked==false)  && (form.name[2].checked==false)  && (form.name[3].checked==false) && (form.name

[4].checked==false) && (form.name[5].checked==false) && (form.name[6].checked==false))
    {
      alert ("Please select candidate");
      return false;
    }

if ((form.meta[0].checked==false)  && (form.meta[1].checked==false) )
  {
   alert ("Please select party");
      return false;
    }
  
  
 
 return true;
    
 }
</script>
<BODY>




<p style="color:blue">Please fill in the form below to select the desired  name and Submit:</p>

<form name="Candidates_name" method=POST id='Candidates_name' onSubmit="return form_validation(this);">
<B>Candidates Name</B>:<br>
Men:<br>
<INPUT TYPE="radio"  name="name" value="0" /><i>Mark</i><br/>
<INPUT TYPE="radio"  name="name" value="1" /><i>Joe</i><br/>
<INPUT TYPE="radio"  name="name" value="2" /><i>Gilbert</i><br/>
Women:<br>
<INPUT TYPE="radio"  name="name" value="3" /><i>Laura</i><br/>
<INPUT TYPE="radio"  name="name" value="4" /><i>Edith</i><br/>
<INPUT TYPE="radio"  name="name" value="5" /><i>June</i><br/>
<INPUT TYPE="radio"  name="name" value="6" /><i>Laxmi</i><br/></br>

Parties:<br>
<INPUT TYPE="radio"  name="meta" value="7" /><i>Chief party</i><br/>
<INPUT TYPE="radio"  name="meta" value="8" /><i>Main party</i><br/>

<input type="submit" value="Submit"  >
<input type="reset" value="Reset">

</FORM>
</BODY>
</HTML>
urtrivedi 276 Nearly a Posting Virtuoso

POST will send values separetly and GET method will send values in URL (visible in address bar).
Both method will send data to your perl script.
in php we use $_POST for POST method
and $_GET for GET method

I m not sure about PERL

urtrivedi 276 Nearly a Posting Virtuoso

Usually I follow like
html1-> submit-> perl(save/fetch database) -> html2 -> submit -> perl (save/fetch)

what you want is
html1-> html2 (store html1 posted values in hidden variable using js) -> submit -> perl(save/fetch database)

In short you need to preserve html1 values in html2's form, using javascript in hidden element, so when you submit html2, it will submit values of both forms to perl script. Make sure you do not use same name of html elements in both forms.

urtrivedi 276 Nearly a Posting Virtuoso

Now I understand your problem as following. I hope I am right.

You want to send reminder mail to those customers who have changed vehicle oil 3 months back.

So I would follow given steps to achieve this.

1) select records which are getting 3 months old. today. (one single select query with proper join will extract all information required to send mail).

2) loop them to send mail (you already have mail logic, just you need to keep under loop).

Here is complete code, nothing else required, Here my first line is sql query, first lets run it in phpmyadmin, if it gives proper result than you may go for mail part. query may have some syntax error as I have no database here.

$get_swork2 = "select 
 ad.fistname, ad.lastname, ad.customerid, ad.dhtmlgoodies_category, ad.dhtmlgoodies_subcategory, ad.caryear, aj.email, sr.servicearea, sr.clientID, sr.customerid, max(sr.date)  last_date
from servicesrendered sr inner join ajax_client aj on sr.clientId=aj.clientid and sr.customerid=aj.customerid
inner join additinal_cars ad on
sr.clientId=ad.clientid and sr.customerid=ad.customerid
where
sr.servicearea like '%Oil Change%' and trim(aj.email) <>''
having date_add(max(sr.date), interval 3 month)=current_date
group by
 ad.fistname, ad.lastname, ad.customerid, ad.dhtmlgoodies_category, ad.dhtmlgoodies_subcategory, ad.caryear, aj.email, sr.servicearea, sr.clientID, sr.customerid";

 $get_swork2_res = mysql_query($get_swork2); 

  if (mysql_num_rows($get_swork2_res) > 0) 
  { 
     while ( $swork2_info = mysql_fetch_array($get_swork2_res)) 
    { 

/////fetch data
      $firstname = $swork2_info['firstname']; 
      $lastname = $swork2_info['lastname']; 
      $customerid = $swork2_info['customerid'];
      $dhtmlgoodies_category = $swork2_info['dhtmlgoodies_category']; 
      $dhtmlgoodies_subcategory = $swork2_info['dhtmlgoodies_subcategory']; 
      $caryear = $swork2_info['caryear']; 
      $recipientAddr=$swork2_info['email']; 

///////send mail
//mail begins
         $fromAddr = 'noreply@autotechpro.net';
	 $today_date = date("M-d-Y"); 
	 $today_is =date('l, F j, Y');
	 $email2 ='admin@autotechpro.net';
	 $subjectStr = 'Courtsey Automatic Oil Change reminder';
	
$mailBodyText = …
urtrivedi 276 Nearly a Posting Virtuoso

2.input to php page, on this, I'm not following. could you please clarify?

I mean any thing you pass like 'oil change' or anything else

3. there is no output format, the code will be ran using cron job. In the code, an email is to be sent once all the variables have been selected, passed and crossed check. Then, a mail function is written into the code to perform that task. this part works fine. I have ran some test with manually coding in some values.

If you have tested that what is the problem? please tell to whom you want to send mails. also tell me where is clientid/customernumber in ajax_client and additional_cars

urtrivedi 276 Nearly a Posting Virtuoso

I think you are making it little complicated, This could be achevied using joining the table. So please post following

1) your table structure and
2) input to php page
3) output format expected

Also tell me what is the difference between your customerid and clientid

urtrivedi 276 Nearly a Posting Virtuoso

make supplier plural add 's' before @ sign
'suppliers@%'

urtrivedi 276 Nearly a Posting Virtuoso

There was select keyword near = sign, thats why you might have got error, following should work.

UPDATE listing SET email= CONCAT(REPLACE(title, ' ','' ) , SUBSTR(email, INSTR(email,  '@' ) ) ) WHERE email LIKE 'supplier@%'
urtrivedi 276 Nearly a Posting Virtuoso

adam_k's query will work well (for ESN 123). Here I am posting it without subquery and for all ESN

select a.ESN, a.TYPE,a.DATE,b.RMA
from tablename a 
left join tablename b on a.ESN=b.ESN and b.TYPE=11
where a.type = 2
urtrivedi 276 Nearly a Posting Virtuoso

You are not getting my question. I will ask in other way round.
why you have not picked ?
123|4|2011-03-17|3

urtrivedi 276 Nearly a Posting Virtuoso
select post_id, topic,body, dateposted order by dateposted desc limit 0,10
urtrivedi 276 Nearly a Posting Virtuoso

on what basis you chose following record for RMA
123|11|2011-03-01|3

urtrivedi 276 Nearly a Posting Virtuoso

you can use where condition to filter records

UPDATE listing SET email=SELECT CONCAT(REPLACE(title, ' ','' ) , SUBSTR(email, INSTR(email,  '@' ) ) ) where email like 'supplier@%'
urtrivedi 276 Nearly a Posting Virtuoso

before running this query keep backup of that column. or do it in dummy database

update tablename set colname=replace(colname,'TVM/01/00','TVM/01/2000')
urtrivedi 276 Nearly a Posting Virtuoso

SYNTAX

select substring(COLNAME, 1, CHARINDEX('/',COLNAME, CHARINDEX('/',COLNAME)+1)) FROM TABLENAME

EXAMPLE

select substring('TVM/345/2000,TVM/01/00,TSR/42/01', 1,CHARINDEX('/','TVM/345/2000,TVM/01/00,TSR/42/01',CHARINDEX('/','TVM/345/2000,TVM/01/00,TSR/42/01')+1))
urtrivedi 276 Nearly a Posting Virtuoso

You are talking about cron job (linux) and schedule job (windows).
You create your php page to do so,
google for cron job settings.

you can schedule that php script to run whenever and however you want you want.

urtrivedi 276 Nearly a Posting Virtuoso
select last_name, count(*) total from user_master 
group by last_name
having count(*) = 1

This query will find last_name that occurs only once in the table.
so you must use having with aggregate functions.

urtrivedi 276 Nearly a Posting Virtuoso

use single quotes (') instead of double quotes(") at line no 48

$q="UPDATE users SET first_name='$fn', last_name='$ln', email='$e' WHERE user_id='$id' LIMIT 1";
urtrivedi 276 Nearly a Posting Virtuoso

If you are already having date type (reshipdate) then why are u converting it. starting away insert it.

any way try to use
1) change yy to yyyy and change / to -

or

2) str_to_date function

urtrivedi 276 Nearly a Posting Virtuoso
if(count($argument)==1)
			{
				$this->name=$argument[0];
			}
			if(count($argument)==2)
			{
				$this->name=$argument[0];
				$this->msg=$argument[1];
			}

Here you have not written $ sign before argument. In my previous post I suggest about position of dollar sign. So Here this->name is different then argument, so both will start with dollar sign.

urtrivedi 276 Nearly a Posting Virtuoso

change this line 19 from

if(isset($_POST['submitted']))

to

if(isset($_POST['submit']))

because you are giving name submit to the submit-button and not submitted.

urtrivedi 276 Nearly a Posting Virtuoso

run it through sed

Hi smantscheff, I do not understand this, please explain.

urtrivedi 276 Nearly a Posting Virtuoso
UPDATE listing SET email=SELECT CONCAT(REPLACE(title, ' ','' ) , SUBSTR(email, INSTR(email,  '@' ) ) )
urtrivedi 276 Nearly a Posting Virtuoso
$arr[2]=150;
$arr[231]=163;
$arr[235]=1121;
urtrivedi 276 Nearly a Posting Virtuoso

YOU need to run update query in mysql
to update emails

update listing set email='title@test.domain.com' where 
email='suppliers@test.domain.com'

Be carefull before using following query. it will set title to title without spaces in all records, so better you add new column say title_wo_space, then use following query

update listing set title_wo_space=replace(title,' ','')
urtrivedi 276 Nearly a Posting Virtuoso

You can not write where condition in insert statement, remove following part from query. Query will itself find id when u try to insert duplicate row

WHERE id='$edit_sel_id'

If your table have auto_increment then this query will not work. It will only work when you pass all columns in insert statement. If you have another indexes and unique columns, then this query will respond properly.

urtrivedi 276 Nearly a Posting Virtuoso

I assume that you have defined your primary key or unique key for you table. If yes then you can use following single query. search more "on duplicate key mysql"

insert into tablename(col1,col2, col3) values('1','2','3') on duplicate key update set col2='22', col3='33'
urtrivedi 276 Nearly a Posting Virtuoso

what are values of, num1 and num2.
Your second loop will never execute. eveyting depends on num1 and num2

urtrivedi 276 Nearly a Posting Virtuoso

I think ftp is better. Share ftp userid password with him. Because even if you find such tool, to change single page, he need to download whole site.

urtrivedi 276 Nearly a Posting Virtuoso

You may mark it solved, You may start another thread for second problem. Its little complex to get that work.

urtrivedi 276 Nearly a Posting Virtuoso

You have explained this problem in very well manner.

I have added one more column adj, check are you getting what is expected. Here I have used ifnull function

.
.
.
, d.change as DIFF
, ((sum(CASE WHEN (".$ht." AND ".$hw.")OR(".$at." AND ".$aw.") THEN 3 ELSE 0 END)
+ sum(CASE WHEN (".$ht." OR ".$at.") AND ".$d." THEN 1 ELSE 0 END))) +ifnull(d.change,0)  AS adj
.
.
.
MargateSteve commented: Perfect Answer +1
urtrivedi 276 Nearly a Posting Virtuoso
var total=no+no1+no2;
html += 'a.one + a.arr[0] + a.two = ' + total + '<br/>';
document.getElementById('content').innerHTML = html;
​
urtrivedi 276 Nearly a Posting Virtuoso

use function
mysql_fetch_assoc() to get array with column name as key instead of index

urtrivedi 276 Nearly a Posting Virtuoso

You are using parameter CommandBehavior.SchemaOnly, so I think its not a problem in performance.

urtrivedi 276 Nearly a Posting Virtuoso

Make sure you write $this->name and NOT $this->$name.

<html>
<head>
Creating objects
</head>
<body>
<?php
class Objects
{
	var $name;

	function set_name($na)
	{
		$this->name= $na;
	}
	
	function get_name()
	{
		return $this->name;
	}
}

$ob=new Objects;
$ob->set_name("ila");
echo "the name of greatest person alive is ",$ob->get_name();

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

echo certain things as i have written below and see what comes in id

echo "<pre>";
print_r($_POST['number']);
echo "</pre>";

$id = implode(",",$_POST[number]);
echo $id;
.
.
.
PsychicTide commented: Thank you, sir +4
urtrivedi 276 Nearly a Posting Virtuoso

I have added constraint at the end.

CREATE TABLE test(
	id INTEGER AUTO_INCREMENT,
	iduser INTEGER REFERENCES player(id) ON UPDATE CASCADE ON DELETE CASCADE,
.
.
class CHAR(10) NOT NULL ,

.
.
PRIMARY KEY(id,iduser),
FOREIGN KEY (iduser) REFERENCES user(idu),
CONSTRAINT chk_class CHECK (class IN ('x1','x2','x3'))
);
urtrivedi 276 Nearly a Posting Virtuoso

echo your array structure. before everything and check is it as expected

<?php
echo "<pre>";
print_r($array);
echo "<pre>";

if(is_array($array)){
.
.
.
?>
urtrivedi 276 Nearly a Posting Virtuoso

first change name of checkbox to number[] (i have done that change only). this action will send checkbox array to processing page.

<?php
/*connect to and select database*/

$num_rows = mysql_num_rows($result);
$i = 0;
while ($i < $num_rows)
{
  $row = mysql_fetch_array($result);
  $num = $row['id'];
?>
<form action="delete.php" method="post">
...
<div><input type="checkbox" name="number[]" value="<? $num ?>" /><br /><? echo $num ?></div>
...
/*HTML here which displays the rest of the PHP column variables I have set up*/
<? $i++;} ?>

then join array values with comma using implode function

<?php
/*connect to and select database*/

$id = implode(",",$_POST[number]);
mysql_query("DELETE FROM home WHERE id in ({$id})") 
or die(mysql_error()); 
?>
urtrivedi 276 Nearly a Posting Virtuoso

remove 's' from line 7
it should look like below

$error_array=array();
urtrivedi 276 Nearly a Posting Virtuoso

you must take out friend request code out of if condition that is

if(isset($_GET["accept"])) {
//START OF SHOW FRIEND REQUESTS
$query = mysql_query("SELECT * FROM friend_requests WHERE recipient = '" . $_SESSION["logged"] . "'");
if(mysql_num_rows($query) > 0) {
while($row = mysql_fetch_array($query)) { 
$_query = mysql_query("SELECT * FROM members WHERE id = '" . $row["sender"] . "'");
while($_row = mysql_fetch_array($_query)) {
echo $_row["username"] . " wants to be your friend. <a href=\"" . $_SERVER["PHP_SELF"] . "?accept=" . $_row["id"] . "\">Accept?</a><br />";
//END OF SHOW FRIEND REQUESTS
urtrivedi 276 Nearly a Posting Virtuoso

in the begining of your code, you check the post values and see whether you are getting expected variables, and their values or not

<?php
echo "<pre>";
print_r($_POST);
echo "</pre>";
$connect=mysql_connect("localhost","root","");
.
.
.
urtrivedi 276 Nearly a Posting Virtuoso
urtrivedi 276 Nearly a Posting Virtuoso

post both files here configuration.php and index.php

urtrivedi 276 Nearly a Posting Virtuoso

put need to put deleimiter between sql commands like semicolon or any other.

DROP PROCEDURE IF EXISTS sp_Insert_Address;

if you are runing this commands in phpmyadmin, then you can use another command terminator like @@

so you code will look like

DROP PROCEDURE IF EXISTS sp_Insert_Address @@

CREATE PROCEDURE sp_Insert_Address
(
	IN p_UserID INT(11),
	IN p_Type VARCHAR(50),
	IN p_Address VARCHAR(50),
	IN p_City VARCHAR(75),
	IN p_State VARCHAR(2),
	IN p_Zip VARCHAR(15),
	IN p_mDefault INT(1)
)
BEGIN
    INSERT INTO addresses 
	(
		UserID, 
		TYPE, 
		Address, 
		City, 
		State, 
		Zip, 
		mDefault
	) 
	VALUES 
	(
		p_UserID, 
		p_Type, 
		p_Address, 
		p_City, 
		p_State, 
		p_Zip, 
		p_mDefault
	);
END@@

NOw when you copy above code in sql window, at the bottom you will find delimiter field there you replace semicolon (;) with double at sign (@@), and then execute statment