pipinha Posted October 7, 2009 at 02:57 PM Report Share #290449 Posted October 7, 2009 at 02:57 PM oi estou a testar uns scripts da affiliate network pro mas esta me a dar alguns erros que nao tou a conseguir resolver. Se me puderem ajudar agradeço imenso (desculpem se estiver no local errado) Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/mysite/public_html/dailyroutine.php on line 30 Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/mysite/public_html/dailyroutine.php on line 70 Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/mysite/public_html/dailyroutine.php on line 152 File dailyroutine.php <?php function ChangeStaus($minimum_amount) { //geting records from table $pay_sql = "select * from merchant_pay where pay_amount < $minimum_amount "; $pay_ret = @mysql_query($pay_sql); //echo mysql_error(); //checking for each records if(@mysql_num_rows($pay_ret)>0) { while($pay_row=@mysql_fetch_object($pay_ret)) { $id= trim(stripslashes($pay_row->pay_merchantid)); //geting records from table $sql1 = "update partners_merchant set merchant_status='empty' where merchant_id=$id and merchant_status not like 'NP'"; $ret = @mysql_query($sql1); } } } function getProgramFee(){ $sql = "SELECT program_merchantid,program_id,program_fee,program_value,program_type FROM partners_program"; $ret = @mysql_query($sql); if(mysql_num_rows($ret)>0){ while($row = mysql_fetch_object($ret)){ $merid = $row->program_merchantid; $id = $row->program_id; $prgm_fee = trim($row->program_fee); $prgm_value = $row->program_value; $prgm_type = $row->program_type; if(($prgm_type == "0")){ $prgm_fee = $program_fee; $prgm_value = $program_value; $prgm_type = $program_type; } if($prgm_type==2){ $sqlFee = "SELECT adjust_date AS DATE FROM partners_fee WHERE adjust_no = $id and adjust_action like 'programFee' order by adjust_date desc"; $retFee = mysql_query($sqlFee); if(mysql_num_rows($retFee)>0){ $rowFee = mysql_fetch_object($retFee) ; $date = $rowFee->DATE; $sqlCheck = "SELECT date_format(date_add('$date',INTERVAL $prgm_value),'%H/%i/%s/%d/%m/%y') as R"; $retCheck = mysql_query($sqlCheck); $rowCheck = mysql_fetch_object($retCheck) ; $d = $rowCheck->R; if(!Compare($d)){ payProgramFee($merid,$prgm_fee,$id); } } } } } } function setPending(){ $sql = "SELECT * FROM partners_fee WHERE adjust_flag='pending' and adjust_action like 'programFee' "; $ret = mysql_query($sql); if(mysql_num_rows($ret)>0){ while($row = mysql_fetch_object($ret)){ $amount = $row->adjust_amount; $mid = $row->adjust_memberid; $id = $row->adjust_id; $pgmid = $row->adjust_no; closeFee($id,$mid,$pgmid,$amount); } } } //-------------------------------------------------------- // Function to get and pay Monthly membership Fee //-------------------------------------------------------- function payMembership(){ /* checks whethre mebership type is recurring or not. */ if($membership_type==2){ /* if recurring gets all merchants accounts */ $sql = " SELECT * FROM partners_merchant "; $ret = mysql_query($sql); if(mysql_num_rows($ret)>0){ while( $row = mysql_fetch_object($ret)){ # Merchant Id $id = $row->merchant_id; $type = $row->merchant_type; /* Checks the type of user and set the fee accodingly */ if($type=="normal") $fee = $normal_user; else $fee = $advanced_user; /* Get the last Payment Date */ $sqlFee = "SELECT adjust_date AS DATE FROM partners_fee WHERE adjust_memberid = $id and adjust_action like 'register' order by adjust_date desc LIMIT 0,1"; $retFee = mysql_query($sqlFee); if(mysql_num_rows($retFee)>0){ $rowFee = mysql_fetch_object($retFee) ; $date = $rowFee->DATE; /* checks whether the date next payment date has expired */ $sqlCheck = "SELECT date_format(date_add('$date',INTERVAL $membership_value),'%H/%i/%s/%d/%m/%y') as R"; $retCheck = mysql_query($sqlCheck); $rowCheck = mysql_fetch_object($retCheck) ; $d = $rowCheck->R; /* if expired do payment */ if(!Compare($d)){ payMembershipFee($id,$fee); } } } } } } /* Do Pending Membership Paymets */ function setMemPending(){ $sql = "SELECT * FROM partners_fee WHERE adjust_flag='pending' and adjust_action like 'register' "; $ret = mysql_query($sql); if(mysql_num_rows($ret)>0){ while($row = mysql_fetch_object($ret)){ $amount = $row->adjust_amount; $mid = $row->adjust_memberid; $id = $row->adjust_id; $pgmid = $row->adjust_no; closeMemFee($id,$mid,$amount); } } } function Compare($ipblock) { //comparing date $dtarray =explode("/",$ipblock); $iphour =$dtarray[0]; $ipminute =$dtarray[1]; $ipsecond =$dtarray[2]; $ipdate =$dtarray[3]; $ipmonth =$dtarray[4]; $ipyear =$dtarray[5]; //current $d=date("d"); $m=date("m"); $y=date("Y"); $h=date("H"); $i=date("i"); $s=date("s"); $today=mktime($h,$i,$s,$m,$d,$y); $ipblock= mktime($iphour,$ipminute,$ipsecond,$ipmonth,$ipdate,$ipyear); if($ipblock>$today) return true; else return false; } ?> Obrigado APARTE: Usa Geshi, fica mais apresentável. 👍 Link to comment Share on other sites More sharing options...
scorch Posted October 7, 2009 at 03:06 PM Report Share #290450 Posted October 7, 2009 at 03:06 PM Estás a fazer a conexão à base de dados? Verifica se a tabela tem esses campos, se não te enganas-te a escrever o nome de alguma coluna/tabela. 👍 PS: Não respondo a perguntas por mensagem que podem ser respondidas no fórum. Link to comment Share on other sites More sharing options...
pipinha Posted October 7, 2009 at 04:13 PM Author Report Share #290474 Posted October 7, 2009 at 04:13 PM oi obrigado pela rapida resposta realmento nao encontro no sql mas eu coloquei o ficheiro ai meu deus e como é k eu posso criar??? mais uma vez muito obrigado Link to comment Share on other sites More sharing options...
scorch Posted October 7, 2009 at 04:22 PM Report Share #290476 Posted October 7, 2009 at 04:22 PM Criar as tabelas? Tens o PHPMyAdmin? PS: Não respondo a perguntas por mensagem que podem ser respondidas no fórum. Link to comment Share on other sites More sharing options...
pipinha Posted October 7, 2009 at 04:30 PM Author Report Share #290479 Posted October 7, 2009 at 04:30 PM sim tenho eu nao sei é criar a estrutura para meter no sql tipo -- -- Table structure for table `partners_worldpay` -- DROP TABLE IF EXISTS `partners_worldpay`; CREATE TABLE `partners_worldpay` ( `worldpay_id` bigint(20) NOT NULL auto_increment, `worldpay_accno` varchar(255) NOT NULL default '', `worldpay_status` varchar(255) NOT NULL default '', PRIMARY KEY (`worldpay_id`) ) ; Link to comment Share on other sites More sharing options...
scorch Posted October 7, 2009 at 04:40 PM Report Share #290482 Posted October 7, 2009 at 04:40 PM Se tens o PHPMyAdmin vais à base de dados que queres. Depois, se a tabela ainda não existir, tens um campo lá para cria-la. Mas há imensos tutorias pela net de usar o PHPMyAdmin. Vê este. 👍 PS: Não respondo a perguntas por mensagem que podem ser respondidas no fórum. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now