Reputation: 20346
I have this query right here:
$query_1 = "select * from test.users where app_id='$app_id' and user_id='".$user_id."'";
$resource_1 = mysql_query($query_1);
$result_1 = mysql_fetch_object($resource_1);
var_dump($result_1);
For some weird, strange reason, the query above output the correct result in Firefox, but on IE and chrome it outputs false like the following:
<pre class='xdebug-var-dump' dir='ltr'><small>boolean</small> <font color='#75507b'>false</font>
Any idea what is causing this to happen? It doesn't make any sense to me at all.
Thanks for any help
Upvotes: 0
Views: 314
Reputation: 182
Your code has way to many flaws to be able to properly debug.
It probably works on Firefox because the page is cached, but it should not work in either browser.
Try the following:
<?php
$sql = "select * from test.users where app_id=:app_id and user_id=:user_id;";
$dbh = new PDO('mysql:dbname=yourDBname');
$sth = $dbh->prepare($sql);
$sth->bindValue(':app_id', $appId, PDO::PARAM_INT);
$sth->bindValue(':user_id', $userId, PDO::PARAM_INT);
$sth->execute();
Also, try looking into PHP PDO because it will help you avoid quite a few problems.
http://www.php.net/manual/en/book.pdo.php
Hope it helps, Denis
Upvotes: 1