Jump to content

beaux1

Members
  • Posts

    55
  • Joined

  • Last visited

    Never

Everything posted by beaux1

  1. You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE year = '2007'' at line 1 <?php include 'config.php'; include 'opendb.php'; $year = '2007'; $sql = "SELECT count(year) AS year_count WHERE year = '$year'"; $res = mysql_query($sql) or die (mysql_error()); $row = mysql_fetch_assoc($res); echo $row['year_count']; include 'closedb.php'; ?> Eh?
  2. <?php include 'config.php'; include 'opendb.php'; $year = $_POST['2007']; $sql = "SELECT count(year) AS year_count WHERE year = '$year'"; $res = mysql_query($sql) or die (mysql_error()); $row = mysql_fetch_assoc($res); echo $row['year_count']; include 'closedb.php'; ?> My code, I put 2007 where it says $year= $_POST['2007']; And I get: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE year = ''' at line 1 It happens regardless of me putting in the 2007. Help would be much appreciated from you genius's!
  3. Hey. Let's say I have an input box in PHP called Year: and the user types in the year to the box, such as 2007. How would I go about using PHP to call how many columns had '2007' in the year row in the MySQL DB? Basically, I want to know how to use PHP to count how many had a certain thing (which I could change from the PHP script) in the 'year' row. Thanks, Beau.
  4. Hey. On my site, I got coded a CSS Style changer. The code is as following: <?php //Simple CSS changer thingy for trevorchan //by Smurph //cookie value and filename must be the same! (cookie value must lack .css at the end) require('config.php'); function css_menu_getcookie() { if ($_COOKIE['menucss']) { return '<LINK REL=StyleSheet HREF=\"'. $tc_webpath . '/css/' . $_COOKIE['menucss'] . '.css\" TYPE="text/css">\n'; } else { return '<LINK REL=StyleSheet HREF=\"'. $tc_webpath . '/css/' . $tc_defaultmenucss . '.css\" TYPE="text/css">\n'; } //returns the full path to the selected css script (I.E. http://www.pchan.org/css/futaba.css) within a HTML LINK tag } function css_board_getcookie() { if ($_COOKIE['boardcss']) { return '<LINK REL=StyleSheet HREF=\"'. $tc_webpath . '/css/' . $_COOKIE['boardcss'] . '.css\" TYPE="text/css">\n'; } else { return '<LINK REL=StyleSheet HREF=\"'. $tc_webpath . '/css/' . $tc_defaultboardcss . '.css\" TYPE="text/css">\n'; } //returns the full path to the selected css script (I.E. http://www.pchan.org/css/futaba.css) within a HTML LINK tag } if ($_GET['menucss']) setcookie('menucss', $_GET['menucss'], 60 * 60 * 24 * 60 + time()); if ($_GET['boardcss']) setcookie('boardcss', $_GET['boardcss'], 60 * 60 * 24 * 60 + time()); ?> I have my values set in config.php: $tc_defaultmenucss= 'pchanm'; $tc_defaultboardcss= 'pchan'; In menu.php, I have the code to call the CSS, which is as follows: <?php require('config.php'); require($tc_config['rootdir'].'/inc/functions.php'); require('css.php'); ob_start() ?> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title><?php echo $chan_name; ?> Navigation</title> <?php css_menu_getcookie(); ?> However, the CSS doesn't show on the navigation. Anyone know why? No errors show, there's just no CSS.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.