How to set where clause properly to get ride of fatal error in my syntex in mysql?

I was playing with mysql data selection with condition and following was working like:

$DB_con->prepare('SELECT productId, productName, productDetails, productPic FROM product ORDER BY productId DESC')

but I wanted to use a WHERE clause with the above code like

$DB_con->prepare(‘SELECT productId, productName, productDetails, productPic FROM product ORDER BY productId DESC where productType = xyz’)

But That was creating a fatal error, what wrong I am doing here? please help.

php convert square bracket string into array

I have a string such as:-


What is the quickest / easiest way to convert into a PHP array so I can for example loop through the values and so on?

I know it is probably really obvious but I am struggling to find the answer!


Creating pagination with PHP and SQL Server, pagination works, but data doesn’t changed when changing page

I’m trying to add pagination function like i asked before, I was facing an error and already fixed it.

The "LIMIT" function is working fine using TOP($limit), but the problem is when I clicked into next page the data wasn’t show as expected.

I have about 38 data(s), and when I set the limit as TOP(3), the pagination still showing 3 data(s) as a single page, instead of 38/3 data per pages.

I already tried to googling the solution but all of them asking me to change the whole script i’ve been created.

Is there any way to fix the problem without changing the whole script ?

Here is my script :


          //pagination source
          $sqlcount   =   "SELECT COUNT(id_pelanggaran) FROM pelanggaran";
          $rscount    =   sqlsrv_has_rows(sqlsrv_query($conn,$sqlcount));
          $totaldata  =   $rscount[0];
          $page       =   isset($_GET['page']) ? $_GET['page']:1;
          $limit      =   3;
          $start      =   ($page > 1) ? ($page * $limit) - $limit : 0;
          $pages      =   ceil($rscount/$limit);

          // Data Source
          $query    = "SELECT TOP($limit)
                      INNER JOIN dbo.jenis_pelanggaran ON dbo.pelanggaran.id_jenis_pelanggaran =
                      INNER JOIN dbo.daftar_outlet ON dbo.pelanggaran.id_lokasi_outlet =
                      dbo.pelanggaran.id_jenis_pelanggaran = ORDER BY id_pelanggaran ASC";

          $result = sqlsrv_query($conn,$query);

          if (sqlsrv_has_rows($result) > 0) {
            while ( $data = sqlsrv_fetch_array($result)){


                <?php echo "<td>" . $data['id_pelanggaran'] . "</td>"; ?>
                <?php echo "<td>" . $data['waktu_pelanggaran'] . "</td>"; ?>
                <?php echo "<td>" . $data['nama_pelanggar'] . "</td>"; ?>
                <?php echo "<td>" . $data['pelanggaran'] . "</td>"; ?>
                <?php echo "<td>" . $data['nama_outlet'] . "</td>"; ?>
                <?php echo "<td>" . $data['bukti_screenshot'] . "</td>"; ?>
                <?php echo "<td>" . $data['bukti_rekaman'] . "</td>"; ?>
                <?php echo "<td>" . $data['bukti_dokumen'] . "</td>"; ?>
                <td class="text-center">
                  <button class="btn btn-sm btn-primary" type="button" name="button">Edit</button>
                <button class="btn btn-sm btn-danger" type="button" name="button">Del</button>


    //pagination button

Replace text string with PHP session variable using PHP or Javascript

I have a string of text that is part of a URL on a PHP page that looks like this:.

<a href="}}">LINK</a>

I need to replace the with a session variable I have created $SESSION['EmpNo']

Using another question I’ve tried to put this at the bottom of the page to run last but it is not working?

<?php $linkString = str_replace('', $SESSION['EmpNo'], $linkString); ?>

This is not working. What is the best way to achieve this result?

the return is always 0

Someone can help me?

The return is always 0.
(Sorry my English is very bad)

public function userRegistration($username,$password,$email,$name,$social_id)
        require_once ('../mailer/class.phpmailer.php');
        $db = getDB();
        $st = $db->prepare("SELECT id FROM account WHERE login=:username"); 
        $st->bindParam("username", $username,PDO::PARAM_STR);
            $stmt = $db->prepare("INSERT INTO account(id,login,password,real_name,social_id,email,coins,web_ip,web_aktiviert,status,reason,availDt,create_time,safebox_expire,autoloot_expire,silver_expire,gold_expire,fish_mind_expire,marriage_fast_expire,money_drop_rate_expire,channel_company,last_play,web_admin,securitycode,aktivHash) VALUES ('',:username,:hash_password,:name,:social_id,:email,'','','','OK',NULL,'','','','','','','','','','','','',NULL,NULL)");
            $stmt->bindParam("username", $username,PDO::PARAM_STR) ;
            $hash_password= hash('md5', $password); //Password encryption
            $stmt->bindParam("hash_password", $hash_password,PDO::PARAM_STR) ;
            $stmt->bindParam("email", $email,PDO::PARAM_STR) ;
            $stmt->bindParam("name", $name,PDO::PARAM_STR) ;
            $stmt->bindParam("social_id", $social_id,PDO::PARAM_STR) ;
            $id=$db->lastInsertId(); // Last inserted row id
            include ('registered.php');

            $mail = new PHPMailer(true);
            $mail->SMTPDebug  = 2;   
            $mail->SMTPAuth   = true;                  
            $mail->SMTPSecure = "ssl";                 
            $mail->Host       = "host";      
            $mail->Port       = 465;
            $mail->CharSet = 'UTF-8';                 
            $mail->SetFrom('email','Succesfull registration!');
            $mail->AddReplyTo("","Succesfull registration!");
            $mail->Subject    = "Succesfull registration!";

            $db = null;
            //return true;
            $db = null;
            //return false;

    catch(PDOException $e) {
        echo '{"error":{"text":'. $e->getMessage() .'}}'; 
} API Webhook doesn’t send data

I’m trying to get updates from new blocks, balance changes etc. over the Webhook api function.

So, i registered the notification-function over the web api, and it returns “200 SUCCESS” and the function is there.

Now if i take a look at my callback php file, which will be called with the specific post parameters (that’s what it should do, but it doesn’t), i see that there are frequently connections from

Now i tried to write the POST parameters to an file, but this only returns an Empty array. Whats the problem with this WebHook function? (I upgraded to “The Digger”, so WebHooks are enabled.)

Thanks in advance.