Jump to content

Archived

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

lpxxfaintxx

I don't know what I'm doing wrong!

Recommended Posts

Hello,

In the last few days, I've came here for a lot of help. This time however, I looked everywhere, trying to spot an error. Ok, so here's the scoop. As some of you may know, I am making a 'tutorial CMS' site. I decided to view the tuts "Tutorialized.com" style, where the site frame is at top, and the tutorial frame is at the bottom. However, I am having some problems. It seems like a simple error, but I could not spot it anywhere.

Let's take a sample page from the site. Try going here: [a href=\"http://informedia.ws/projects/tuts/viewtut.php?id=3\" target=\"_blank\"]http://informedia.ws/projects/tuts/viewtut.php?id=3[/a]

I have 2 pages, viewtut.php and header.php. The viewtut makes a frame with the content "header.php" and another frame, which is the tutorial url. The tutorial url is stored in the MySQL database, so from there I know that the Query was succesful... but on the header page, the name and category is not appearing.. (I used the SAME query)

Here is viewtut.php
[code]
<?php
ob_start();
session_start();
include 'config.php';
$tutid = $_GET['id'];

if(isset($_GET['rate'])){
$rateid = $_GET[rate];

$getcount = mysql_query("SELECT * FROM tutorials where id='$_GET[rate]'");
      
while ($result=mysql_fetch_array($getcount)){

$new_num_votes = ($result[num_votes] + 1);
$old_total = ($result[rating] * $result[num_votes]);
$new_total = ($old_total + $_POST[rating]);
$new_rating = ($new_total / $new_num_votes);
$new_rating2 = number_format($new_rating, 2, '.', '');
  
$update_rating = mysql_query("UPDATE tutorials SET rating='$new_rating2',num_votes='$new_num_votes' where id='$_GET[rate]'");
            
            echo "<div align='center'>
            <p class='style20'>Thanks for your vote!</p>
            <p class='style20'>The new rating for this tutorial is: <br>
            <br>
            <b>$new_rating2 out of 5</b></p>";

}


} else {

$tutid = $_GET['id'];

$sql = "SELECT * FROM `tutorials` WHERE `id` = '$tutid'";
$result=mysql_query($sql);
$rows=mysql_fetch_array($result);
$url = $rows["url"];
$cat = $rows["cat"];
$name = $rows["name"];
';

echo <<<__HTML_END



<FRAMESET ROWS="95,*" frameborder="yes" border="1" bordercolor="#000000" framespacing="0">
    <FRAME NAME="header" SRC="header.php" scrolling="no" noresize>
    <FRAME NAME="tutorial" SRC="$url" scrolling="auto" noresize>
</FRAMESET><noframes></noframes>

__HTML_END;
}
?>
[/code]


This is my "header.php"

[code]
<?php
session_start();
include 'config.php';
ob_start();
?>
<style type="text/css">
<!--
body {
    background-color: #E9856E;
}
.style1 {font-family: Tahoma}
.style3 {font-family: Tahoma; font-size: medium; }
.style5 {font-family: Tahoma; font-size: small; font-style: italic; }
-->
</style>
<?
$tutid = $_GET['id'];

$sql2 = "SELECT * FROM `tutorials` WHERE `id` = '$tutid'";
$result2=mysql_query($sql2);
$rows2=mysql_fetch_array($result2);
$url2 = $rows2['url'];
$cat2 = $rows2['cat'];
$name2 = $rows2['name'];

$tutid = $_GET['tutid'];
echo <<<__HTML_END

<table width="500" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td rowspan="3"><img src="images/chimp.gif"></td>
    <td><span class="style5">Category:</span></td>
    <td><span class="style5">$cat2</span></td>
  </tr>
  <tr>
    <td><span class="style5">Name:</span></td>
    <td><span class="style5">$name2</span></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>    
    
__HTML_END;



echo <<<__HTML_END
    <form name='rating' action="viewtut.php?rate=$_GET[id]" method="post">
  Rate this tutorial:

  <select name='rating' class='input2'>
      <option value='5.0' selected>5</option>
          <option value='4.0' selected>4</option>
              <option value='3.0' selected>3</option>
                  <option value='2.0' selected>2</option>
                      <option value='1.0' selected>1</option>
                              <option value='0.0' selected>0</option>
  </select>
    <input type='hidden' name='cmd' value='do_rating'>
        <input type='hidden' name="$_GET[id]" value="$_GET[id]">
        <input type='submit' class='input2' value='Go!'>
</form>
__HTML_END;

?>
</td>
  </tr>
</table>
[/code]

Does anyone have a darn clue?

Thanks

Share this post


Link to post
Share on other sites
try this...


echo <<<__HTML_END



<FRAMESET ROWS="95,*" frameborder="yes" border="1" bordercolor="#000000" framespacing="0">
<FRAME NAME="header" SRC="header.php?id=$tutid" scrolling="no" noresize>
<FRAME NAME="tutorial" SRC="$url" scrolling="auto" noresize>
</FRAMESET><noframes></noframes>

__HTML_END;

NOTE I have simply included ?id=$tutid in teh src of the header frame!!!!!

Share this post


Link to post
Share on other sites

×

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.