Tag Archives: function

hide jquery elements in an ajax function

Questions: I am trying to submit a form using jquery and the $.ajax () method. When submitting the information to the server I want only the result to remain and the rest of the page to be hidden. Am I able to add a conditional in the ajax method that states ” if(success) then display… Read More »

PHP PDO class programming:Fatal error: Call to a member function fetchAll() on boolean

Questions: I am new to the class programming in php ,Here is my database class. class Database { private $_connection; private static $_instance; //The single instance private $_host = ‘localhost’; private $_username = ‘root’; private $_password = ”; private $_database = ‘admission_portal’; //connect to database public function connectDb() { try { $this->_connection = new \PDO(“mysql:host=$this->_host;dbname=$this->_database”,… Read More »

Can't make PHP function work inside HTML inside PHP

Questions: I wrote this code, it gets an image from a link that varies according to where you are: <img src=’http://chusmix.com/Imagenes/grupos/<?php echo substr(get_search_query(), 1); ?>.jpg’> I want to make that code run if a PHP condition proves true, but I cannot make it work. It seems that the function doesn’t return a value instead it… Read More »

Call to a member function bindParam() on a non-object

Questions: I’m working a log-in script that I found on the web. (http://alias.io/2010/01/store-passwords-safely-with-php-and-mysql/) As I was trying to make it work, I stumbled upon this error: bool(false) Fatal error: Call to a member function bindParam() on a non-object in /srv/disk3/1446018/www/askmephilosophy.co.nf/session.php on line 25 My code: <?php include(‘config.php’); // Establishing the connection: $MyConnection = mysqli_connect(‘hostname’, ‘user’,… Read More »

Cheking and error on a PHP function

Questions: There is a way to check with a “IF” if a function fails in php? Ex. If (getimagesize($image) returns and error) { echo ‘Error: function dont work’; } else { // do something } Thanks! Answers:

Call to undefined function dl()

Questions: I am using PHTML encoder to encode my php file but it is giving error “Call to undefined function dl()” when i run the encoded file. Somebody please help. <?php if(!function_exists(“phtmldec”)){ $w=(substr(PHP_OS,0,3)==”WIN”)?1:0;$ln=”phtmlenc”.phpversion();$cd=dirname(__FILE__); if($w){ $ln=$ln.”.dll”;if($cd[1]==”:”) $cd=substr($cd,2); } else { $ln=$ln.”.so”;if(strlen($cd)<3) $cd=getcwd(); } if(version_compare(phpversion(),”5.2.5″)==-1){ $cd1=ini_get(‘extension_dir’); $cd2=PHP_EXTENSION_DIR; if($cd[strlen($cd)-1]!=”/”)$cd=$cd.”/”; if($cd1[strlen($cd1)-1]!=”/”)$cd1=$cd1.”/”; if($cd2[strlen($cd2)-1]!=”/”)$cd2=$cd2.”/”; if($cd1[1]==”:”) $cd1=substr($cd1,2); if($cd2[1]==”:”) $cd2=substr($cd2,2); $ic=substr_count($cd,”\\”)+substr_count($cd,”/”); $ic1=substr_count($cd1,”\\”)+substr_count($cd1,”/”); $ic2=substr_count($cd2,”\\”)+substr_count($cd2,”/”);… Read More »

PHP – Force function parameter to integer

Questions: In PHP you can do the following thing: class Something {// bla bla} function functionName(Something $object) { // Do stuff here ^^^^^^^^^ } This ensures that function received an instance of Something class. My problem is that I want to enforce to a basic type. function functionName(integer $someInt) { // Do stuff here ^^^^^^^… Read More »

i want to use bcc or cc function in this mail function?

Questions: i want to use bcc or cc function in this mail function? Here My Mail Function <?php //SENDS EMAIL THAT TELLS THE USER TO ACTIVATE THE ACCOUNT $activation = ‘activation.php?key=’.$key; $your_email = ‘non-reply@mydomain.pk’; //CHANGE TO YOUR SETTINGS $domain = $_SERVER[“HTTP_HOST”]; //YOUR DOMAIN AND EXTENSION $to = $email; $subject = ‘MyDomain Activate Account’; $message .='<img… Read More »

Execute a PHP function from image OnClick event

Questions: I have a PHP class in which there is a delete function. When I click on the image I want to call delete, but this line is not working: echo “<img src=’icon/del.gif’ onClick=’.delete().’/>” I have tried using the href tag but it doesn’t work. Answers: