/    Sign up×
Community /Pin to ProfileBookmark

Some more problems with Announcements page

Alright, I’m having some more problems with my subject of announcements scripts.

My database has three posts in it, one for each of the available subjects (not including all of course).
When I submit my choice it only shows two posts, thing is, they’re the same post, and the subject of it is under the “Site Updates” subject.

Thanks in advance of course.

[code=php]
<?php
include(‘header.php’);
$sql= “SELECT * FROM `post`”;
$results=mysql_query($sql);
$row=@mysql_fetch_array($results)
?>
<?php
if (!isset($_POST[‘subj’]))
{?>
<form method=”post”>
<dl align=”center”>~!~ Subject Of Announcement ~!~
<dd>Web Design<input type=”radio” name=”subj” value=”Web Design”></dd>
<dd>Tech Support<input type=”radio” name=”subj” value=”Tech Support”></dd>
<dd>Site Updates<input type=”radio” name=”subj” value=”Site Updates”></dd>
<dd>All<input type=”radio” name=”subj” value=”All”></dd>
</dl>
<input type=”submit” value=”View”>
</form>
<?php }
if (isset($_POST[‘subj’]))
{ $viewSub = $_POST[‘subj’];
if ($viewSub != “All”)
{
$query = “SELECT * FROM `post` WHERE `$viewSub` = ‘{$row[‘subject’]}'”;
$result2 = mysql_query($query);
while($row2 = mysql_fetch_array($result2)){ $posted = $row2[0]; }
}
else $posted = $row[‘post’];
}
//———————//
if (isset($viewSub))
{
if($username!=NULL){ ?><br><div align=”left”><b><a href=”addannouncement.php”>Add An Announcement</a></b></div><br><? }?>
<table border=”3″>
<tr>
<?php if($username!=NULL){ ?><td align=”center”><b>Options</b></td> <?php }?>
<td align=”center”><b>Date</b></td>
<td align=”center”><b>Anoucement</b></td>
<td align=”center”><b>Posted By</b></td>
</tr>
<?php while($row=mysql_fetch_array($results))
{?>
<tr>
<?php if($username!=NULL){ ?><td><?php include(‘adminedit.php’); ?></td> <?php }?>
<td><?php echo date(“d/m/y”, $row{‘date’}); ?></td>
<td valign=”top”><?php echo $posted ?></td>
<td align=”center” valign=”middle”><?php echo $row{‘username’}; ?></td>
</tr>
<?php
}
?>
</table>
<?php } ?>
<?php include(‘footer.php’); ?>
[/code]

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@SpectreReturnsSep 21.2005 — Sweet jesus, that's inefficient use of <? ?> tags.
Copy linkTweet thisAlerts:
@R_NoonauthorSep 21.2005 — Sweet jesus, that's inefficient use of <? ?> tags.[/QUOTE]
Were you planning on giving me any ideas on how to fix the code?
×

Success!

Help @R_Noon spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.1,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,
)...