Fatal error: Uncaught Error: Call to undefined function mysql_real_escape_string()  in php7

Fatal error: Uncaught Error: Call to undefined function mysql_real_escape_string()  in php7   # codeIgniter use mysql_real_escape_string() instead.database connection issue Answer:  Use $this->db->escape_str($name);  OR  $new_name = …

Read More

Codeigniter – How to Join City Country State by concatenate two fields in Sql

Codeigniter – How to Join City Country State by concatenate two fields in Sql $this->db->select(” CONCAT(c.name,’-‘,co.code) as id,CONCAT(c.name,’ ,’,s.name,’ ,’,co.name) as text”,FALSE); $this->db->from(“city c”); $this->db->join(‘state …

Read More

How to prevent duplicate usernames when people register? PHP/MySQL

$connect = mysql_connect(‘whatever’,’whatever’,’whatever’); $database = mysql_select_db(‘your dbname’); $username = $_POST[‘username’]; if(isset($username)){ $mysql_get_users = mysql_query(“SELECT * FROM table_name where username=’$username'”); $get_rows = mysql_affected_rows($connect); if($get_rows >=1){ echo …

Read More

Php – How to Connect Database from Constant file in Codeigniter version 3.0

  Here, Using this way you can connect with database from constant file. then you can access the tables. include(APPPATH.’config/database’.EXT); $conn = mysql_connect($db[‘default’][‘hostname’], $db[‘default’][‘username’], $db[‘default’][‘password’]); …

Read More