Can anyone help me as to how I would handle recurring invoices in PHP I have it making invouices with a due date...

but say I wanted to mark an invoice to auto invoice every month... how would the script work and what data is needed to do that?

I know you can auto run the script to do it using Cron Jobs.... just cant get my head around it =)

Thanks for your help in advanced =)

Ok, I have come up with something, can anyone clarify if this will work or now... the script will be run every day.


$inv_q = mysql_query("SELECT * FROM `invoices` WHERE `status` != '7'");
while($inv_r = mysql_fetch_assoc($inv_q)){
$recure = $inv_r['recure']; // EG + 1 month
$due_date = $inv_r['duedate']; // EG 1316361990

if($recure != NULL){	
	$mk_n_date = date("d/m/Y", strtotime($recure, $due_date));
	if($mk_n_date == date("d/m/Y")){
		// Mk new Inv
		echo "I made a new invoice!!<br>";
		// Dont
		echo "I didnt make a new invoice<br>";



Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.