如何执行此查询? [英] How to execute this query?

查看:93
本文介绍了如何执行此查询?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我正在建立一个婚姻网站,现在我必须为每个用户发送一个示例个人资料,我想要一个独特的个人资料发送给每个用户,但无法找到如何做到这一点。

这是我的代码我做了什么。



 include(  db.php); 
$ query = select * from matri_user_info,其中payment ='是';
$ result = mysql_query($ query,$ con) die( Mysql错误 .mysql_error());
$ data = mysql_num_rows($ result);
$ i = 0;
while($ i< $ data)
{
$ s1 = mysql_result($ result,$ i, REG_ID);
$ s2 = mysql_result($ result,$ i, email_id);
$ s3 = mysql_result($ result,$ i, name);
$ s4 = mysql_result($ result,$ i, ipd_religion);
$ s5 = mysql_result($ result,$ i, ipd_Caste);
$ s6 = mysql_result($ result,$ i, ipd_mother_tongue);
$ s7 = mysql_result($ result,$ i, ipd_age);
$ s8 = mysql_result($ result,$ i, ipd_age1);
$ s9 = mysql_result($ result,$ i, ipd_height);
$ s10 = mysql_result($ result,$ i, ipd_height1);
$ s13 = mysql_result($ result,$ i, ipd_marital_status);

$ where = array();

if (($ s7!= )&&($ s8!= ) ){
$ where [] = and age BETWEEN $ s7 AND $ s8;
} 其他 如果($ agemin!= ){
$ where [] = 和age> = $ s7;
} 其他 如果($ agemax!= ){
$ where [] = 和年龄< = $ s8;
}
if (($ s9!= )&&($ s10!= )){
$ where [] = and height BETWEEN $ s9 AND $ s10 ;
} else if ($ hmin!= ){
$ where [] = 和height> = $ s9;
} 其他 如果($ hmax!= ){
$ where [] = 和height< = $ s10;
}

if ($ s4!= ){
$ where [] = 和religion ='$ s4';
}

如果($ s13!= ){
$ where [] = 和marital_status ='$ s13';
}


$ query1 = < span class =code-string> SELECT * FROM matri_user_info WHERE gender ='Bride'AND status ='unlock'
。加入($哪里);
$ result1 = mysql_query($ query1,$ con) die( Mysql错误 .mysql_error());
$ data1 = mysql_num_rows($ result1);
echo $ data1 ;
$ i1 = 0;
while($ i1< $ data1)
{
$ r1 = mysql_result($ result,$ i, REG_ID);
$ r2 = mysql_result($ result,$ i, name);
$ r3 = mysql_result($ result,$ i, age);
$ r4 = mysql_result($ result,$ i, height);
$ r5 = mysql_result($ result,$ i, religion);
$ r6 = mysql_result($ result,$ i, education);
$ r7 = mysql_result($ result,$ i, job);
$ r8 = mysql_result($ result,$ i, dob);
$ r9 = mysql_result($ result,$ i, candi_pic_1);

// 这里我将添加代码以将信息从r1发送到r9。
$ i1 ++;
}
$ i ++;
}





我想要什么

1- pic一张个人资料表格数据。

2-检查他的偏好并获得data1中的值。

3-在数据1中的所有数据中删除一个配置文件并发送到配置文件1的数据。

4 - 重复循环直到最后。但是每次发生这种情况都应该发送一个独特的个人资料。因为我希望每天只发送一个个人资料。因此,当第二天这个循环将执行来自data1的配置文件1时,应该更改。



如果您有任何想法或建议,请告诉我怎么做。



谢谢

解决方案

query = select * from matri_user_info,其中payment ='是';


result = mysql_query(

查询,

hi,
I am working on a matrimonial website now i have to send a sample profile for every user, i want a unique profile to send to every user but unable to find how to do it.
here is my code what i did.

include("db.php");
$query="select * from matri_user_info where payment='Yes'";
$result=mysql_query($query,$con) or die("Mysql Error".mysql_error());
$data=mysql_num_rows($result);
$i=0;
while($i<$data)
{
$s1=mysql_result($result,$i,"reg_id");
$s2=mysql_result($result,$i,"email_id");
$s3=mysql_result($result,$i,"name");
$s4=mysql_result($result,$i,"ipd_religion");
$s5=mysql_result($result,$i,"ipd_Caste");
$s6=mysql_result($result,$i,"ipd_mother_tongue");
$s7=mysql_result($result,$i,"ipd_age");
$s8=mysql_result($result,$i,"ipd_age1");
$s9=mysql_result($result,$i,"ipd_height");
$s10=mysql_result($result,$i,"ipd_height1");
$s13=mysql_result($result,$i,"ipd_marital_status");

$where = array();
 
if (($s7 !="") && ($s8 !="")) {
	$where[] = " and age BETWEEN $s7 AND $s8";
} else if ($agemin !="") {
	$where[] = " and age >= $s7";
} else if ($agemax!="") {
	$where[] = " and age <= $s8";
}
if (($s9 !="") && ($s10 !="")) {
	$where[] = " and height BETWEEN $s9 AND $s10";
} else if ($hmin !="") {
	$where[] = " and height >= $s9";
} else if ($hmax!="") {
	$where[] = " and height <= $s10";
}
 
if ($s4 !="") {
	$where[] = " and religion = '$s4'";
}

if ($s13 !="") {
	$where[] = " and marital_status = '$s13'";
}
 
 
$query1 = "SELECT * FROM matri_user_info WHERE gender = 'Bride' AND status = 'unlock'" . join($where);
$result1=mysql_query($query1,$con) or die ("Mysql error".mysql_error());
$data1=mysql_num_rows($result1);
echo $data1;
$i1=0;
while($i1<$data1)
{
$r1=mysql_result($result,$i,"reg_id");
$r2=mysql_result($result,$i,"name");
$r3=mysql_result($result,$i,"age");
$r4=mysql_result($result,$i,"height");
$r5=mysql_result($result,$i,"religion");
$r6=mysql_result($result,$i,"education");
$r7=mysql_result($result,$i,"job");
$r8=mysql_result($result,$i,"dob");
$r9=mysql_result($result,$i,"candi_pic_1");

// here i will add code to send information from r1 to r9.
$i1++;
}
$i++;
}



What i want
1- pic one profile form data.
2- Check his preference and get value in data1.
3- Pic one profile among all in data1 and send to profile 1 of data.
4- Repeat loop till last. but every time this happen a unique profile should be sent.because i want only one profile will be send per day. so when next day when this loop will execute for profile 1 value from data1 should be change.

If any one of you have any idea or suggestion then please let me know how to do this.

thanks

解决方案

query="select * from matri_user_info where payment='Yes'";


result=mysql_query(


query,


这篇关于如何执行此查询?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆