-
Notifications
You must be signed in to change notification settings - Fork 0
/
template-my-cases.php
88 lines (66 loc) · 2.7 KB
/
template-my-cases.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
<?php
/**
* @package WordPress
* Template Name: My Assigned Plagiarism Cases
*/
?>
<?php get_header(); ?>
<?php while (have_posts()) : the_post(); ?>
<?php if($post->post_content=="") : ?>
<?php else : ?>
<div id="wrapper">
<div class="container pt">
<div class="row">
<div class="col-sm-12">
<header>
<h3><?php the_title(); ?></h3>
</header>
<?php the_content(); ?>
<?php
// ...Call the database connection settings
//print('before require');
include( '../../../wp-config.php' );
//print('after require');
// ...Connect to WP database
$dbc = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD);
if ( !$dbc ) {
die( 'Not Connected: ' . mysql_error());
}
// Select the database
$db = mysql_select_db(DB_NAME);
if (!$db) {
echo "There is no database: " . $db;
}
//print('before the query<br>');
//$curr_user = wp_get_current_user();
//print($curr_user);
$query = "SELECT wpmlp_posts.post_date, wpmlp_posts.ID, wpmlp_posts.post_type, wpmlp_postmeta.meta_key, wpmlp_postmeta.meta_value
FROM wpmlp_postmeta
INNER JOIN wpmlp_posts ON
wpmlp_postmeta.post_id = wpmlp_posts.ID
AND wpmlp_posts.ID in (SELECT wpmlp_posts.ID
FROM wpmlp_postmeta
INNER JOIN wpmlp_posts ON
wpmlp_postmeta.post_id = wpmlp_posts.ID
AND wpmlp_posts.post_type = 'plagiarism'
AND wpmlp_postmeta.meta_key = 'owner'
AND wpmlp_postmeta.meta_value = 'rscheffers')";
$result = mysql_query($query);
//echo "<table>"; // start a table tag in the HTML
while($data = mysql_fetch_array($result)){ //Loop through array results
print('<p>row<br>');
print_r($data);
print('</p>');
//echo "<tr><td>" . $data['name'] . "</td><td>" . $data['age'] . "</td></tr>"; //$row['index'] the index here is a field name
}
//echo "</table>"; //Close the table in HTML
mysql_close(); //Make sure to close out the database connection
?>
</div><!-- /col-sm-12 -->
</div><!-- /row -->
</div> <!-- /container -->
</div><!-- /ww -->
<?php endif; ?>
<?php wp_reset_postdata(); ?>
<?php endwhile; ?>
<?php get_footer(); ?>