<?php
////////////////////////////////////////////////////////////////////////
// Breeze Website Builder
// Copyright EB Dynamics, Inc., Edward Lemmers, P.E.
// For licensing, see license.txt.
// Created: 4/22/2010	ELL
// Revised: 8/30/2010	ELL
// Fixed bug with handling # in HTML by using string replace. Replace ("#", ",", ".", " ") with ("POUND", "COMMA", "PERIOD", "SPACE").
// Revised: 2/8/2012	ELL
// Added table prefix handling.
	
	include ("check_session.php");
	
	$class_table = $_GET['class_table'];
	$css_table = $_GET['css_table'];
	$class = $_GET['class'];
	$_SESSION['last_class_edited'] = $class;
	$search = array("PERIOD", "POUND", "SPACE", "COMMA");
	$replace = array(".", "#", " ", ",");
	$class = str_replace($search, $replace, $class);
	
	$query = "SELECT * FROM `" . BWB_TABLE_PREFIX . $css_table . "` WHERE `class`='" . $class . "'";
//	$query = "SELECT * FROM " . $css_table . " INNER JOIN " . $class_table . " ON " . $css_table . ".class = " . $class_table . ".class WHERE " . $css_table . ".class='" . $class . "'";
//	echo $query;
//	exit;
	$result = mysql_query($query, $bwb_link);
	$row = mysql_fetch_array($result);

	if (mysql_num_rows($result) < 1)
		echo "-no data-";
	else
		print json_encode($row);
?>