You are here: Feedback? « PHP Programming Language « IT news, forums, messages
Feedback?

Posted by Kye on 10/19/07 11:28

As a real pleb with the below being my first actual "real" script written
from scratch, could anybody please constructively criticise what should be
changed???

Thanks again for everybody's help

--
Yours Sincerely
Kye

---START CODE---

<?php
$category = "SELECT * FROM `links_categories` ORDER BY category ASC LIMIT
0 , 30" or die('Error, query failed');
$catlist = mysql_query($category) or die('Error, query failed');
echo "<form method=\"post\" action=\"{$_SERVER['PHP_SELF']}\">";
echo '<SELECT name="dropdown">';
echo "<OPTION value=3> - Please Select A Category - </OPTION>\n";
while ($row = mysql_fetch_array($catlist, MYSQL_NUM)){
echo "<OPTION value=$row[0]>{$row[1]}</OPTION>\n";
}
echo '</SELECT>';
echo "<INPUT type='submit' value='Go'>";
echo "</form>";
?> </td>
</tr>
<tr>
<td><br></td>
</tr>
<tr>
<td class="pageHeading">
<? if ( isset($_POST[dropdown]) ) {
$heading = mysql_query("SELECT links_categories.category,
links_categories.cat_id FROM links_categories WHERE $_POST[dropdown] =
links_categories.cat_id") or die('Error, Heading select failed');
while ($row = mysql_fetch_array($heading, MYSQL_NUM))
{
$head = $row[0];
$catshow = $row[1];
}
} else {
$head = "Markets, Fairs, Fetes and Field Days";
$catshow = "3";
}
echo $head; ?></td>
</tr>
</table></td>
</tr>
<tr>
<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10');
?></td>
</tr>
<tr>
<td><?php
$query = "SELECT links.rating, links.name, links.url, links.description,
links.date_added, links.display, links.fk_category,
links_categories.category, links.link_id FROM links, links_categories where
links.fk_category = links_categories.cat_id AND $catshow =
links_categories.cat_id ORDER BY name ASC" or die('Error, query failed');
$result = mysql_query($query) or die('Error, query failed');

while ($row = mysql_fetch_array($result, MYSQL_NUM)){
if ($row[5] = 1) {
echo "<table width=95%>
<tr width=100%>
<td width=100%>
<table width=100%>
<tr width=100%>
<td width=80%><A href=$row[2] target=_blank><p
align=left>$row[1]</p></a></td>
<td width=20% align=right>";
switch ($row[0]){
case "1":
echo '<img src="images/stars_1.gif">';
break;
case "2":
echo '<img src="images/stars_2.gif">';
break;
case "3":
echo '<img src="images/stars_3.gif">';
break;
case "4":
echo '<img src="images/stars_4.gif">';
break;
case "5":
echo '<img src="images/stars_5.gif">';
break;
default:
echo "Unrated";
break;
}
echo "</td>
</tr>
</table>
</td>
</tr>
<tr valign=top width=100%>
<td width=100%>
<table width=100%>
<tr valign=top width=100%>
<td valign=top align=justify>";
// <span id='c$row[8]' class='short'><a href='javascript:swap(1,
true)'><img alt='more' src='images/plus.png' border='0' width='12'
height='12'>Click for Description</a></span><span id='e$row[8]'
class='long'><a href='javascript:swap(1,false)'><img src='images/minus.png'
border='0' width='12' height='12'></a>
echo "$row[3]</td>
</tr>
</table>
</td>
</tr>
<tr width=100%>
<td align=right><font size=-2>Added to Database :";
list($year,$month,$day)=split("-",$row[4]);
$display_date=date(" F d, Y",mktime(0,0,0,$month,$day,$year));
echo $display_date;
echo "</font></td>
</tr>
</table><br><br><hr width=60% align=center>";
}
}?>

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация