ratchet not connecting to database

647 views Asked by At

I have been playing around with ratchet, and installed everything. I have followed the guide lines as well at socketo.me. However, I cannot insert values into my database after postings. I am noticing the $conn variable in the push-server.php file as well as other files using the same variable in the vendor folder.

Should my connection to the database be the same variable as well? Currently, it is $con and that is what I have been using to connect to my database thus far on my website

<?php include("./inc/incfiles/connect.inc.php");
  session_start();
  if (!isset($_SESSION["user_log"]))
  {
  $fiwiuser = ""; 
  }
  else
  {
  //$fiwiuser = $_SESSION["email_log"];
 $fiwiuser = $_SESSION["user_log"];
 //$username_send = $_SESSION["username"]; 
  }  
?>

<?php
  $post = strip_tags(@$_POST['body']);
  if ($post !="")
  {
 $entryData = array(
   'body'           =>   strip_tags(@$_POST['body'])
      , 'date_added'     =>   date("Y-m-d H:i:s")
      , 'added_by'       =>   strip_tags(@$_POST['$fiwiuser'])
      , 'user_added_to'  =>   strip_tags(@$_POST['$username'])
 );
 
 $con -> prepare("INSERT INTO posts (body, date_added, added_by, user_added_to) VALUES (body, date_added, added_by, user_added_to)")
      ->execute($entryData['body'], $entryData['date_added'], $entryData['added_by'], $entryData['user_added_to']);
 
 // This is our new stuff
 $context = new ZMQContext();
 $socket = $context->getSocket(ZMQ::SOCKET_PUSH, 'my pusher');
 $socket->connect("tcp://localhost:5555");
 
 $socket->send(json_encode($entryData));
  }
?>

0

There are 0 answers