Most Popular
how to store and retrieve array from Session variable using php?
Here is simple code to illustrate use of session to store array that can be used in other script. <?php session_start(); $_SESSION['type'] = "ikhlaque"; $_SESSION['colors'] = array("black", "silver", "red"); if (isset($_SESSION['type']) && isset($_SESSION['colors'])) { echo "You would like a " , $_SESSION['type'] , " in " , implode(" and ", $_SESSION['colors']); } ?> It will output 'You would like a ikhlaque in black and silver and red'
How to get table count for all tables in a database in Mysql?
Following Example shows you how to get tables list from database using PHP CODE. <?php $dbname = 'mysql_dbname'; if (!mysql_connect('localhost', 'root', '')) { echo 'Could not connect to mysql'; exit; } $sql = "SHOW TABLES FROM $dbname";$result = mysql_query($sql); if (!$result) { echo "DB Error, could not list tables\n"; echo 'MySQL Error: ' . mysql_error(); exit; } while ($row = mysql_fetch_row($result)) { echo "Table: $row[0] \n"; } mysql_free_result($result);?>