选择并更新php变量

时间:2018-11-18 11:03:47

标签: php database select sql-update

我想从表包的信息中更新会员表。 我制作了两个脚本,一个进行选择的脚本和另一个进行更新的脚本,这两个脚本位于同一页面上。      问题是更新不起作用

First_script_php
<?php
  $db_username = '*******';
  $db_password = '*********';
  $db_name     = 'u1235765_purchase';
  $db_host     = 'mysql.hostinger.fr';
  
  $db = mysqli_connect($db_host, $db_username,$db_password,$db_name) or 
  die('');                      
  $u = "SELECT *  FROM pack WHERE  sponsored = '".$result['id']."'  LIMIT 1";
  
  $u1 = "SELECT *  FROM pack WHERE  sponsored = '".$result['id']."'  LIMIT 1 offset 1 ";
  $u2 = "SELECT *  FROM pack WHERE  sponsored = '".$result['id']."'  LIMIT 1 offset 2";
  
  $au = $db->query($u);
  $au1 = $db->query($u1);
           
  $keys=mysqli_fetch_array($au);	  
  $keys1=mysqli_fetch_array($au1);      
?>


second_script_php

<?php
        $con=mysqli_connect("mysql.hostinger.fr","u1235765_purchase","*****","******");

  $member1="UPDATE affilie SET pack='".$keys['active']."' where 
  sponsor='".$result['id']."'    ";     

  $member2="UPDATE affilie SET pack='".$keys1['active']."' where 
  sponsor='".$result['id']."'    ";
     
  $may1 = mysqli_query ($con,$member1) or die("not connect".mysql_error());
  $may2 = mysqli_query ($con,$member2) or die("not connect".mysql_error());
?>

0 个答案:

没有答案