Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 10 of 10
  1. #1
    New to the CF scene
    Join Date
    Apr 2017
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Hey, some help for a newbie

    Hello guys, my name is Efraim and I am happy joining​ your forum.
    My background is learning some c# in school and now a 2/3 months of HTML, CSS and JavaScript learned by myself for a project in close system that needed me.
    So, as I am looking forward keep learning the next step as I get it is PHP and MySQL of course.
    So please let me use this thread for some supposedly obvious questions and keep in mind that I want to learn everything as professional as possible.
    1. I want to clarify something about the method of server side language- I think I get most of the idea of the process but one thing I want to ask- is the fact that the server is going to work for every user uses his services and create dynamically pages for him, and the database is going to be asked so so many times means that we need super strong server when the audience is big?

    2. I have succeeded installing PHP parser and MySQL​ in my system ( I have to admit it was complicate): what should be my next step- I mean, I know the basics of MySQL and PHP- of course no experience in sessions and cookies and requests for data base- but I have read all the basic stuff- so I could train myself with mini projects and so on but WHAT I want to know is how to manage my learning? What to aim for?
    What should or could be my target now in coding except the fact it's entertaining?
    Being part of fiverr for example could be a target but I am not sure how to be professional enough (even in HTML and CSS and JavaScript ) to be part of it


    That will be enough for now

  2. #2
    Supreme Master coder!
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    10,127
    Thanks
    10
    Thanked 1,162 Times in 1,153 Posts
    Start with PDO.

    https://phpdelusions.net/pdo

    That's a good place to start, and something you must learn.

  3. #3
    New to the CF scene
    Join Date
    Apr 2017
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I started reading it, understanding only some of it, maybe it's one step too far for now? Reading this alone will teach me treat forms on PHP?
    And I've more question- what I didn't understand is what is the big positive for security in prepared statement? And why calling for database only once is so good too? At the bottom line the number of queries won't change, no?
    Please detail your answers

  4. #4
    Supreme Master coder!
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    10,127
    Thanks
    10
    Thanked 1,162 Times in 1,153 Posts
    Most shared webhosts used MySQL as the databases for their users. MySQL is now obsolete, so they use MySQLi (i=improved). PDO is an interface for accessing databases, which could be MySQLi or any database. So I think whether you're using PHP, Perl, or whatever server-side scripting language, they provide a driver that utilizes PDO. Now, the databases can change and the interface remains the same. It becomes a consistent way to access databases.

    Learning to do Queries for MySQLi can be daunting. It can do amazing things and a lot of what you're selecting or searching for can be done with one query. It takes way less processing time to do one query than several.

    There are thousands of tutorials for MySQL. Now with MySQLi, there are tutorials that describe converting from MySQL to MySQLi. You can look at that and try some things out. I guess that's a good place to start if PDO seems to difficult.

    Most PHP applications you do will require MySQLi/PDO. It's a good thing to learn in parallel with PHP.

    Think of a "mini project" you wish to do. Perhaps without a database?

    PHP can manipulate images using PHP GD
    PHP can create real PDF files using FPDF
    PHP can do emails, HTML emails, attachments (using PHP mail classes makes it easier).

    If you're an electronics guy like me, you can use PHP along with devices around the house (IoT), or WiFi controllers and service clouds. You create your own data collection cloud (your website), instead of using services like https://www.xively.com/

  5. #5
    Regular Coder Vege's Avatar
    Join Date
    Jan 2008
    Posts
    710
    Thanks
    18
    Thanked 87 Times in 86 Posts
    Quote Originally Posted by mlseim View Post
    Most shared webhosts used MySQL as the databases for their users. MySQL is now obsolete, so they use MySQLi (i=improved). PDO is an interface for accessing databases, which could be MySQLi or any database. So I think whether you're using PHP, Perl, or whatever server-side scripting language, they provide a driver that utilizes PDO. Now, the databases can change and the interface remains the same. It becomes a consistent way to access databases.

    Learning to do Queries for MySQLi can be daunting. It can do amazing things and a lot of what you're selecting or searching for can be done with one query. It takes way less processing time to do one query than several.

    There are thousands of tutorials for MySQL. Now with MySQLi, there are tutorials that describe converting from MySQL to MySQLi. You can look at that and try some things out. I guess that's a good place to start if PDO seems to difficult.

    Most PHP applications you do will require MySQLi/PDO. It's a good thing to learn in parallel with PHP.

    Think of a "mini project" you wish to do. Perhaps without a database?

    PHP can manipulate images using PHP GD
    PHP can create real PDF files using FPDF
    PHP can do emails, HTML emails, attachments (using PHP mail classes makes it easier).

    If you're an electronics guy like me, you can use PHP along with devices around the house (IoT), or WiFi controllers and service clouds. You create your own data collection cloud (your website), instead of using services like https://www.xively.com/
    There were some errors in your post.

    You cannot use pdo to connect to mysqli.

    MySQL is the database. mysql, mysqli and pdo are all libraries to connect to MySQL. Only PDO of these three can connect to other than MySQL database.
    MySQL is still in active development by Oracle (latest gpl release was 2017-04-10). General consensus is that one should use a free fork of MySQL called MariaDB over MySQL as Oracle has it's own Oracle DB and is not really interested with MySQL.
    You can use mysql, mysqli or pdo to connect to mariadb as well.
    Trivia of the day. My and Maria are childs of the creator of said databases.

  6. #6
    Supreme Master coder!
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    10,127
    Thanks
    10
    Thanked 1,162 Times in 1,153 Posts
    Only PDO of these three can connect to other than MySQL database
    I didn't do a good job of explaining it, but that's what I was trying to say. The point being, people should use it.

  7. #7
    New to the CF scene
    Join Date
    Apr 2017
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks for your answers!
    I am now, more convenient with pdo after I have completed a YouTube tutorials to make a register form.
    Although I know it didn't used properly in pdo ( lack of use in prepared statements) I understand the method and now can train in this.
    What do you recommend me to read/try/learn from here? I keep reading phpdelusion blog anyway..
    I need some exercises I think
    And about the IoT you have mentioned- where can I get into this, it's sounds cool and important but I need some help with the technical stuff I need to buy and so on.
    Keep writing please)

  8. #8
    Supreme Master coder!
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    10,127
    Thanks
    10
    Thanked 1,162 Times in 1,153 Posts
    There are pre-made IoT "ready" devices, but for most projects, a person needs to create and build their own hardware. That means you need to have some electronics experience. The PHP is the easy part. The hardware and device programming is the hard part. You will need to learn some multiple programming languages ... and it is really cool. But following is a brief introduction to what you'll need to get started.

    The first thing to know about IoT is that there is no security standards. It's all over the map. Some devices are hackable, some are not. I would never use any online devices to control critical or important equipment (like a house heating/cooling system). I use it for things like patio lights, beer brewing equipment (temp monitors), kiln temp monitors, etc.

    There are a couple of paths you can take ...

    1) Using a cloud service, which is required for using the device. An example is https://www.particle.io/
    You purchase a device from them and connect it to their cloud. All of the programming is done through their cloud once you connect to your WiFi or with a SIM card (cellphone service). Another example is the Electric Imp ( https://www.electricimp.com/ ). The Imp is what I use. It requires their cloud to do all of the programming. I never have to connect a PC to it, in fact you cannot a computer directly to it. It's WiFi and encrypted. The hardware is open and configurable for anything ... inputs, outputs, PWM, UART, PCI, etc. Another example is: http://docs.blynk.cc/

    2) You use an ESP8266 ( https://www.google.com/#safe=off&q=ESP8266 ) either as a WiFi connection using a microcontroller, like Arduino, or built into a microcontroller. These hardware boards are cheaper than Particle or Imp, but you have to do all of the WiFi router programming yourself. To connect to the internet, you have to know the IP address and set up the router to allow connection to the internet. This type of hardware involves things like Rasberry pi, Arduino,

    This is a good place to start with a cheap Wifi microcontroller: https://www.adafruit.com/product/2821

    In either case, the devices have a URL, or IP address, so any PHP script from your website can send or receive data (JSON is common) to and from your device. Your devices may have temp sensors and log data to your website database. You could view a web page on your website and see the status of switches, sensors, and control through PHP, JQuery (AJAX) user interfaces. What I like most about the Imp is that if I wish to make a programming change, I do it online from anywhere in the world. I don't have to physically connect a USB cable to it.
    Last edited by mlseim; 04-20-2017 at 10:51 PM.

  9. #9
    New to the CF scene
    Join Date
    Apr 2017
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Wow thanks for this answer. This is very interesting.
    So the circle of IoT is(example is the light in my room):
    1. I need a hardware- the stuff that actually does the physical action like press the button of the light in my room and this I need to create by myself ( d'u have resources for this?)
    2. I need to purchase the developer kits u mentioned to 'talk' with the hardware I created.
    3. I need to developer software and put it in the cloud to be possible to use it every time I want
    Right?
    And don't sorry I have plenty of questions about PHP on hold

    NB. Does the cloud is necessary? If the product has it's own processor and it can parse software alone, we don't need cloud, right?Only internet to get the commands.
    Last edited by eadadi; 04-21-2017 at 10:41 AM.

  10. #10
    Supreme Master coder!
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    10,127
    Thanks
    10
    Thanked 1,162 Times in 1,153 Posts
    Just to get into it without much investment or construction, purchase something like this:

    https://www.amazon.com/WeMo-Light-Sw.../dp/B00DGEGJ02
    I guess that would be best if you already had Alexa, you would turn on by voice, or using an iphone app.

    These types of things may or may not require a cloud (usually a free account you sign up for), or a free app you download to your smartphone:
    https://wiki.ezvid.com/best-wifi-lig...FQWQaQodW70POA

    That will give you a way to get started without much electronic experience required.
    But what you can do will be limited and may not allow you to use a website (PHP) to control things.

    =========================

    OK ... now to do it with some construction required ... and someone to help with programming using Arduino software. A harder way to do it, but the possibilities are endless depending on how much you want to spend and how much programming you want to do.

    This is a typical tutorial:
    Home Automation With ESP8266 WiFi Without Using Blynk! - All

    You have to buy a esp8266 module, some have the relay module already built-in.
    ESP8266 5V 10A DC 7-30V Network Relay WIFI Module NEW | eBay

    The next part is harder ...
    In order to have it connect to your wifi, it has to know what your SSID and password is. So you need to use a PC and FTDI USB to serial cable and Arduino software with Blynk library. Because this has to only happen one time, you could find someone to do this part for you. Someone that already has an Arduino with IDE. You don't need an Arduino, just the software.

    Then you construct the box with power cord and plug (for a lamp).

    Your programmer friend can help with the IP addressing to send commands from an app or website.

    =========

    Unless you have electronic skills and programming skills, you'll have to get help from someone ... perhaps a Maker Space or even a high school robotics club.

    It's really hard to describe details using this forum ... Google might offer better examples and tutorials.


 

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •