Jump to content

PHP expert needed to find error in this code!


essjay_d12

Recommended Posts

The following code gets the get variable (i echoed it) and before I added the html it was echoeing the query results - so i know thats fine and working.

Personally i think its the way I have tried to insert the variables within the html code, but i thought this could be done like I have.

Can anyone see?

Please let me know if you need more information, database etc...

Thanks

[code]
<body>

<?php
$genre = $_GET['genre']; // retrieve passed variable
//open connection
$conn = mysql_connect("localhost", "admin", "adm1n");
mysql_select_db("project",$conn);

//$query = "SELECT ID_NO, F_NAME, F_DIRECTOR, F_REVIEWER, F_DATETIME, F_TYPE, F_SUMMARY, F_REVIEW, F_SCORE FROM films ORDER BY F_DATETIME LIMIT 1, 10 ";
//$query = "SELECT ID_NO, F_NAME, F_DIRECTOR, F_REVIEWER, F_DATETIME, F_TYPE, F_SUMMARY, F_REVIEW, F_SCORE FROM films ORDER BY F_DATETIME LIMIT 1, 10 ";
$query = "SELECT ID_NO, F_NAME, F_DIRECTOR, F_REVIEWER, F_DATETIME, F_TYPE, F_SUMMARY, F_REVIEW, F_SCORE FROM films WHERE F_TYPE LIKE '%$genre%' ORDER BY F_DATETIME LIMIT 1, 10 ";

$result = mysql_query($query) or die(mysql_error());
while ($row = mysql_fetch_array($result)) {
$ID_NO = ($row['ID_NO']);
$F_NAME = ($row['F_NAME']);
$F_DIRECTOR = ($row['F_DIRECTOR']);
$F_REVIEWER = ($row['F_REVIEWER']);
$F_DATETIME = ($row['F_DATETIME']);
$F_TYPE = ($row['F_TYPE']);
$F_SUMMARY = ($row['F_SUMMARY']);
$F_REVIEW = ($row['F_REVIEW']);
$F_SCORE = ($row['F_SCORE']);

echo "Simon";
echo $genre;
?>
<table width="413" border="1" cellpadding="0" cellspacing="0" class="b">
                    <tr>
                      <td width="100" rowspan="3" valign="top"><img src="images/film/<?php $ID_NO ?>a.jpg" width="96" height="140" /></td>
                      <td width="227" height="29" valign="top">Film: <?php $F_NAME ?></td>
  <td width="86" valign="top"><a href=review.php?id=<?php $id_no ?>> read review </a> </td>
  </tr>
                    <tr>
                      <td height="31" valign="top">Director: <?php $F_DIRECTOR ?></td>
                    <td valign="top">Score: <?php F_SCORE ?> </td>
                    </tr>
                    <tr>
                      <td height="80" colspan="2" valign="top">Summary : <?php $F_SUMMARY ?> </td>
                    </tr>
                    <tr>
                      <td height="16" colspan="3" valign="top"><img src="images/siteGraphics/hr.jpg" width="413" height="11" alt="----------------------------------------------" /></td>
                    </tr>
                  </table>
<?php }
?>


</body>
[/code]

Ta
Link to comment
Share on other sites

[!--quoteo(post=355035:date=Mar 14 2006, 03:12 PM:name=ToonMariner)--][div class=\'quotetop\']QUOTE(ToonMariner @ Mar 14 2006, 03:12 PM) [snapback]355035[/snapback][/div][div class=\'quotemain\'][!--quotec--]
in each case where yu are trying to show the result in the html...

change <?php $XXX; ?>

to

<?php echo $XXX; ?>

where XXX is your variable....
[/quote]

or, simply use "<?= $XXX; ?>"
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.