<?php
$nom="sayas";
echo substr_count($nom,"a");
$nom=str_replace("a","o",$nom);
echo $nom;
/*
$CX=0;
$s="SELECT id_cliente ,DATE_FORMAT(fec,'%d-%m-%y') as F ,CONCAT(ser,'-',num) as N FROM cotizaciones WHERE anu='N' ORDER BY id_cotizacion";
$result = grs($s);
while ($row = $result->fetch_assoc()){	
	$_CLI=$row['id_cliente'];
	$_FEC=$row['F'];
	$_NUM=$row['N'];
	if(gn("count(*)","clientes","id_cliente=$_CLI")==0){
		$CX++;
		echo "CASO : $CX"."<br>";
		echo "PROFORMA FECHA: $_FEC "."<br>";
		echo "PROFORMA NUMERO: $_NUM "."<br>";
		echo "CLIENTE ELIMINADO : $_CLI"."<br>";
		echo "-------------------------------------------<br>";
		$s="INSERT INTO clientes VALUES ($_CLI, 'CLIENTE RESTAURADO #".$CX." ', '', 'LIMA', 0, '', '', '', '', '', '', 0)";
		ejt($s);
		
	}
}
*/

/*
$s="SELECT id_cobro as ID,
	DATE_FORMAT(cob_fec,'%d-%m-%y') as FE,
	cob_icser as PS,
	cob_icnum as PN 
	FROM  cobroz 
	WHERE cob_anu='NO' AND cob_id_com=-3 ORDER BY id_cobro";

$result = grs($s);
while ($row = $result->fetch_assoc()){
	$ID=$row['ID'];
	$FE=$row['FE'];
	$PS=$row['PS'];
	$PN=$row['PN'];
	$PF=gs("DATE_FORMAT(fec,'%d-%m-%y')","cotizaciones","iser=$PS AND inum=$PN");
	if($PF==$FE){
		ejt("UPDATE cobroz SET cob_md=1 WHERE id_cobro=$ID");		
	}
}
*/
//parchar
/*
include("cls_conexion.php");$CNN=new ClsMySQL();include("conexion23.php");
$CX=0;
$s="SELECT cotizaciones.id_cotizacion AS ID 
	FROM cotizaciones 
	INNER JOIN cotizaciones_det ON cotizaciones.id_cotizacion = cotizaciones_det.id_cotizacion 
	WHERE cotizaciones_det.ve_control < 0  AND 
	cotizaciones.anu = 'N' GROUP BY cotizaciones.id_cotizacion 
	ORDER BY cotizaciones.id_cotizacion";
$result = grs($s);
while ($row = $result->fetch_assoc()){	
	$ID=$row['ID'];
	$ss="SELECT id_producto as IDP,can_uni as PIE FROM cotizaciones_det WHERE id_cotizacion=$ID";
	$r = grs($ss);
	while ($roww = $r->fetch_assoc()){
		$IDP=$roww['IDP'];
		$PIE=$roww['PIE'];
		$DES=gn("SUM(KA)","vparche","ID_COT=$ID AND ID_PRO=$IDP AND PIE=$PIE");
		$s="UPDATE cotizaciones_det 
			SET ve_control=ca - $DES 
			WHERE id_cotizacion=$ID AND id_producto=$IDP AND can_uni=$PIE";
		ejt($s);			
		//echo $s."<br>";
		$s="UPDATE cotizaciones_det 
			SET ve_control=0 
			WHERE id_cotizacion=$ID AND id_producto=$IDP AND can_uni=$PIE AND ve_control<0";
		ejt($s);
		//echo $s."<br>";
		$CX++;
	}
	
}
echo $CX." registros procesados";	
*/
?>