Information Library

[insert_php]
$hostname = “librarydb.c7uikibttxwg.us-east-1.rds.amazonaws.com”; /* where XX is the IP for the MySQL server your database is on */
$dbName = “innodb”; /* where uXXXXXXX is your MySQL database ID */
$username = “Cirrus”; /* same as your dbName in this case */
$password = “sausages2014”; /* same as your FTP password */

$link = mysql_connect($hostname, $username, $password);
if (!$link) { die(‘Not connected : ‘ . mysql_error()); }

$db_selected = mysql_select_db($dbName, $link);
if (!$db_selected) { die (“Can\’t use $dbName : ” . mysql_error()); }

// DATASHEETS
$query = “SELECT * FROM cr_library WHERE active = ‘1’ AND company = ” AND category = ‘d’ AND language = ‘EN’ AND region = ” ORDER BY year DESC”;
$result = mysql_query($query);
if (!$result) { die(‘Invalid query: ‘ . mysql_error()); }

echo ‘
Product Datasheets
‘;
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
echo ‘‘;
echo $row[‘title’];
echo ‘

‘;
}
echo ‘
‘;

// CASE STUDIES
$query = “SELECT * FROM cr_library WHERE category = ‘c’ AND language = ‘EN’ ORDER BY year DESC, category DESC, id ASC”;
$result = mysql_query($query);
if (!$result) { die(‘Invalid query: ‘ . mysql_error()); }
echo ‘

‘;
echo ‘
Case studies
‘;
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
echo ‘‘;
echo $row[‘title’];
echo ‘

‘;
}
echo ‘
‘;

// NEWSLETTERS
$query = “SELECT * FROM cr_library WHERE category = ‘n’ AND language = ‘EN’ ORDER BY year DESC, category DESC, id ASC”;
$result = mysql_query($query);
if (!$result) { die(‘Invalid query: ‘ . mysql_error()); }
echo ‘

‘;
echo ‘
Newsletters
‘;
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
echo ‘‘;
echo $row[‘title’];
echo ‘

‘;
}
echo ‘
‘;