Jump to content

Change SQL Selects based on if on desktop or phone/tablet ?


Recommended Posts

Hello folks, 

So, not sure where to start, but I'm wondering if it's at all possible to change a prepared statement / sql based on whether or not we're displaying for desktops, or for smartphone/tablets? I'm not sure what to start looking at since I'm pretty new in PHP and all... 

I've managed to figure out how to change CSS if I'm on phone 

@media only screen and (max-width: 767.98px){
  // PUT CSS FOR PHONES...
}

Any directions on how I would change my SQL, would be awesome! I'd like to narrow down the columns returned if I'm on phone, otherwise breaks my pages looks too much...

Much thanks in advance!

Pat

 

From what you're describing it sounds like the problem is the way those columns are displayed. Right?

Which would make it a job for CSS. Right?

Depending on your CSS framework, you can show and hide things depending on screen sizes...

Arghh stupid me ! Of course... you made me realise all I have to do is assign a css class say "hideme" to my columns TD/TH's I want hidden on phones, and have my stylesheet do something like:

 

@media only screen and (max-width: 767.98px){
  .hideme{
    display: none;
  }
}

Something like that should do it. Thanks for your help again :)

Pat

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.   Restore formatting

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

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.