-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTableInfo.php
57 lines (50 loc) · 1.63 KB
/
TableInfo.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<?php
/**
*Tableinfo.php prints all data from database
*@Author Andrey Andreev
**/
require_once "connection.php";
function printTable($word)
{
$db=$GLOBALS['dbc'];
$db->real_escape_string($word);
$que="Select distinct * from course_data natural join coursedetails
WHERE title LIKE '%$word%' OR short_desc LIKE '%$word%'
GROUP BY title LIMIT 10";
$result=$db->query($que) or die(mysqli_error($db));
$finfo = $result->fetch_fields();
echo "<div>";
echo "<table border=1 width=\"100%\" style=\"background-color:00FF66\">";
echo "<tr>";
$success = false;
while($row = mysqli_fetch_array($result))
{
$courseImage=$row['course_image'];
$title=$row['title'];
$categ=$row['category'];
$startTime=$row['start_date'];
if ($startTime === '0000-00-00') $startTime = 'n/a';
$duration=$row['course_length'];
if (!$duration) $duration = 'n/a';
$teacher=$row['profname'];
$teacherImage=$row['profimage'];
$courseLink=$row['course_link'];
$site=$row['site'];
$link = 'TrendingCourses.php?url='.urlencode($courseLink);
echo "<tr>
<td width=\"5%\"><img src=\"$courseImage\" width=\"200px\" height=\"100px\"></td>
<td width=\"5%\"><a href=\"$link\" id='sitelink'>$title</a></td>
<td width=\"5%\">$categ</td>
<td width=\"5%\">$startTime</td>
<td width=\"5%\">$duration</td>
<td width=\"5%\">$teacher</td>
<td width=\"5%\"><img src=\"$teacherImage\" width=\"100px\" height=\"100px\"></td>
<td width=\"5%\">$site</td>
</tr>";
$success = true;
}
echo "</tr>";
echo "</table>";
return $success;
}
?>