JOHNMAC

JOHNMAC

Member Since 1 Year Ago

Experience Points
5,950
Total
Experience

4,050 experience to go until the next level!

In case you were wondering, you earn Laracasts experience when you:

  • Complete a lesson — 100pts
  • Create a forum thread — 50pts
  • Reply to a thread — 10pts
  • Leave a reply that is liked — 50pts
  • Receive a "Best Reply" award — 500pts
Lessons Completed
0
Lessons
Completed
Best Reply Awards
0
Best Reply
Awards
  • start your engines Created with Sketch.

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • first-thousand Created with Sketch.

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • 1-year Created with Sketch.

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • 2-years Created with Sketch.

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • 3-years Created with Sketch.

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • 4-years Created with Sketch.

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • 5-years Created with Sketch.

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • school-in-session Created with Sketch.

    School In Session

    Earned when at least one Laracasts series has been fully completed.

  • welcome-newcomer Created with Sketch.

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • full-time-student Created with Sketch.

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • pay-it-forward Created with Sketch.

    Pay It Forward

    Earned once you receive your first "Best Reply" award on the Laracasts forum.

  • subscriber Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • evangelist Created with Sketch.

    Laracasts Evangelist

    Earned if you share a link to Laracasts on social media. Please email [email protected] with your username and post URL to be awarded this badge.

  • chatty-cathy Created with Sketch.

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • lara-veteran Created with Sketch.

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • 10k-strong Created with Sketch.

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • lara-master Created with Sketch.

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • laracasts-tutor Created with Sketch.

    Laracasts Tutor

    Earned once your "Best Reply" award count is 100 or more.

  • laracasts-sensei Created with Sketch.

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • top-50 Created with Sketch.

    Top 50

    Earned once your experience points ranks in the top 50 of all Laracasts users.

Level 2
5,950 XP
Jul
14
2 months ago
Activity icon

Replied to Parse Error: Syntax Error, Unexpected 'try' (T_TRY), Expecting Function (T_FUNCTION) Or Const (T_CONST) In ...\pdo_login\connection.php On Line 12

now when i insert data it says data inserted but nothing is inserting into database, this s code of server.php file

code:

      <?php


     include_once("connection.php");

     if(isset($_POST['register']))
     {
	        $conn = connection::connect();

	        $username = $_POST['username'];
   	$email = $_POST['email'];
   	$password = $_POST['password'];

	  if(insertDetails($conn, $username, $email, $password));
	  {
		echo "Data Inserted Successfully";
	   }
    }

      function insertDetails($conn, $username, $email, $password)
      {
	    $query = $conn->prepare("INSERT INTO users (user_name, user_email, user_pass) VALUES(:username, :email, :password)");

   	$query->bindParam(":username",$username);
   	$query->bindParam(":email",$email);
	        $query->bindParam(":password",$password);

	      return $query->execute();
      }


   ?>
Activity icon

Started a new Conversation Parse Error: Syntax Error, Unexpected 'try' (T_TRY), Expecting Function (T_FUNCTION) Or Const (T_CONST) In ...\pdo_login\connection.php On Line 12

data insertion failed in php PDO and error is "Parse error: syntax error, unexpected 'try' (T_TRY), expecting function (T_FUNCTION) or const (T_CONST) in ...\pdo_login\connection.php on line 12"

code:

   <?php

      class connection {
      public static function connect()
	  {
		$host = "localhost";
		$username = "root";
		$password = "";
		$dbname = "pdo_login";
	  }

	  try {
		$conn = new PDO("mysql:host = $host; dbname = $dbname", $username, $password);
	  }
	  catch(PDOException $e) {
		echo "Connection failed" . $e->getMessage();
	  }

	  return $conn;
    }

  ?>
Jul
12
2 months ago
Activity icon

Replied to Fatal Error: Uncaught Error: Call To A Member Function SetFetchMode() On Bool

Notice: Undefined variable: pdo in ...\practice.php on line 7

Fatal error: Uncaught Error: Call to a member function setFetchMode() on null in

code:

  try{
	$conn = new PDO("mysql: host = localhost; dbname = php_crud", 'root', '');

	$pdo->setFetchMode(PDO:: FETCH_ASSOC);

	$pdo = $conn->query("SELECT * FROM data");

	

	while($row = $pdo->fetch()) {
		echo $row['email'] . "<br>";
	}
}
Activity icon

Started a new Conversation Fatal Error: Uncaught Error: Call To A Member Function SetFetchMode() On Bool

Data is not fetching from db and shows error which is "Fatal error: Uncaught Error: Call to a member function setFetchMode() on bool in ...\practice.php:9 Stack trace: #0 {main} thrown in ...\practice.php on line 9"

code:

      <?php


    try{
    	$conn = new PDO("mysql: host = localhost; dbname = php_crud", 'root', '');

    	    $pdo = $conn->query("SELECT * FROM data");

    	    $pdo->setFetchMode(PDO:: FETCH_ASSOC);

    	while($row = $pdo->fetch()) {
	        	echo $row['email'] . "<br>";
        	}
    }

    catch(PDOException $e) {
	    echo "Error: " . $e->getMessage();
    }



?>
Apr
28
4 months ago
Activity icon

Started a new Conversation ReferenceError: LIST_USERS Is Not Defined

hello m working on slider that when i click on slide of slider then it opened but now its not opening and says

"ReferenceError: LIST_USERS is not defined"

this is slider screenshot: https://ibb.co/YhHqX7S and this is error screnshot: https://ibb.co/xFN9dny

any suggestion to resolve it,

showing error at here:

groupTo: { selector: '#groupTo', data: task.groupTo ? task.groupTo.filter(listUser => listUser in LIST_USERS).map( listUser => {
                      const user = {
                          _id: listUser,
                          displayName: LIST_USERS[listUser]
                      }

complete code:

  function getFindFromTask (task, subtask = task) {
      const find =  {
              input: {
                  type: task.type,
                  dueDate: utils.convertDateToDatePickerValue(subtask.dueDate),
                  id: taskId,
                  attachments: undefined
              },
              select: {
                  groupTo: { selector: '#groupTo', data: task.groupTo ? task.groupTo.filter(listUser => listUser in LIST_USERS).map( listUser => {
                      const user = {
                          _id: listUser,
                          displayName: LIST_USERS[listUser]
                      }
                      return { user }
                  }) : []},
              },
              textarea: {
                  note: subtask.note,
              }
          }

      if (subtask.completedAt) find.input.completedAt = moment(subtask.completedAt).format('YYYY-MM-DDThh:mm')

      if (task.assignTo) find.select.assignTo = {
        selector: '#otherFourAttendees',
        data: task.assignTo
      }

      if (task.completedBy) find.select.completedBy = {
        selector: '#completedBy',
        data: task.completedBy.map(user => ({ user }))
      }

      return find
    }