Update – Please visit skpaul.me for latest posts and updates

skpaul.me

Hi,

Greetings!!

Thanks for visiting my blog, I have open a blog (http://skpaul.me). So from now, you will get all latest posts and updates on http://skpaul.me.

 

Please take a look on my personal blog (http://skpaul.me), and let me know your comments and review.

 

Thanks in Advance

sk paul

http://skpaul.me

How to find a column or filed name of a table from an entire database?

If you are working on a BIG project with lots of tables in the database, then it will be a good trick query for you to find out a column name of any table from that database.

 

My scenario was a bit different, I had to start work in the middle of a project and there was no one to guide/help me regarding  anything. And you know, about the deadline… really messed up. So, I didn’t hopeless and as usual did some google and prepare this query.

 

“SELECT TABLE_NAME, COLUMN_NAME

FROM INFORMATION_SCHEMA.COLUMNS

WHERE column_name LIKE ‘your_column_name’ “

 

As you can see it search information schema for the column name you are finding after the LIKE clause. And this query saved me and my ass 😉

 

I am writing this article for my future reference. Hope it will also help you and save your ass too 😉 as like mine. If this article save your time then you can comment and share this article to save others too. [sharing is caring]

 

 

[Note: May be you can find this query on other sites. As I said I did some google and make for me. Sorry forgot those site otherwise I put those on ref. section like my other post.]

Update (custom) XAMPP/WAMP/LAMP default landing page layout

We are building website and applications on localhost and I use XAMPP package on Linux for my local development.
Screenshot from 2015-10-07 20:20:51

 

After installing Xampp, we always get a default home page from Xampp and most of the time we don’t need that. Basically before writing this article I always delete all items of htdocs/www folder, but sometimes we need to know things like versions and if functions are enable or not and also the limits various variables. So by using the below script you can easily get a good view of your localhost’s projects (as a list) and as well as databases from phpmyadmin. And you dont need to delete anything on htdocs folder and get all thing whenever you need.

 

In the header put this css code into the style tag for a better view

 

body {

background: #fcfcfc;

color: #111;

font-family: verdana, sans-serif;

padding: 0;

margin: 0;

}

#main {

width: 100%;

position: relative;

}

.container {

padding: 1em;

}

#menu { float: left; width: 24%;  }

#menu ul { padding: 0; border-right: 3px solid white; margin: 0; }

ul li { list-style-type: none; }

ul li a {

display: block;

background: #eee;

padding: 4px 7px;

border-top: 2px solid #fff;

}

ul li a:hover {

background: #B6C6D7;

color: black;

}

iframe {

border: 0 none;

overflow: hidden;

width: 74%;

height: 95%;

padding-left: 1%;

}

.clear-block {

width: 100%;

height: 1px;

clear: both;

}

Add this css file for a look like phpmyadmin

<link rel=”stylesheet” type=”text/css” href=”phpmyadmin/phpmyadmin.css.php”></script>

 

Put this code into the body

</div>

</div>

Now you are done 🙂 . And save this file as index.php at htdocs

Or download from here

 

 

Update: 07.10.2015

If there is issue of viewing your phpmyadmin, here is the solution. You just need to add an extra line to allow the third party framing on your phpmyadmin/config.inc.php file.

$cfg[‘AllowThirdPartyFraming’] = true;

 

Joomla! 3 installation freezes at creating database table

After long time I try to install Joomla and it is Joomla 3.3.0 and face a problem as like you. All things are ok but its taking too much time during database table creation. And here is the solution

To solve this go to

Your joomla folder\installation\sql\mysql and open Joomla.sql file find the term

“ENGINE=InnoDB”

and replace ALL with

“ENGINE=MyIsam”

MyIsam is more supported and compatible with Joomla.

Do also the same with (sample_data.sql) file, if it’s quickstart setup.

PHP code to execute MySQL script

There are advanced and comfortable tools to manage your MySQL databases (i.e.  server side: phpMyAdmin, client side:  SQLyog).

But sometimes you can not use those tools and need the ability to execute some SQL script on server by your own hands, easy and fast way. What to do in such situation? Use this PHP code to execute all SQL commands from SQL script text file, one by one:

$sqlFileToExecute = 'path/to/sql/script.sql';

$hostname = DB_HOST;
$db_name = DB_NAME;
$db_user = DB_USER;
$db_password = DB_PASSWORD;

$link = mysql_connect($hostname, $db_user, $db_password);
if (!$link) {
  die ("MySQL Connection error");
}

mysql_select_db($db_name, $link) or die ("Wrong MySQL Database");

$fp = file($sqlFileToExecute, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
$query = '';
foreach ($fp as $line) {
  if ($line != '' && strpos($line, '--') === false) {
  $query .= $line;
    if (substr($query, -1) == ';') {
      mysql_query($query);
      $query = '';
    }
  }
}