PHP and JavaScript together -
complete revision:
this code whole problem:
function inbox() { #connecting: include('config.php'); $myconnection = new pdo('mysql:host=x;dbname=x', $dbusername, $dbpassword); $myconnection->setattribute(pdo::attr_errmode, pdo::errmode_exception); #collecting: $curuser = $_session['name']; #searching: $searchinbox = $myconnection->prepare("select * inbox = :username"); $searchinbox->bindparam(':username', $curuser); $searchinbox->execute(); $foundresults = $searchinbox->fetch(pdo::fetch_both); var_dump($foundresults); }
as add in 'searching' code, 404 error, if tries refer webpage.
a picture of database table 'inbox': when replace:
$searchinbox = $myconnection->prepare("select * inbox = :username");
to: $searchinbox = $myconnection->prepare("select * inbox title = welcome");
i following error:
fatal error: uncaught exception 'pdoexception' message 'sqlstate[42s22]: column not found: 1054 unknown column 'welcome' in 'where clause'' in (..)
so, somehow can't read title column in case? , why not read whole 'to' column , returns 404 error?
if javascript able call php function , update inbox response take @ ajax. can use send parameters php file, receive response, , process response , update page javascript. if want, jquery has nice ajax function can use.
Comments
Post a Comment