
Query from 2 database tables PHP
I am allowing users to post classified ads and would like to give the specific user a way to update or delete there post.
For example of what I want is this. I create a page called update that I want the user to have control over there post.
My problem is I cannot show only that users post in the update page without showing everyone's classified adds.
Here is what the tables look like:
Classifieds Table:

Users table:

Here is my current query that doesn't work and I could use help fixing.
PHP Code:
<?php
$id = (int)$_GET['id'];
$classifieds = DB::getInstance()->query("SELECT `id`, `dates`, `username`, `title`, `description` FROM classifieds JOIN users ON classifieds.id = users.id WHERE id=$id");
foreach($classifieds->results() as $c){ ?>
<div data-id="id-<?php echo escape ($c->id); ?>">
<article class="postwhite mb-25">
<div class="notices-title"><?php echo escape($c->title); ?></div>
<div class="newsdate" style="margin: 10px 0 !important;"><?php echo escape (date("M. d, Y", strtotime ($c->dates))); ?> - Posted by: <?php echo escape($c->username); ?></div>
<div class="articletext"><style>.articletext img{width:100%; height:auto;}</style><?php echo ($c->description);?></div>
</article>
</div>
<?php
}
?>
-
ClicProject -
Thanks
{{ DiscussionBoard.errors[9144811].message }} -
-
cwd -
Thanks - 1 reply
{{ DiscussionBoard.errors[9144898].message }}-
Artur Golisz -
Thanks - 1 reply
SignatureNeed help with programming (WordPress, PHP, jQuery and more) ? Just send me PM.{{ DiscussionBoard.errors[9144998].message }}-
cwd -
Thanks - 1 reply
{{ DiscussionBoard.errors[9145056].message }}-
Artur Golisz -
Thanks
SignatureNeed help with programming (WordPress, PHP, jQuery and more) ? Just send me PM.{{ DiscussionBoard.errors[9145293].message }} -
-
-
-
-
cwd -
Thanks
{{ DiscussionBoard.errors[9144980].message }} -