PHP property of non-object (code worked on my previous site) [duplicate]









up vote
-3
down vote

favorite













This question already has an answer here:



  • mysql_fetch_array()/mysql_fetch_assoc()/mysql_fetch_row()/mysql_num_rows etc… expects parameter 1 to be resource

    31 answers



  • Reference - What does this error mean in PHP?

    31 answers



  • How to display errors for my MySQLi query? [duplicate]

    3 answers



I am having an issue with "trying to get property of non-object". However, this exact code has worked before. So I don't know what to do to make it work now. I've looked at other solutions and am still having issues. To me it just makes no sense that this has worked in the past and it doesn't work now.



 $hashed_password = password_hash($password, PASSWORD_DEFAULT);

$check_userName = $DBcon->query("SELECT userName FROM register WHERE userName='$userName'");
$count=$check_userName->num_rows;

if ($count==0) {

$sql = "insert into customers "
. "(fName, lName, address, city, state, zip, userName, password) values "
. "('$fName', '$lName', '$address', '$city', '$state','$zip', '$userName', '$password')";









share|improve this question













marked as duplicate by miken32, Nick, Funk Forty Niner php
Users with the  php badge can single-handedly close php questions as duplicates and reopen them as needed.

StackExchange.ready(function()
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function()
$hover.showInfoMessage('',
messageElement: $msg.clone().show(),
transient: false,
position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
dismissable: false,
relativeToBody: true
);
,
function()
StackExchange.helpers.removeMessages();

);
);
);
Nov 10 at 4:14


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.














  • You aren't checking if your query() function is successful before going ahead and reading num_rows from it. Probably it's returning false for some reason.
    – miken32
    Nov 10 at 4:01














up vote
-3
down vote

favorite













This question already has an answer here:



  • mysql_fetch_array()/mysql_fetch_assoc()/mysql_fetch_row()/mysql_num_rows etc… expects parameter 1 to be resource

    31 answers



  • Reference - What does this error mean in PHP?

    31 answers



  • How to display errors for my MySQLi query? [duplicate]

    3 answers



I am having an issue with "trying to get property of non-object". However, this exact code has worked before. So I don't know what to do to make it work now. I've looked at other solutions and am still having issues. To me it just makes no sense that this has worked in the past and it doesn't work now.



 $hashed_password = password_hash($password, PASSWORD_DEFAULT);

$check_userName = $DBcon->query("SELECT userName FROM register WHERE userName='$userName'");
$count=$check_userName->num_rows;

if ($count==0) {

$sql = "insert into customers "
. "(fName, lName, address, city, state, zip, userName, password) values "
. "('$fName', '$lName', '$address', '$city', '$state','$zip', '$userName', '$password')";









share|improve this question













marked as duplicate by miken32, Nick, Funk Forty Niner php
Users with the  php badge can single-handedly close php questions as duplicates and reopen them as needed.

StackExchange.ready(function()
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function()
$hover.showInfoMessage('',
messageElement: $msg.clone().show(),
transient: false,
position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
dismissable: false,
relativeToBody: true
);
,
function()
StackExchange.helpers.removeMessages();

);
);
);
Nov 10 at 4:14


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.














  • You aren't checking if your query() function is successful before going ahead and reading num_rows from it. Probably it's returning false for some reason.
    – miken32
    Nov 10 at 4:01












up vote
-3
down vote

favorite









up vote
-3
down vote

favorite












This question already has an answer here:



  • mysql_fetch_array()/mysql_fetch_assoc()/mysql_fetch_row()/mysql_num_rows etc… expects parameter 1 to be resource

    31 answers



  • Reference - What does this error mean in PHP?

    31 answers



  • How to display errors for my MySQLi query? [duplicate]

    3 answers



I am having an issue with "trying to get property of non-object". However, this exact code has worked before. So I don't know what to do to make it work now. I've looked at other solutions and am still having issues. To me it just makes no sense that this has worked in the past and it doesn't work now.



 $hashed_password = password_hash($password, PASSWORD_DEFAULT);

$check_userName = $DBcon->query("SELECT userName FROM register WHERE userName='$userName'");
$count=$check_userName->num_rows;

if ($count==0) {

$sql = "insert into customers "
. "(fName, lName, address, city, state, zip, userName, password) values "
. "('$fName', '$lName', '$address', '$city', '$state','$zip', '$userName', '$password')";









share|improve this question














This question already has an answer here:



  • mysql_fetch_array()/mysql_fetch_assoc()/mysql_fetch_row()/mysql_num_rows etc… expects parameter 1 to be resource

    31 answers



  • Reference - What does this error mean in PHP?

    31 answers



  • How to display errors for my MySQLi query? [duplicate]

    3 answers



I am having an issue with "trying to get property of non-object". However, this exact code has worked before. So I don't know what to do to make it work now. I've looked at other solutions and am still having issues. To me it just makes no sense that this has worked in the past and it doesn't work now.



 $hashed_password = password_hash($password, PASSWORD_DEFAULT);

$check_userName = $DBcon->query("SELECT userName FROM register WHERE userName='$userName'");
$count=$check_userName->num_rows;

if ($count==0) {

$sql = "insert into customers "
. "(fName, lName, address, city, state, zip, userName, password) values "
. "('$fName', '$lName', '$address', '$city', '$state','$zip', '$userName', '$password')";




This question already has an answer here:



  • mysql_fetch_array()/mysql_fetch_assoc()/mysql_fetch_row()/mysql_num_rows etc… expects parameter 1 to be resource

    31 answers



  • Reference - What does this error mean in PHP?

    31 answers



  • How to display errors for my MySQLi query? [duplicate]

    3 answers







php arrays variables






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 10 at 3:41









Ashley

11




11




marked as duplicate by miken32, Nick, Funk Forty Niner php
Users with the  php badge can single-handedly close php questions as duplicates and reopen them as needed.

StackExchange.ready(function()
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function()
$hover.showInfoMessage('',
messageElement: $msg.clone().show(),
transient: false,
position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
dismissable: false,
relativeToBody: true
);
,
function()
StackExchange.helpers.removeMessages();

);
);
);
Nov 10 at 4:14


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.






marked as duplicate by miken32, Nick, Funk Forty Niner php
Users with the  php badge can single-handedly close php questions as duplicates and reopen them as needed.

StackExchange.ready(function()
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function()
$hover.showInfoMessage('',
messageElement: $msg.clone().show(),
transient: false,
position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
dismissable: false,
relativeToBody: true
);
,
function()
StackExchange.helpers.removeMessages();

);
);
);
Nov 10 at 4:14


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.













  • You aren't checking if your query() function is successful before going ahead and reading num_rows from it. Probably it's returning false for some reason.
    – miken32
    Nov 10 at 4:01
















  • You aren't checking if your query() function is successful before going ahead and reading num_rows from it. Probably it's returning false for some reason.
    – miken32
    Nov 10 at 4:01















You aren't checking if your query() function is successful before going ahead and reading num_rows from it. Probably it's returning false for some reason.
– miken32
Nov 10 at 4:01




You aren't checking if your query() function is successful before going ahead and reading num_rows from it. Probably it's returning false for some reason.
– miken32
Nov 10 at 4:01

















active

oldest

votes






















active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes

Popular posts from this blog

How to how show current date and time by default on contact form 7 in WordPress without taking input from user in datetimepicker

Syphilis

Darth Vader #20