Jump to content

not shure what im doing wrong


gere06

Recommended Posts

<?

include("./config22.php");

$games=mysql_query("SELECT id,name,num,flink,rew,pre,guide FROM games WHERE id=$gui[id]");
while(list($id,$name,$num,$flink,$rew,$pre,$guide,)=mysql_fetch_row($games)){


if($rew == 1){
$rewv="<a href='http://ps3trophys.com/reviews/review.php?rev[id]=$id'>Review</a>";
}else{
$rewv="Review";
}
if($pre == 1){
$prev="<a href='http://ps3trophys.com/reviews/preview.php?pre[id]=$id'>Preview</a>";
}else{
$prev="Preview";
}
if($guide == 1){
$gui="<a href='http://ps3trophys.com/guides/guide.php?gui[id]=$id'>Guide</a>";
}else{
$gui="Guide";
}
if($img == 1){
$imgs="<a href='http://ps3trophys.com/Screenshots/Screenshots.php?scr[id]=$id'>Screenshots</a>";
}else{
$imgs="Screenshots";
}
if($vido == 1){
$vid="<a href='http://ps3trophys.com/videos/videos.php?vid[id]=$id'>Videos</a>";
}else{
$vid="Videos";
}
if($chet == 1){
$che="<a href='http://ps3trophys.com/cheats/cheats.php?che[id]=$id'>Cheats</a>";
}else{
$che="Cheats";
}


$fflink="<a href='$flink'>Forum Link</a>";


$out[body].="<center><br />$headlogo<br />
			$prev | $rewv | $gui | $imgs | $vid | $che | $fflink
			<br />
			<br />


                </tr>";

}

$thisguide=mysql_query("SELECT * FROM guide WHERE id=$gui[id]");
while(list($id,$name,$date)=mysql_fetch_row($thisguide)){


if($config[altcolorx]==$config[altcolora]){
$config[altcolorx]="$config[altcolorb]";
}else{
$config[altcolorx]="$config[altcolora]";
}
$out[body].="
<tr bgcolor='$config[altcolorx]'>
    <td width='10%' background='$config[cellbgx]'> $timg1 </td>
 <td width='35%' background='$config[cellbgx]'> $name</td>
    <td width='45%' background='$config[cellbgx]'> $dis</td>
    <td width='10%' background='$config[cellbgx]'>$trimg2</td>
    </tr>";

}

$out[body].="</table></center>";

$out[body].="<br /><br />";

include("$config[html]");


?>


 

$thisguide=mysql_query("SELECT * FROM guide WHERE id=$gui[id]");

while(list($id,$name,$date)=mysql_fetch_row($thisguide)){

 

 

my error is coming from this if i change WHERE id=$gui[id] to WHERE id=1 it works but i need to to work the other way the first one works fine

 

$games=mysql_query("SELECT id,name,num,flink,rew,pre,guide FROM games WHERE id=$gui[id]");

while(list($id,$name,$num,$flink,$rew,$pre,$guide,)=mysql_fetch_row($games)){

 

Link to comment
https://forums.phpfreaks.com/topic/113471-not-shure-what-im-doing-wrong/
Share on other sites

The bold red didn't show up, but I'm assuming that your query is the problem.

 

Where are you getting the variable $gui[id]? If you want to pull something from the URL, you need to use $_GET.

 

Try

SELECT id,name,num,flink,rew,pre,guide FROM games WHERE id={$_GET['id']}

 

http://ps3trophys.com/guides/guide.php?gui=1

 

working code for that page

 

<?

include("./config22.php");



$thisguide=mysql_query("SELECT * FROM guide WHERE gid=$gui[id]");
while(list($gid,$name,$dis,$guid,$date)=mysql_fetch_row($thisguide)){


if($config[altcolorx]==$config[altcolora]){
$config[altcolorx]="$config[altcolorb]";
}else{
$config[altcolorx]="$config[altcolora]";
}
$out[body].="

<br />
<center>
<td align='center'>
</td>
<table border='0' cellpadding='2' cellspacing='1' width='90%' bgcolor=000000>
                   <tr>
            <td background='$config[bg]' width='90%'>
<center><b> $name</b> </i></left></center> </td>
</tr>
<tr>
<td background='$config[bg2]' width='90%'>
<left> Published on $date </i></left></td>

	  </tr>

<tr bgcolor='$config[altcolora]'>
<td width=100% valign=top align=left>$guid</td>
</tr>

<tr bgcolor='$config[altcolora]'>
<td width=100% valign=top align=left>Published by <b>gere</b></td>
</tr>


</table><br /><br /><br /><br />";

}

$out[body].="</table></center>";

$out[body].="<br /><br />";

include("$config[html]");


?>


 

 

 

 

but when i add the nav bar to the top of the page it breaks the code

 

$games=mysql_query("SELECT id,name,num,flink,rew,pre,guide FROM games WHERE id=$gui[id]");
while(list($id,$name,$num,$flink,$rew,$pre,$guide,)=mysql_fetch_row($games)){


if($rew == 1){
$rewv="<a href='http://ps3trophys.com/reviews/review.php?rev[id]=$id'>Review</a>";
}else{
$rewv="Review";
}
if($pre == 1){
$prev="<a href='http://ps3trophys.com/reviews/preview.php?pre[id]=$id'>Preview</a>";
}else{
$prev="Preview";
}
if($guide == 1){
$gui="<a href='http://ps3trophys.com/guides/guide.php?gui[id]=$id'>Guide</a>";
}else{
$gui="Guide";
}
if($img == 1){
$imgs="<a href='http://ps3trophys.com/Screenshots/Screenshots.php?scr[id]=$id'>Screenshots</a>";
}else{
$imgs="Screenshots";
}
if($vido == 1){
$vid="<a href='http://ps3trophys.com/videos/videos.php?vid[id]=$id'>Videos</a>";
}else{
$vid="Videos";
}
if($chet == 1){
$che="<a href='http://ps3trophys.com/cheats/cheats.php?che[id]=$id'>Cheats</a>";
}else{
$che="Cheats";
}


$fflink="<a href='$flink'>Forum Link</a>";


$out[body].="<center><br />$headlogo<br />
			$prev | $rewv | $gui | $imgs | $vid | $che | $fflink
			<br />
			<br />
                
              
                 </tr>";

}

 

 

 

if only one of then are on the page that one will work but if there are both there it breaks  they are both pulling ?gui[id]=1 from the url and i think that has something to do with it i just don't know how to make it work

 

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.