Note that there are some explanatory texts on larger screens.

plurals
  1. POMysql not returning result as expected
    primarykey
    data
    text
    <p>Can anyone see what is wrong with this sql query.</p> <p>This returns no results, although the same query out put so that vars are calculated and then run in mysql returns 3800+ results</p> <pre><code>$query = "SELECT * FROM twitter_user JOIN twitter_connection ON (twitter_user.tu_id = twitter_connection.tc_tu_id) WHERE tc_followyou = 1 AND tc_twitterapp_user_id = ". $mytwitterid . " LIMIT " . $perpage . " OFFSET " . $twitter_offset; </code></pre> <p>This same query however does work</p> <pre><code>$query = "SELECT * FROM twitter_user JOIN twitter_connection ON (twitter_user.tu_id = twitter_connection.tc_tu_id) WHERE tc_youfollow = 1 AND tc_twitterapp_user_id = ". $mytwitterid . " LIMIT " . $perpage . " OFFSET " . $twitter_offset; </code></pre> <p>The only difference is the use of tc_followyou vs tc_youfollow</p> <p>Both are in the same table, no NULL records, and integer.</p> <p>If I take the exact same piece of php code adn swap tc_followyou for tc_youfollow I get a result.</p> <p>I am not sure why, but this is only a problem if the script is run on an amazon RDS server Mysql v5.5.8-log, another server running mysql 5.1.52</p> <p>works as expected.</p> <p>Why would either the server version or the field name cause this issue?</p> <p>I'm stumped.</p> <p>Thanks Stephen</p> <p><strong>UPDATE :</strong> This is resolved. The issue was that the actual code I was running did not have a limit. I was carelessly running against the database to get a 'total'. This because the failing table had so many records, it did not return a result. I accepted the solution because the person helped me work through a thought process that helped discover the problem.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload