PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
I'm trying to modify a script I found on the internet. In its original form, it picks two photos and profiles, one man and one woman, from a database and displays it on a web page. I want it to pick four photos and profiles, two each, from the database. The problem I'm having is that it picks the same two profiles for each gender. (i.e. The two male profiles are the same person, as is the two female profiles.) I want it to pick different men and different women.
I know very little about php. Mostly I solve problems by changing things and seeing what the results are. But this one has me stumped.
That isn't the full code. There's variables that you're working with that weren't sent in the code you you have there. Until I can see the full code there's nothing I, nor anyone, can do.
The code I sent is part of a page called index.ihtml. When you load index.php it includes index.ihtml and index.pml, along with other pages, and these pages include other pages. Rather than post the entire script, could you give me some info on what information you need? Thanks.
As far as I can tell, $male and $female needs to be random, but I don't have a clue as to how this script picks them. What would I look for?
<?
$search_query = "SELECT *, p.id, p.gender FROM dt_profile AS p, dt_photos as f, dt_members as m WHERE (p.status='1' AND p.member_id=m.id and p.member_id=f.member_id AND f.filename_1 <> '' AND p.gender='Male') ORDER BY RAND()";
$male = f(q($search_query));
$maleage = $maleїage];
$maleї marital_status ] = f(q("SELECT name FROM dt_marital_status WHERE id='$maleїmarital_status]'"));
$maleї marital_status ] = $maleї marital_status ]ї name ];
$maleї country ] = f(q("SELECT name FROM dt_countries WHERE id='$maleїcountry]'"));
$maleї country ] = $maleї country ]ї name ];
$qWords = q("select name from dt_badwords");
if($censor_on)
{
$replace = "*";
while($fWords = f($qWords))
{
for($i = 0; $i < strlen($fWordsїname]); $i++)
$replace .= "*";
$maleїgeneral_info] = eregi_replace($fWordsїname], $replace, $maleїgeneral_info]);
$maleїappearance_info] = eregi_replace($fWordsїname], $replace, $maleїappearance_info]);
$maleїlooking_for_info] = eregi_replace($fWordsїname], $replace, $maleїlooking_for_info]);
}
}
$search_query = "SELECT *, p.id, p.gender FROM dt_profile AS p, dt_photos as f, dt_members as m WHERE (p.status='1' AND p.member_id=m.id and p.member_id=f.member_id AND f.filename_1 <> '' AND p.gender='Female') ORDER BY RAND()";
$female = f(q($search_query));
$femaleage = $femaleїage];
$femaleї marital_status ] = f(q("SELECT name FROM dt_marital_status WHERE id='$femaleїmarital_status]'"));
$femaleї marital_status ] = $femaleї marital_status ]ї name ];
$femaleї country ] = f(q("SELECT name FROM dt_countries WHERE id='$femaleїcountry]'"));
$femaleї country ] = $femaleї country ]ї name ];
$qWords = q("select name from dt_badwords");
if($censor_on)
{
while($fWords = f($qWords))
{
$replace = "*";
for($i = 0; $i < strlen($fWordsїname]); $i++)
$replace .= "*";
$femaleїgeneral_info] = eregi_replace($fWordsїname], $replace, $femaleїgeneral_info]);
$femaleїappearance_info] = eregi_replace($fWordsїname], $replace, $femaleїappearance_info]);
$femaleїlooking_for_info] = eregi_replace($fWordsїname], $replace, $femaleїlooking_for_info]);
}
}
include "templates/index.ihtml";
?>
Short for inline HTML, an advanced server-side scripting/programming language that functions as an extension to HTML, allowing the customization of dynamic Web sites that depend on interaction with databases. iHTML eliminates the need for Javascript or CGI programs as it provides the same functionality. See http://www.ihtml.com.
Files with the pml extension seem to be pieces of code that get inserted into php files.