|
PCCS MySQLDatabase Admin Tool version 1.3.4
|
/ -> shownews.php
1 <?
2
3
4 // function displayNewsStories($article) 5 // { 6 // global $dbhandle,$bgcolor,$bgtext,$tcolor,$ttext,$fcolor,$ftext,$link; 7
8
9 $host ="localhost";
10 $login = "root";
11 $password = "simple";
12 $db = "webtesting";
13
14
15 $SQLText = "SELECT news_id, news_story_date, news_story_title,
16 news_story_active, news_story_test,
17 news_story_author, news_story_html
18 FROM news
19 WHERE news_id = '$article'";
20
21
22 if (!mysql_connect($host,$login,$password)) {
23 print "No connection made\n";
24 exit();
25 }
26 mysql_select_db( $db ) or die ( "Errorng the database\n" );
27 // $result = mysql($db, $SQLText);
28
29
30 $news_query = mysql_query($SQLText) or die ( "Error running query\n" );
31 $num_rows = mysql_num_rows($news_query);
32
33 // if ($error != 1){
34 for ($i=0; $i < $num_rows; $i++){
35 $row = mysql_fetch_array($news_query);
36 $datetime = $row["news_story_date"];
37 $year = strtok($datetime, "- :");
38 $month = strtok("- :");
39 $day = strtok("- :");
40 $hour = strtok("- :");
41 $minute = strtok("- :");
42 $second = strtok("- :");
43 $timestamp = mktime((int)$hour, (int)$minute, (int)$second, (int)$month, (int)$day, (int)$year);
44 ?>
45
46 <table border="0" cellpadding="0" cellspacing="0" width="<?echo $tbl_width;?>">
47 <tr bgcolor=#<?echo $bgcolor;?>>
48 <td width="<?echo $tbl_width;?>" height="20" align="LEFT" valign="TOP">
49 <font face="arial,helvetica" size="2" >
50 <b> <? echo $row["news_story_title"] ?> </font></b>
51 <b><i> Posted by <? echo $row["news_story_author"] ?></i></b>
52 </td>
53 <td>
54 <font face="arial,helvetica" size="-1" >
55
56 <b><i><? echo date("m.d.Y H:i", $timestamp) ?></i></b><br>
57 </font>
58 </td>
59 </tr>
60 </table>
61 <table border="0" cellpadding="7" cellspacing="0" width="<?echo $tbl_width;?>">
62 <tr>
63 <td background="http://www.pccs-linux.com/spacer.gif">
64 <font face="arial,helvetica" size="2" >
65 <? echo $row["news_story_html"] ?>
66 <p>
67 </td>
68 </font></tr>
69 </table>
70 <?
71 }
72 // } 73 ?>
74
75 <?
76 // } // End of displayNewsStories 77 // displayNewsStories($article); 78
79
80 ?>
| |