Note that there are some explanatory texts on larger screens.

plurals
  1. POsimple mysql select and insert not working
    primarykey
    data
    text
    <p>I have no idea why this isn't working. I've taken code from a previous project that works fine. I just want to select specific columns. Here's what im trying... </p> <pre><code> $result = mysql_query("SELECT when, where, name FROM tablename ORDER BY count DESC LIMIT 0, 20"); //I dont really know how to debug php well, so this is all I have to go by to know if its not working. if (!$result) { echo "&lt;p&gt;Page load has failed please try again&lt;/p&gt;"; } </code></pre> <p>if I select all like this it works fine:</p> <pre><code>$result = mysql_query("SELECT * FROM tablename ORDER BY count DESC LIMIT 0, 20"); </code></pre> <p>If im doing an insert, that doesn't work either...</p> <pre><code>$query = "INSERT INTO tablename (when, where, name) VALUES ('$when' , '$where' , '$name');"; mysql_query($query); </code></pre> <p>I'm sure the spelling is correct i've looked at it several times, and even if I put</p> <pre><code>echo $row["name"]; and the others ect while using the select all * they appear... </code></pre> <p>It just seems like its happening when im selecting individual columns.</p> <p>I have other tables, with other sites using the same exact code and its working fine.</p> <p>How can i fix this? or at least how can i debug the php to get some better error messages?</p> <p>edit: I'm sure the values going in are good, its just simple helloworld string I've tried including count in the select incase that needed to be there for the sort, but that didnt make it work.</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