Jump to content
MakeWebGames

Recommended Posts

Posted

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'");

Posted

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.

Posted
1 hour ago, Magictallguy said:

SELECT * FROM some_table WHERE text_column IS NOT NULL ORDER BY some_column


SELECT * FROM some_table WHERE text_column IS NOT NULL ORDER BY some_column

 

Wimner!!-

Unless he wants empty text results 🙂

Posted

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

Join the conversation

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

Guest
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...