How do I block user viewing out DB tables?
Moderator: General Moderators
-
simonmlewis
- DevNet Master
- Posts: 4435
- Joined: Wed Oct 08, 2008 3:39 pm
- Location: United Kingdom
- Contact:
Re: How do I block user viewing out DB tables?
No error codes, no nothing. The code literally stops.
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
All the best from the United Kingdom.
-
simonmlewis
- DevNet Master
- Posts: 4435
- Joined: Wed Oct 08, 2008 3:39 pm
- Location: United Kingdom
- Contact:
Re: How do I block user viewing out DB tables?
The problem is, that it's not running the query at all, as far as I can tell.
I'm wondering if it is simply not using:
It uses it if I use the mysql_ style of script.
I'm running both of these, the top one just to test as it works if I run it as test.php.
I'm wondering if it is simply not using:
Code: Select all
include "dbconn.php";I'm running both of these, the top one just to test as it works if I run it as test.php.
Code: Select all
$query = "SELECT email FROM admin WHERE type = 'admin'";
$result = $pdo->query($query);
while ($row = $result->fetch(PDO::FETCH_OBJ)) {
echo "$row->email<br/>";
}
$result = $db->query('SELECT id, catid, catname, uk_catname FROM products');
while ($row = $result->fetch(PDO::FETCH_OBJ)) {
$categ = "$row->catname";
$findcateg ="/ /";
$replacecateg ="-";
$categreplace = preg_replace ($findcateg, $replacecateg, $categ);
echo "<div class='submenu'><a href='/categ/$row->catid/$categreplace'>$row->catname</a></div>";
}Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
All the best from the United Kingdom.
Re: How do I block user viewing out DB tables?
Can you post the code in dbconn then?
-
simonmlewis
- DevNet Master
- Posts: 4435
- Joined: Wed Oct 08, 2008 3:39 pm
- Location: United Kingdom
- Contact:
Re: How do I block user viewing out DB tables?
Please see:
viewtopic.php?f=2&t=138317&p=687587#p687587
Since this is no longer about blocking users, but about using PDO, I felt it right to move this part to a more suitable thread.
viewtopic.php?f=2&t=138317&p=687587#p687587
Since this is no longer about blocking users, but about using PDO, I felt it right to move this part to a more suitable thread.
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
All the best from the United Kingdom.