how to get table in mysql using php

Togan J.R :

i am new at php, how to connect and get table value when i open http://localhost/x/x.php?push=1 i am trying to echoing the result but when i try it, it shows nothing

right now i am doing like this and it's not working

<?php
    //this block is to post message to GCM on-click
    $pushStatus = "";   
    if(!empty($_GET["push"])) {
        $mysqli = new mysqli("localhost", "root", "", "bimbinganpa");
        $list_dosen = array();
        $test ="test";
        $list_dosen = $mysqli->query("SELECT no FROM user_id WHERE tipe_user = mahasiswa");
        echo $list_dosen;

        $lines=array();
        $fp=fopen('GCMRegId.txt', 'r');
        while (!feof($fp)){
            $line=fgets($fp);
            //process line however you like
            $line=trim($line);
            //add to array
            $lines[]=$line;
        }

        $gcmRegID  = file_get_contents("GCMRegId.txt");
        $pushMessage = $_POST["message"];   
        if (isset($gcmRegID) && isset($pushMessage)) {      
            $gcmRegIds = array($gcmRegID);
            $pushStatus = sendPushNotificationToGCM($lines, $pushMessage);
        }       
    }
?>

Antony Jack :

String needs a quotation in query...

can you try like following

SELECT no FROM user_id WHERE tipe_user = 'mahasiswa'

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=27787&siteId=1
Recommended