Jump to content

[SOLVED] Help? Get 2thing from database?


Garloz

Recommended Posts

Hello.

I need help, i need to get information from tables and then display them. I would like to display like TOP300 and the groups / FEMALE & MALE.

 

How to get best.php?id=M and best.php?id=F? I have this kind of code, but how to get them to one page..? Sorry for this kind of dumb question. :( New on this! (Sorry about english too)

 

Code:

<?php
include("header.php");

?>
<!-- main page start -->
<font size="4" color="#<?=$titlecolor?>"><b>Top MEN</b></font><p>
<?php

        $limit = 12;

        if (!isset($show)) $show=0;
{
  $query =         mysql_query("select * from photo where usersex='mees' AND active='1' AND numvotes > '9' order by score limit 300");
  $total = mysql_num_rows($query);
}

if ($p <= 1) {
        $p = 0;
        $curentpage = 1;
} else {
        $curentpage = $p;
        $p = ($p -1) * $limit;
}
if ($p < $total){
$sqluser = mysql_query("select * from photo where usersex='mees' AND active='1' AND numvotes > '9' order by score desc LIMIT $p, $limit");
$number = mysql_num_rows($sqluser);
}
else {
$sqluser =         mysql_query("select * from photo where usersex='mees' AND active='1' AND numvotes > '9' order by score desc");
}
$i = 0;
if ($total == 0) {
        $postmin = 0;
} else {
        $postmin  = $p+1;
}
$postmax = $number+$p;

$anzeige = 25;
$pages = ceil($total/$limit);
if($pages > 1) $seiten = pagelink($curentpage,$pages,$anzeige,"main.php?pID=17&id=$img_id&a=1&");

echo "$seiten<p>";

echo '<font class=contentFont2><TABLE border=0>'; 
$i=0;
if($curentpage==1){ $koht=1; }
elseif($curentpage==2){
$koht=($limit-1)+$curentpage; }
else{ $koht=($limit*$curentpage)-($limit-1); }
while($DSL_img = mysql_fetch_array($sqluser)){
$img_id = $DSL_img["id"];
$src = $DSL_img["src"];
//$subject = $DSL_img["subject"];
//$comment = $DSL_img["comment"];
$user_id = $DSL_img["userid"];
$name_from = $DSL_img["username"];
//$date = $DSL_img["date"];
//$active = $DSL_img["active"];
//$reason = $DSL_img["reason"];
$imgvoters = $DSL_img["numvotes"];
$imgvotes = $DSL_img["allvotes"];
$imgscore = $DSL_img["score"];	
//$usersex = $DSL_img["usersex"];
$showuser = showusername($user_id, "index");
if ($i == 0){ 
echo '<TR>'; 
}
echo"<font class=contentFont2><TD style=\"border: 1px solid #$tdcolor; padding: 10px;\" valign=top align=center width=140><div class=picbox>#$koht</div>
<a href=\"main.php?pID=2&id=".$img_id."\"><img src=\"thumb/".$src."\" border=0></a>
<br>".$showuser."<br>Skoor: <b>$imgscore</b>
<br>H&#228;&#228;li: <b>$imgvoters</b><p></TD>";
if($i>=3){
echo '</TR>';
$i=0;
}else{
$i++;
}
$koht++;
} 
echo '</TABLE>';
echo "<p>$seiten";

?>

<!-- main page end -->
<?php 
include("bottom.php");
?>

 

Feel free to help me, I try to understand. :$

 

My msn: [email protected] :P

Link to comment
https://forums.phpfreaks.com/topic/150703-solved-help-get-2thing-from-database/
Share on other sites

How to get best.php?id=M and best.php?id=F? I have this kind of code, but how to get them to one page..?

 

I think you're referring to variables from the URL?

 

You have to use the get method:  i.e.:

 

// url = www.yoursite.com/best.php?id=M
$id = $_GET['id'];
echo $id;  // this will echo "M"
?>

 

Sorry didn't read through your code, but I hope this answers your question.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.