Jump to content

SQL where = "text"

Recommended Posts

I want to use an sql query where the column has text I want to sort my rows I display for each. I need some help in getting the syntax correct. I might be going about it the wrong way as in a better way is probably there I just don't know that way.

    $Offensive = $this->db->prepare("SELECT * FROM `some table` WHERE SC_desc = 'some text'");

Link to comment
Share on other sites

You might need to be a little more clear but I think this is what you mean ?

$Offensive = $this->db->prepare("SELECT * FROM `some table` WHERE SC_desc = 'some text' ORDER BY column_name DESC");


Or change DESC to ASC to switch the order they are sorted.

Link to comment
Share on other sites

thanks guys. I was trying to get a string to = a string and was put in the right direction on discord. It was quite a head scratcher for me particularly when you're trying to learn this .... now to get a function together and understand the #each so I get this in the categories the way I wish to have them

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...