Jump to content

PatRoy

Members
  • Posts

    38
  • Joined

  • Last visited

Everything posted by PatRoy

  1. Say Barand, I've adopted your SQL way in other pages, which I find is great! Wondering though : any idea if MySQL would be able to output the days separated by an hyphen '-' for continuous numbers, and a comma for others ? i.e. +--------------+-----------+------+ | days | month | year | +--------------+-----------+------+ | 8, 10-12, 16 | August | 2020 | | 20, 27-30 | September | 2020 | | 1-2 | October | 2020 | +--------------+-----------+------+ Cheers! Pat
  2. Thank you folks!! I was thinking of Barand's solution and that's what I adopted. I was really tempted to use the SQL way also, but I also need all my dates separately (they are all in a hidden dates[] array for modification with a calendar. I'd have to use 2 sql statements if I wanted just the SQL solution. This is my code : <?php $dates = array ( '2005-05-21', '2020-09-29', '2006-11-02', '2020-09-28', '2020-09-30', '2020-10-01', '2006-11-01' ); sort($dates); // sort oldest to newest $my_dates = [ ]; // re-generate proper dates array [year][month] => array(days...) foreach ( $dates as $d ) { $date = new DateTime($d); $year = $date->format('Y'); $month = $date->format('F'); $day = $date->format('d'); if ( ! isset($my_dates[$year][$month]) ) { $my_dates[$year][$month] = array (); } array_push($my_dates[$year][$month], $day); } // pretty-print the dates foreach ( $my_dates as $year => $monthDays ) { $prettyDate = ''; foreach ( $monthDays as $month => $days ) { foreach ( $days as $day ) { $prettyDate .= "$day, "; } $prettyDate = substr($prettyDate, 0, -2) . ' '; // remove last ',' after days $prettyDate .= $locale->_($month) . " $year <br/>"; // print month and year, with translated month } echo $prettyDate; } ?> Outputs: 21 Mai 2005 01, 02 Novembre 2006 28, 29, 30 Septembre 2020 01 Octobre 2020 Thanks a bunch for your help and time! Pat
  3. Hi, I'm trying to achieve a special output of dates. I essentially have an array of dates like so: // dates in yyyy-mm-dd format $dates = array('2005-05-21', '2006-11-01', '2006-11-02', '2020-09-28', '2020-09-29', '2020-09-30', '2020-10-01'); I need to output theses dates like so: 05 may 2005 01, 02 november 2006 28, 29, 30 september 2020 01 october 2020 I'm really not sure how to go about this. I'm sure this must be possible. Any help would be great!! Thanks a bunch! Pat
  4. Outputs: string(5) "mysql" string(6) "5.5.28" My weird setup is due to the fact that my 'server' is a farely old NAS running a armv5tel architecture Linux. I had 'kinda' jailed broken the NAS as to get custom servers on it (lighttpd, mysql, etc). But the fact that it's jailbroken, and old, limits me on packages and versions I can install on it (thus the reason its running PHP 7.1). It's pretty much a nightmare to try and compile stuff on it because of missing / eventually broken libraries... I think I have no choice but to live with it and accept the returned strings from MySQL by adopting my workaround to do my validation on my property setters only, instead of within my save(). Thanks for your help and times
  5. UPDATE: Upon reading https://www.php.net/manual/en/mysqlnd.install.php, it seems the mysqlnd is enabled by a ./configure option on either mysqli, or pdo_mysql... Looking at the ./configure command options within phpinfo(), I see the following two: --with-mysqli=shared,mysqlnd --with-pdo-mysql=shared,/ffp Would that mean that mysqli has mysqlnd enabled (thus the reason I see it in phpMyAdmin since it uses mysqli), and my pdo_mysql doesn't have it enabled (assuming, since the lack of it in the configure above) ? HOWEVER, if I just do: var_dump(extension_loaded('mysqlnd')); it returns TRUE. So, super confused here... but then again, is it telling me true, just because it's 'loaded' only if using mysqli to query the database?
  6. I'm not sure I understand how to look / confirm I'm using the mysqlnd driver... Even less how to force use it.. I do have extension=pdo_mysql.so loaded in my php.ini, which I thought was loading the mysqlnd driver (guess not!?). And, when I load the web phpMyAdmin to managemy DBs, the homepage does give me some info on the server, one of them being: Database client version: libmysql - mysqlnd 5.0.12-dev - 2015040. See screenshot attachment... Is the mysqlnd loaded 'per web application' ?
  7. PDO PDO support => enabled PDO drivers => mysql pdo_mysql PDO Driver for MySQL => enabled Client API version => 5.5.28
  8. Thanks for your reply! Well, indeed, I do set my DB connection with PDO::ATTR_EMULATE_PREPARES => FALSE. Would that mean that MySQL automatically just return strings, but if allowing PHP/PDO to do the prepares, then IT only can properly prepare and return native datatypes? I had set it to false, in part to protect against SQL Injections, though I don't remember how this worked out for this... To answer others, I needed to resolve this because I am writing my own ORM system, which loads objects from database into an array of properties: array(11) { ["id"]=> array(8) { ["column"]=> string(2) "id" ["type"]=> string(7) "integer" ["readonly"]=> bool(true) ["required"]=> bool(false) ["value"]=> string(1) "1" ["valueIfNull"]=> NULL ["useDBDefaultWhenNull"]=> bool(false) ["datetimeformat"]=> NULL } ["dateModified"]=> array(8) { ["column"]=> string(13) "date_modified" ["type"]=> string(8) "datetime" ["readonly"]=> bool(false) ["required"]=> bool(false) ["value"]=> string(19) "2020-06-07 22:35:24" ["valueIfNull"]=> NULL ["useDBDefaultWhenNull"]=> bool(false) ["datetimeformat"]=> NULL } .... } As you can see, the "value" are always strings. I have a validDatatype() check that validates $value before submitting into the database. To do so, I simply run a check that gettype($value) is the same as my prop "type". Initially, I wanted to do all of the datatype validation within my save() method. However, if when loading all fields are strings, when I go ahead, mod some values, and then save(), it'll fail datatype validation! My current workaround is to do my validation on my property setters only, instead of within the save(), but I still wondered why I was getting all strings from MySQL.... Cheers for your replies! P.
  9. Hello, My current server setup : PHP version: 7.1.4 MySQL 5.5.28 Database client version: libmysql - mysqlnd 5.0.12-dev I'm using PDO _MYSQL to run database queries. From what I read, in order to have MySQL return native datatypes (as opposed to just strings) : if using MySQLi: set $mysqli->options(MYSQLI_OPT_INT_AND_FLOAT_NATIVE, 1) if using PDO and have mysqlnd: "mysqlnd returns native data types when using Server-side Prepared Statements, for example an INT column is returned as an integer variable not as a string." Now, I do have mysqlnd, but a simple PDO Prepared statement still returns me all strings, even though some columns are set as INT, VARCHAR, DATETIME, etc.. $stmt = $pdo->prepare("SELECT * FROM tbl_users WHERE id=1"); $stmt->execute(); $user = $stmt->fetch(); var_dump($user); OUTPUT: array(13) { ["id"]=> string(1) "1" ["is_admin"]=> string(1) "1" ["is_active"]=> string(1) "1" ["username"]=> string(5) "jdoe" ... } I'm not sure what to look for to resolve this issue if I want it to return INT as INT and not STRING, etc. Does having `extension_loaded('mysqlnd') == true`, make my system automatically use this native mysql driver? How can I tell ? Could this be a version problem perhaps? Much thanks! Pat
  10. The idea is to stop the script whenever an error (or exception) occurs. My handler essentially logs the error with a uniqid() to a log file, sends an email to admins with the full error message + ID, and finally, outputs an html page with a generic message "Oh crap! Something went wrong! Contact admins with ID: <error id>" So, from my understanding, I'd need 2 Error Handler classes: one for errors, and one for exceptions.... OR, I guess I could have in my ErrorHandler class 2 functions : /** * Handle Errors: set from set_error_handler() */ public function handleError($errno, $errstr, $errfile, $errline) { ... $this->sendToEmail(); // send email to admins $this->saveToLog(); // save to log file $this->loadErrorPage(); // print error page and exit()! } /** * Handle Exceptions: set from set_exception_handler() */ public function handleException($ex) { ... $this->sendToEmail(); // send email to admins $this->saveToLog(); // save to log file $this->loadErrorPage(); // print error page and exit()! } Would this be a proper way of doing this then ? I do not like having to trigger_error() in my try/catch... For one thing, I think the script should catch any such mistakes, and for another, with trigger_error(), I do not have access to the Exception object (to stacktrace it, etc.). Thanks for your inputs! Pat
  11. I'm sure it's not much, but I'm not understanding something with custom error handlers: I've created a custom error handler, which I initially set when my page loads : set_error_handler(array ( new ErrorHandler(), 'handleError' )); It seems to catch all internal PHP errors, such as if I: var_dump($non_existing_var); right after the set_error_handler.... Now, I have an object that throws an exception after: set_error_handler(array ( new ErrorHandler(), 'handleError' )); $locale = new \CorbeauPerdu\i18n\Locale(...); // this should throw an exception ... I thought that with an error handler set, I could 'skip' the try/catch for it, but doing so, PHP spits out in its internal log: PHP Fatal error: Uncaught CorbeauPerdu\i18n\LocaleException: .... My error handler doesn't catch it at all before, thus my page breaks!! If I want it to go through the error handler, I have to init my Locale with a try/catch and use trigger_error() like so: set_error_handler(array ( new ErrorHandler(), 'handleError' )); try { $locale = new \CorbeauPerdu\i18n\Locale(...); // this should throw an exception } catch(Exception $e) { trigger_error($e->getMessage(), E_USER_ERROR); } ... Is this normal ? I thought one of the goals of the error_handler was to catch anything that wasn't dealt with? Thanks for your answers!
  12. It is still one line more than me, if you consider the fact that I do it the same way with my DBWrapper 😛 But really, this discussion is non-sense and pointless to me, especially if one doesn't even look at the usage examples / documentation and doesn't care to see how it can really help down the line. Again, you take, or not... Whatever suits you, no bad feelings héhé. Cheers. P.
  13. I think you write a bit more than that... Your two-liner code should really be: try { $mydb = new PDO($dsn, $username, $password, $options); $data = $mydb->prepare("SELECT * FROM users WHERE ID = :id"); $data->execute(['id'=>$userid]); } catch (Exception $e) { die($e->getMessage()); } Plus, I was under the impression that it's still better to also bindValue / bindParam, to also set its proper datatype, protecting against SQL Injections, which you are not using... With your way, I have to re-enter all of the DB configs everytime, which is the least of the problems for me, but still... My example was for a very basic usage. But what if you want to say do multi-inserts, AND commit on every inserts so that if one insert fails, the others still go through, and you can get a list of failed ones? I've had this case! And this class can handle this, without writing too much code. I am not going to debate 'why' I think my class is useful here... Before saying anything, have a look at its UsageExamples.php and decide for yourself. If you don't think it to be useful, then by all means, don't use it I'm not trying to sell it here , but rather just share.
  14. Here's an example of a simple utilization of my DBWrapper: try { $mydb = new DBWrapper(); // get the data and do what you want with it... $data = $mydb->readData('SELECT * FROM users where ID = :id', $userid); ... } catch (DBWrapperException $ex) { die($ex->getMessage()); } The DBWrapper / readData() will take care of creating the PDO object, if it's not already created. It will take care of creating a proper PDOStatement inside it, use bindParam and protect against SQL injections, etc. etc. You can pass the parameter value as simple value to read and storeData() (doing so, DbWrapper will determine itself datatypes to map data to in DB), but you can also pass it an array mapping parameter value => datatype.... I'm not gonna write all of its functionality's here, but you can guys get the idea, I think. Cheers. Pat
  15. By "rewrite", I don't mean rewriting PDO lolll ! I mean I don't like having to always do my new PDO(...) And then do my prepared statements etc... I wanted to shorten my code ! Really, just have a look at the UsageExamples.php. it says it all way better than what I could explain It's... As I said: a wrapper around PDO.
  16. Alright, never mind the wetransfer BS. I've setup a Github repository: https://github.com/ravenlost/CorbeauPerdu/tree/master/i18n/ While I was at it, I've also uploaded and shared my pretty sweet (I think!) DBWrapper as well: https://github.com/ravenlost/CorbeauPerdu/tree/master/Database/ I worked a long time on this DBWrapper as well, just because it annoyed me to re-write PDO code everytime... Check out both of these classe's UsageExamples.php. It shows it all
  17. Hello, Requinix! First thanks for your reply and piece of code example! Things have been a little chaotic around here (where is it not? ;)) and I've been a little offline. I hear what you are saying about not having to 'code it all' right away, stick to whats really needed for needs. Totally ! If this project was a paid one, for a company, then yeah I'd do it like you say, cause you do have deadlines to respect, etc. However, this is just a personal project of mine, and since I've got no work for now (and no life ), it becomes a personal challenge, and a great learning tool! I've never programmed in PHP before. Used to code a lot in Java, VB (yeah' I'm that old ), Perl, etc.. and worked quite a bit as a *Nix administrator, but I've quit all of that with a career change. I haven't really coded in nearly 12 years or so... Thus, need to re-learn a lot That being said, this hole issue initially started because I couldn't get gettext() to work on my server (because it's old NAS), and I really want to use this solution if I ever push my site to 'production' on a hosting provider. So, I decided to create a 'wrapper' class around gettext that would have a boolean set in its constructor to $useGettext true, or false. If true, well all of its functions uses gettext to get the messages. If false, then it uses JSON files... I'm pretty happy now about it. It is super flexible thus will allow using translations on all kinds of hosts! If using JSON files, if also deals with plurals, just as Gettext does with a 'nplurals' and 'plural' value set, same syntax as gettext. and It's even able to handle loading additional domains (a.k.a translation files). Finally, I've made it so that all of its functions to translate messages are the same names as the gettext's functions, like so: * Locale::gettext() or Locale::_() // Lookup a message in the current domain, singular form * Locale::fgettext() or Locale::_f() // Lookup a message in the current domain, singular form, and sprintf's the message with $v value(s) * Locale::ngettext() or Locale::_n() // Lookup a message in the current domain, plurial form * Locale::fngettext or Locale::_fn() // Lookup a message in the current domain, plurial form, and sprintf's the message with $v value(s) * Locale::dgettext() or Locale::_d() // Lookup a message in a given domain, singular form * Locale::fdgettext or Locale::_fd() // Lookup a message in a given domain, singular form, and sprintf's the message with $v value(s) * Locale::dngettext() or Locale::_dn() // Lookup a message in a given domain, plurial form * Locale::fdngettext or Locale::_fdn() // Lookup a message in a given domain, plurial form, and sprintf's the message with $v value(s) Do note that I know 'Locale' is already a used class name within PHP, but mine is in its own namespace: CorbeauPerdu\i18n\Locale I'd love to know if anyone thinks this could be a real problem, and if so, I can just rename it Anyhow, I'm writing all of this because I'm a strong believer in sharing, and wanted to share this class along.. (perhaps even create a project in Github or something). I'll repost link here if I do... I'd love to share you the LocaleUsageExamples.php and the class itself, but can't attach any PHP in this forum. If you or anyone else is interested or curious, here's a temporary wetransfer link: https://wetransfer.com/downloads/eb670a961970210705a2824df897e43b20200416125315/ebbcf9d142a3eaa576eca92dc1638c7220200416125329/885d76 Thanks again for the time you've taken and your inputs! Pat
  18. For now, I just need the messages changed. However, I never know down the road. PLUS I'm trying to create a versatile package which I can re-use in many projects.. Thus also one of the reasons my class can use either one, Gettext or JSON files... And on top, I want to do '"things right" the first time
  19. Hello, I'm writing a script that will handle localisation of my site for multi-languages. It will utilize either gettext() or, if not available, JSON files for translations ... I have a few questions which I'm not sure about: 1. For now, I'm only calling the putenv() and setlocale() functions inside my _initLocaleGettext(). Should I also call these even if I'm using JSON files (if gettext not installed/configured in php.ini), say in my _initLocaleJSON()? 2. When calling the lather functions: // Bare in mind that self::$_lang holds the desired language, like: 'en_US', 'fr_FR' or 'nl_NL'. putenv('LANG=' . self::$_lang); setlocale(LC_ALL, self::$_lang); Should I specify the codeset as well in the putenv() AND/OR setlocale() functions (i.e. en_US.utf8 or en_US.iso88591) ? I've noticed that some servers don't necessarily have just 'en_US'. My box for instance had just 'en_US.utf8' in the output of: locale -a 3. Gettext will only work if I'm using a locale that's installed on the server (locale -a). Would this be a proper way of checking my desired locale is installed? if ( setlocale(LC_ALL, self::$_lang) === false ) throw new Exception("Locale '" . self::$_lang . "' is not installed on the server!"); The following is what I had before, but REALLY don't think it's the appropriate way, because a) it's an OS dependent program, and b) calls for an execution of a program on the system every time a page loads.. $available_system_locales = explode(PHP_EOL, shell_exec('locale -a')); $working_locale = self::$_lang . '.' . strtolower(str_replace('-', '', self::$_codeset)); if ( ! in_array($working_locale, $available_system_locales) ) throw new Exception("Locale '$working_locale' is not installed on the server!"); 4. This question could be another topic, but while I'm at it: My JSON files (one file per 'domain') will be like the following 2 examples: Example JSON French file: { "": { "domain": "prestadesk", "language": "fr_FR", "plural-forms": "nplurals=2; plural=(n > 1);" }, "Welcome, %s!": "Bienvenu, %s!", "This page will show the dashboard": "Cette page affichera le tableau de bord", "Only one unread message": "Vous avez qu'un seul message", "%d unread messages": [ "Vous avez %d messages" ] } Example JSON Serbe file: { "": { "domain": "prestadesk", "language": "sr_CS", "Plural-Forms": "nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);" }, "Welcome, %s!": "Dobrodosli, %s!", "This page will show the dashboard": "Ova stranica ce prikazati kontrolnu tablu", "I wrote a line of code": "Napisao sam liniju koda", "I wrote %d lines of code": [ "Napisao sam %d liniju koda", "Napisao sam %d linije koda", "Napisao sam %d linija koda" ] } My 'gettext* like' functions have the same arguments has the original gettext(). For now, all I'm doing in order to find out if I use the singular or plural version of translation is checking if ($n > 1). You see I'm keeping gettext's standard plural-forms which are widely available. I would like to eventually parse these "plural-forms" / "plural" values to run each of the test cases, and match the succeeded one with the right plural array element. Is this crazy thinking? Can this be done fairly easily? I've yet to study the plural forms possibilities from http://docs.translatehouse.org/projects/localization-guide/en/latest/l10n/pluralforms.html. Not sure yet why has some () in them, some don't... when there's multiple, then I think each test case ends with a '? X' indicating (I think?) the array element id to use for that test case... and (I think?) the last test case when multiple has 'no test case', just tells to use the last array ID for any other plural message... I'll stop writting now. loll Thanks a million for your help and input! Pat
  20. It's a fairly old NAS... (DLink DNS325). I've installed Fonz Fun_plug (ffp) 0.7 on it a while back now: https://nas-tweaks.net/398/installing-and-uninstalling-packages-in-fonz-fun_plug-0-7/ uname reads: Linux datahub 2.6.31.8 #8 Tue Jun 26 11:38:41 CST 2012 armv5tel GNU/Linux I do have a package manager from the FFP installation named 'slacker' or 'funpkg'... but can't see anything in there in regards of locale* ... In short, ffp installs to /ffp. Apps, base system of it simply chroots into /ffp/... I do have 'locale' and 'localedef' on the main NAS OS in /usr/sbin/locale*, but no charmaps, to create the locales with that localedef. Tried copying the files from my ArchLinux install /usr/share/i18n/* and symlink them on my NAS in /usr/share/i18n/: ln -s /ffp/usr/share/i18n/ /usr/share then force a creation of the locale fr_FR: localedef -v -c -i fr_FR -f UTF-8 fr_FR.UTF-8 but for one thing, I'm getting a bunch of warnings such as: and finally, at the end get a : Info on this locale-archive: root@datahub:~# ll /usr/lib/locale/locale-archive lrwxrwxrwx 1 root root 44 Mar 28 23:18 /usr/lib/locale/locale-archive -> /usr/local/modules/web/config/locale-archive root@datahub:~# mount | grep /usr/local/modules /usr/local/tmp/image.cfs on /usr/local/modules type squashfs (rw,loop=/dev/loop0) Even though it says 'rw' in my mount options, I can't write to that FS... That's pretty much all the info I've got and tried p.s.: if I cant do anything with gettext, any way I could temporarily use something like XMLs, JSONs etc? I was thinking of writing a Locale class that would accept a boolean say "useGettext" in the constructor... If it's set, then simply return gettext's value when calling Locale::myGettext("Some string"); if it's NOT set, then my Locale::myGettext would fetch data in an XML /JSON or what ever else approach... All my code in my pages would use something like: Locale::myGettext("Some string"); Locale::mynGettext("You have one mail", "You have %d" mails", $totalMail); Is this approach stupid ? I would prefer just using gettext()... Thanks again for your help
  21. Found the solution by putting website on another server : turns out I need to install my desired website locales (fr_FR, nl_NL) on my server with locale-gen. Works on an ArchLinux box, but tool doesn't exist on my real server (a NAS). I have a 'localedef' on my NAS to help generate locales, but my NAS is missing all requirements for this it seems under /usr/share/i18n/ ... I'm lost here... Any advice on an alternative to gettext ?
  22. Hello again, So, after messing around with gettext, and having found the solution to my previous post (https://forums.phpfreaks.com/topic/310383-gettext-for-multilangual-not-working-for-me/), I've come to the conclusion that I need to use something else than gettext in order to make my site multilingual. Problem I have with gettext is that I absolutely need to have my desired languages (i.e. fr_FR, nl_NL, etc) installed on my server's system (in my case, a NAS for now). I can see which locales I have on my server with 'locale -a'. I am in no way able to install new locales on my NAS. It's too limited... too much locked down. So, I'm looking for an alternative to gettext. Any suggestions for me perhaps ? Thanks for any advice. Pat
  23. Hello folks, So, trying to create a multilingual website using gettext. Now, just the simplest examples doesn't seem to work for me. I've loaded gettext.so in my php.ini (see http://corbeauperdu.ddns.net/phpinfo.php) and created a PO / MO pair with POEdit. My MO/PO file reads: msgid "" msgstr "" "Project-Id-Version: Prestadesk\n" "POT-Creation-Date: 2020-03-26 21:08+0100\n" "PO-Revision-Date: 2020-03-27 07:59+0100\n" "Language-Team: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "X-Generator: Poedit 2.3\n" "X-Poedit-Basepath: ../../../..\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" "X-Poedit-SourceCharset: UTF-8\n" "Last-Translator: \n" "Language: fr\n" "X-Poedit-SearchPath-0: .\n" #: templates/prestadesk_dashboard.php:41 #, php-format msgid "Welcome, %s!" msgstr "Bienvenu, %s!" #: templates/prestadesk_dashboard.php:42 msgid "This page will show the dashboard" msgstr "Cette page affichera le tableau de bord" It's located under <DOC_ROOT>/prestadesk/include/locales/fr/LC_MESSAGES/prestadesk.po And I've got this very simple php test page under <DOC_ROOT>/prestadesk/templates/prestadesk_dashboard.php <?php $lang='fr'; $domain = 'prestadesk'; $codeset = 'UTF-8'; $locales_dir = '../include/locales'; // need to go up on directory from here to get into the include/locales // here we define the global system locale given the found language putenv('LANG='.$lang); // this might be useful for date functions (LC_TIME) or money formatting (LC_MONETARY), for instance setlocale(LC_ALL, $lang); // this will make Gettext look for $locales_dir/<lang>/LC_MESSAGES/prestadesk.mo bindtextdomain($domain, $locales_dir); // indicates in what encoding the file should be read bind_textdomain_codeset($domain, $codeset); // here we indicate the default domain the gettext() calls will respond to textdomain($domain); // test translate echo gettext("This page will show the dashboard"); ?> Nothing happens. No translation, no errors... I just see the message in English Any ideas for me ? Thanks a bunch!
  24. 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
  25. 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
×
×
  • 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.