PHP - Help With Horrible Coding Woes (the Mythical Unexpected T_endif)
I get the "Parse error: syntax error, unexpected T_ENDIF in /hsphere/local/home/x/x/links/wp-content/themes/x/single.php on line 58" error. I have highlighted line 58 below. What is wrong?
Code: [Select] <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en-us"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title><?php the_title(); ?> | X</title> <meta name="author" content="X" /> <meta name="description" content="X" /> <meta http-equiv="Content-Type" content="text/html; charset=<?php bloginfo('charset'); ?>" /> <meta name="generator" content="WordPress <?php bloginfo('version'); ?>" /> <!-- leave this for stats please --> <style type="text/css" media="screen"> @import url( <?php bloginfo('stylesheet_url'); ?> ); </style> <link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="" /> <link rel="alternate" type="text/xml" title="RSS .92" href="<?php bloginfo('rss_url'); ?>" /> <link rel="alternate" type="application/atom+xml" title="Atom 0.3" href="<?php bloginfo('atom_url'); ?>" /> </head> <div id="wrap"> <ul id="navbar"> <li><a href="http://x" alt="Index">Index</a></li> <li><a href="http://x/articles/" alt="Articles">Articles</a></li> <li><a href="http://x/links/" alt="Links">Links</a></li> <li><a href="http://x/contact/" alt="Contact">Contact</a></li> <li><a href="http://x/colophon/" alt="Colophon">Colophon</a></li> </ul> <img src="http://x/images/links.jpg" class="shadow" alt="Links of Plenty" width="640" height="320" /> <h1>Title</h1> <h4>Tagline</h4> <br> <div id="main"> <div id="content"> <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <div class="post" id="post-<?php the_ID(); ?>"> <?php if( in_category('ll') ) : ?> <h2 class="ll"><a href="<?php the_linked_list_link('url') ?>" rel="bookmark" title="Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2> <?php else : ?> <h2 class="title"> <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2> <?php endif; ?> <div class="meta"> <p>Posted on <?php the_time('M') ?> <?php the_time('d') ?> <?php the_time('Y') ?> | <a href="http://www.instapaper.com/hello2?url=<?= rawurlencode(get_permalink()) ?>&title=<?= rawurlencode(get_the_title()) ?>">Add to Instapaper</a> | <a href="http://twitter.com/share?url=<?php the_permalink() ?>">Share on Twitter</a></p> </div> <br> <div class="entry"> <?php the_content(__('Continue Reading &#187;')); ?> <?php wp_link_pages(); ?> <a href="<?php the_permalink() ?>" rel="bookmark">⌘</a> </div> <br><p align="center"><a href="http://x/links/archives/">Browse by subject, year or month</a></p> </div> LINE 58 <?php endif; ?> </div> </div> <p id="footer"><a href="http://feeds.feedburner.com/x">Articles feed</a>. <a href="http://feeds.feedburner.com/x">Links feed</a>. <a href="http://feeds.feedburner.com/x"><a href="http://x/colophon/index.html#license">License</a>. Powered by <a href="http://www.wordpress.org">Wordpress</a> and <a href="http://x/">Coffee</a>. Built with <a href="http://macrabbit.com/espresso">Espresso</a>. <a href="http://x/links/wp-login.php">Admin</a>.</p> </div> <script type="text/javascript"> var _gaq = _gaq || []; _gaq.push(['_setAccount', 'x']); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); </script> </body> </html> Similar TutorialsThis topic has been moved to Third Party PHP Scripts. http://www.phpfreaks.com/forums/index.php?topic=323310.0 I make my share of programming design blunders, as many of you know from helping me debug a few, so I am hesitant to point fingers, but I just had an experience so horrible, with so many errors on a website owned by Snapfish (which should have some programming resources) that I had to write it up.
This topic has been moved to PHP Regex. http://www.phpfreaks.com/forums/index.php?topic=346278.0 Hi there Got a problem needs a solution, basically a booking system has been built (by me) and works great except for the checking availablity Basically they can do drives in a car (in any order) so I need to try all possible combinations. one idea I had was to use an array holding the availability for each slot so that it looks like slotArray=array("ABC","AC","C","A","BC","AB","ABC" ...etc) looking for drives A and B so check if slotArray[1] contains A and Slot Array 2 contains b or vice versa what i need to do is work out all the possible orders of a string ABCDE (there will be 120 of them) so I can systematically check the order anyone have a function that will do this? So, I'm getting a blank PHP page and it's driving me nuts. Unfortunately the client won't let me post my code up here, but rest assured that I'm an experienced web developer and have checked all of the usual suspects. I enabled error reporting, checked my apache error log, and neither of those produce any messages. The syntax is correct. I tossed in "die('here!')" in a few places until I couldn't see it. I narrowed down the stop point as being somewhere in the middle of a foreach loop. Before this foreach loop, I'm using array_merge on some fairly large pieces of data, but nothing unreasonable. When I comment out the array_merge line, the page works correctly. I figured maybe there was some kind of memory issue, or execution timeout thing going on, but when I increase both of those settings it has no effect. In essence, I'm wondering what might be some causes of the blank page problem beyond the common ones, since I'm really scratching my head over this one. Hi Everyone, Please have a look at the code below the first set is from my contact form and the second is the function, it is a function that is passed a form variable in the form of an array and is also passed a form title variable. Everything worked fine this morning but when I checked the functionality of it a few hours ago the mail function wasn't sending, although the logic was working. I checked my spam filter and the emails weren't held up there. Code: [Select] require('../php_classes/TrueViewI.php'); include('../php_functions/functions.php'); if(isset($_POST['submit'])) { $error_message = processFormData($_POST, 'Home Inspections'); if($error_message == 'Thank you, someone will contact you shortly.') { session_unset(); } } //future $keywords = ''; //future $meta_tags = ''; //future $left_column = ''; $middle_column = '<img class="page_heading" src="../images/contactus.png" alt="True View Service Home Inspections Contact Us" /> <form method="post" action=""> <fieldset id="contactform"> <!-- <legend>Home Inspections Contact Form</legend> --> <h4>Home Inspections Contact Form</h4> <span class="errors">'.(!empty($error_message) ? $error_message : '').'</span> <div class="row_div"> <div class="label_div"> <label>First Name:</label> <!-- <span class="required">* </span> --> </div> <div class="input_div"> <input name="First Name" type="text" maxlength="50" size="50" value="'. (!empty($_SESSION['First_Name']) ? $_SESSION['First_Name'] : '').'" /> </div> </div> <div class="row_div"> <div class="label_div"> <label>Last Name:</label> <!-- <span class="required">* </span> --> </div> <div class="input_div"> <input name="Last Name" type="text" maxlength="50" size="50" value="'. (!empty($_SESSION['Last_Name']) ? $_SESSION['Last_Name'] : '').'" /> </div> </div> <div class="row_div"> <div class="label_div"> <label>Phone Number:</label> <!-- <span class="required">* </span> --> </div> <div class="input_div"> <input name="Phone Number" type="text" maxlength="50" size="50" value="'. (!empty($_SESSION['Phone_Number']) ? $_SESSION['Phone_Number'] : '').'" /> </div> </div> <div class="row_div"> <div class="label_div"> <label>Email Address:</label> <!-- <span class="required">* </span> --> </div> <div class="input_div"> <input name="Email Address" type="text" maxlength="50" size="50" value="'. (!empty($_SESSION['Email_Address']) ? $_SESSION['Email_Address'] : '').'" /> </div> </div> <div class="row_div"> <div class="label_div"> <label>Renovation Address:</label> <!-- <span class="required">* </span> --> </div> <div class="input_div"> <input name="Renovation Address" type="text" maxlength="50" size="50" value="'. (!empty($_SESSION['Renovation_Address']) ? $_SESSION['Renovation_Address'] : '').'" /> </div> </div> <div class="row_div"> <div class="label_div"> <label>Age of Home:</label> <!-- <span class="required">* </span> --> </div> <div class="input_div"> <select name="Age Of Home" class="input"> <option value="">--Choose One--</option> <option value="0-10"'. ((!empty($_SESSION['Age_Of_Home']) && ($_SESSION['Age_Of_Home'] == '0-10')) ? ' selected="selected" ' : ''). '>0 to 10 years old</option> <option value="11-20"'. ((!empty($_SESSION['Age_Of_Home']) && ($_SESSION['Age_Of_Home'] == '11-20')) ? ' selected="selected" ' : ''). '>11 to 20 years old</option> <option value="21-30"'. ((!empty($_SESSION['Age_Of_Home']) && ($_SESSION['Age_Of_Home'] == '21-30')) ? ' selected="selected" ' : ''). '>21 to 30 years old</option> <option value="31-40"'. ((!empty($_SESSION['Age_Of_Home']) && ($_SESSION['Age_Of_Home'] == '31-40')) ? ' selected="selected" ' : ''). '>31 to 40 years old</option> <option value="41-50"'. ((!empty($_SESSION['Age_Of_Home']) && ($_SESSION['Age_Of_Home'] == '41-50')) ? ' selected="selected" ' : ''). '>41 to 50 years old</option> <option value="50+"'. ((!empty($_SESSION['Age_Of_Home']) && ($_SESSION['Age_Of_Home'] == '50+')) ? ' selected="selected" ' : ''). '>More than 50 years old</option> </select> </div> </div> <div class="row_div"> <div class="label_div"> <label>Square Footage of Home:</label> <!-- <span class="required">* </span> --> </div> <div class="input_div"> <select name="Square Footage Of Home" class="input"> <option value="">--Choose One--</option> <option value="1000-1500"'. ((!empty($_SESSION['Square_Footage_Of_Home']) && ($_SESSION['Square_Footage_Of_Home'] == '1000-1500')) ? ' selected="selected" ' : ''). '>1000 to 1500 square feet</option> <option value="1501-2000"'. ((!empty($_SESSION['Square_Footage_Of_Home']) && ($_SESSION['Square_Footage_Of_Home'] == '1501-2000')) ? ' selected="selected" ' : ''). '>1501 to 2000 square feet</option> <option value="2001-2500"'. ((!empty($_SESSION['Square_Footage_Of_Home']) && ($_SESSION['Square_Footage_Of_Home'] == '2001-2500')) ? ' selected="selected" ' : ''). '>2001 to 2500 square feet</option> <option value="2501-3000"'. ((!empty($_SESSION['Square_Footage_Of_Home']) && ($_SESSION['Square_Footage_Of_Home'] == '2501-3000')) ? ' selected="selected" ' : ''). '>2501 to 3000 square feet</option> <option value="3000+"'. ((!empty($_SESSION['Square_Footage_Of_Home']) && ($_SESSION['Square_Footage_Of_Home'] == '3000+')) ? ' selected="selected" ' : ''). '>More than 3000 square feet</option> </select> </div> </div> <div class="row_div"> <div class="label_div"> <label>Are you buying or selling?:</label> <!-- <span class="required">* </span> --> </div> <div class="input_div"> <select name="Buying Or Selling" class="input"> <option value="">--Choose One--</option> <option value="Buying"'.((!empty($_SESSION['Buying_Or_Selling']) && ($_SESSION['Buying_Or_Selling'] == 'Buying')) ? ' selected="selected" ' : '').'>Buying</option> <option value="Selling"'.((!empty($_SESSION['Buying_Or_Selling']) && ($_SESSION['Buying_Or_Selling'] == 'Selling')) ? ' selected="selected" ' : '').'>Selling</option> </select> </div> </div> <div class="row_div"> <div class="label_div"> <label>Preferred Date and Time for Inspection:</label> <!-- <span class="required">* </span> --> </div> <div class="input_div"> <input name="Preferred Date and Time for Inspection" type="text" maxlength="50" size="50" value="'. (!empty($_SESSION['Preferred_Date_and_Time_for_Inspection']) ? $_SESSION['Preferred_Date_and_Time_for_Inspection'] : '').'" /> </div> </div> <div class="row_div"> <div class="label_div"> <label>Comments or Questions:</label> <!-- <span class="required">* </span> --> </div> <div class="input_div"> <textarea name="Comments or Questions" type="text" rows="10">'. (!empty($_SESSION['Comments_or_Questions']) ? $_SESSION['Comments_or_Questions'] : '').'</textarea> </div> </div> <div class="row_div"> <input id="button" name="submit" type="submit" value="Send Message" /> </div> </fieldset> </form>'; $contact = new TrueViewI('True View Services Inspections - Contact Us', '../css/styles.css', NULL, NULL, 7, 1, 1); $contact->setContent('middle_col_content', $middle_column); $contact->display_page(); Code: [Select] function processFormData($array, $form) { $errors = NULL; $message = NULL; foreach($array as $key => $value) { //if any of the form values are empty catch them and add to error array if(empty($value) && $key != 'submit') { //build error list $errors .= '"' . str_replace('_', ' ', $key) . '" is a required field!<br />'; } else if(!empty($value) && $key != 'submit') { //capture values and insert them into a session variable $_SESSION[$key] = $value; } } if(empty($errors)) { mail('tinwakr@bell.net', $form, str_replace('_', ' ', $message)); return 'Thank you, someone will contact you shortly.'; } else { return $errors; } } Hi all Basically, I have a form which when done will calculate a quote for turf for given areas. Basically each time the user specifies an area it goes into an array, and they can add as many as they want, but the problem seems to be once submitted and it arrives back into the program, it isn't decoding so the multidimensional array is lost. What am I doing wrong here? Full code below, thanks in advance Ste Code: [Select] <?php // Framework // Get the sections $sections_array = base64_decode(unserialize($_POST['sections'])); // Build the rest of the array foreach ($sections_array as $section) { $sections[] = base64_decode(unserialize($section)); } // Set the initial unit $units = $_POST['units']; // Do the new add if ($_POST['a'] == 'add_section') { // Add the new measure if ((is_numeric($_POST['width'])) && (is_numeric($_POST['length']))) { $sections[] = array('length' => $_POST['length'], 'width' => $_POST['width']); } } // Build the output foreach ($sections as $section) { $output .= '<strong>'.$section['width'].' wide</strong> x <strong>'.$section['length'].' long</strong><br />'; $sections_array = base64_encode(serialize($section)); } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Untitled Document</title> <style type="text/css"> body,td,th { font-family: Verdana, Geneva, sans-serif; font-size: 11px; } body { margin-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; } .wrap { text-align: center; height: 350px; width: 410px; padding: 0 10px; } </style> </head> <body> <div class="wrap"> <h2>Turf Calculator</h2> <p>To begin, enter the width and length of the first area of garden you wish to turf. You can keep adding sections to work out the final quantity required.</p> <p><?php echo $output; ?></p> <form id="form1" name="form1" method="post" action=""> <table width="0" border="0" cellspacing="0" cellpadding="2"> <tr> <td>Length:</td> <td><input type="text" name="length" id="length" /></td> </tr> <tr> <td>Width:</td> <td><input type="text" name="width" id="width" /></td> </tr> <?php if ($units == '') { ?> <tr> <td>Units:</td> <td><select name="units" id="units"> <option value="feet">Feet</option> <option value="m" selected="selected">Metres</option> <option value="yards">Yards</option> </select></td> </tr> <?php } ?> </table> <p> <input type="submit" name="add" id="add" value="Add This Section" /> <input name="a" type="hidden" id="a" value="add_section" /> <input name="sections" type="hidden" id="sections" value="<?php echo base64_encode(serialize($sections_array)); ?>" /> <?php if ($units != '') { ?> <input name="units" type="hidden" id="units" value="<?php echo $units; ?>" /> <?php } ?> </p> </form> <p> </p> </div> </body> </html> I know this is probably a missing curly bracket or some other syntax, but I can't seem to spot it, anyone see it? i get this error btw. Parse error: syntax error, unexpected $end in C:\Program Files\xampp\htdocs\cameo\login.php on line 39 <?php session_start(); //sql variables $server = "localhost"; $user = "root"; $pass = ""; $db = "cameo"; //iff user isn't logged in, try to log them in if(!isset($_SESSION['username'])){ if(isset($_POST['submit'])){ //connect to database $dbc = mysqli_connect($server, $user, $pass, $db); //grab entered form data $user_username = mysqli_real_escape_string($dbc, trim($_POST['username'])); $user_password = mysqli_real_escape_string($dbc, trim($_POST['username'])); //if both username and password are entered then find a match in the database if((!empty($user_username)) && (!empty($user_password))) { //look up the username and password in the database $query = "SELECT username FROM cameo WHERE username = '$user_username' AND '$user_password'"; $data = mysqli_query($dbc, $query); //authenticate if data matches a row if(mysqli_num_rows($data) == 1){ //login is okay $row = mysqli_fetch_array($data); $_SESSION['username'] = $row['username']; $_SESSION['is_admin'] = $row['is_admin']; header('Location:index.php'); } else { //username and password are incorrect or missing, so send a message $error_msg = 'Sorry, you must enter a valid username and password to log in.'; } } } ?> Hi, could someone please tell me why I'm getting an unexpected { error in the following code. I have went over it several times and everything seems to be matching. Code: [Select] <?php require_once("functions.php"); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <body> <?php DatabaseConnection(); $query= "SELECT * FROM treats"; $result_set= mysql_query($query); /*if( $result_set = mysql_query($query) ) { while( $products = mysql_fetch_row($result_set) ) { echo $products[0]; echo $products[1]; echo $products[2]; echo $products[3]; echo $products[4]; echo "<img src=\"{$products[5]}\">"; // assuming this is where the image url is } } //print_r(mysql_fetch_row($result_set));*/ $output = "<table>"; while($row = mysql_fetch_array($result)) { $productDetail1['product_id']; $productDetail2['product_title']; $productDetail3['product_Description']; $productDetail4['price']; $productDetail5['product_pic']; $output .= (" <tr> <td>".$productDetail1['product_id'] ."</td> </tr> ") } $output .= "</table>"; ?> </body> </html> hello i keep getting an error Parse error: syntax error, unexpected $end in /home/cookbook/public_html/cookbook.php on line 144 can someplease explain it to me? here is the code [list type=decimal] [li][/li] [li][/li] [/list]<?php //include("include/session.php"); @session_start(); // Start_session, check if user is logged in or not, and connect to the database all in one included file include_once("scripts/checkuserlog.php"); // Include the class files for auto making links out of full URLs and for Time Ago date formatting include_once("wi_class_files/autoMakeLinks.php"); include_once ("wi_class_files/agoTimeFormat.php"); // Create the two objects before we can use them below in this script $activeLinkObject = new autoActiveLink; $myObject = new convertToAgo; ?> <?php // Include this script for random member display on home page include_once "scripts/homePage_randomMembers.php"; ?> <?php $sql_blabs = mysql_query("SELECT id, mem_id, the_blab, blab_date FROM blabbing ORDER BY blab_date DESC LIMIT 30"); $blabberDisplayList = ""; // Initialize the variable here while($row = mysql_fetch_array($sql_blabs)){ $blabid = $row["id"]; $uid = $row["mem_id"]; $the_blab = $row["the_blab"]; $notokinarray = array("fag", "gay", "shit", "fuck", "stupid", "idiot", "asshole", "cunt", "douche"); $okinarray = array("sorcerer", "grey", "shug", "farg", "smart", "awesome guy", "asshole", "cake", "dude"); $the_blab = str_replace($notokinarray, $okinarray, $the_blab); $the_blab = ($activeLinkObject -> makeActiveLink($the_blab)); $blab_date = $row["blab_date"]; $convertedTime = ($myObject -> convert_datetime($blab_date)); $whenBlab = ($myObject -> makeAgo($convertedTime)); //$blab_date = strftime("%b %d, %Y %I:%M:%S %p", strtotime($blab_date)); // Inner sql query $sql_mem_data = mysql_query("SELECT id, username, firstname, lastname FROM myMembers WHERE id='$uid' LIMIT 1"); //die($sql_mem_data); while($row = mysql_fetch_array($sql_mem_data)){ $uid = $row["id"]; $username = $row["username"]; $firstname = $row["firstname"]; if ($firstname != "") {$username = $firstname; } // (I added usernames late in my system, this line is not needed for you) /////// Mechanism to Display Pic. See if they have uploaded a pic or not ////////////////////////// $ucheck_pic = "members/$uid/image01.jpg"; $udefault_pic = "members/0/image01.jpg"; if (file_exists($ucheck_pic)) { $blabber_pic = '<div style="overflow:hidden; width:40px; height:40px;"><img src="' . $ucheck_pic . '" width="40px" border="0" /></div>'; // forces picture to be 100px wide and no more } else { $blabber_pic = "<img src=\"$udefault_pic\" width=\"40px\" height=\"40px\" border=\"0\" />"; // forces default picture to be 100px wide and no more } $blabberDisplayList .= ' <table width="100%" align="center" cellpadding="4" bgcolor="#CCCCCC"> <tr> <td width="7%" bgcolor="#FFFFFF" valign="top"><a href="profile.php?id=' . $uid . '">' . $blabber_pic . '</a> </td> <td width="93%" bgcolor="#EFEFEF" style="line-height:1.5em;" valign="top"><span class="greenColor textsize10">' . $whenBlab . ' <a href="profile.php?id=' . $uid . '">' . $username . '</a> said: </span><br /> ' . $the_blab . '</td> </tr> </table>'; } } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /> <meta name="Description" content="Web Intersect is a deft combination of powerful free open source software for social networking, mixed with insider guidance and tutorials as to how it is made at its core for maximum adaptability. The goal is to give you a free website system that has a network or community integrated into it to allow people to join and interact with your website when you have the need." /> <meta name="Keywords" content="web intersect, how to build community, build social network, how to build website, learn free online, php and mysql, internet crossroads, directory, friend, business, update, profile, connect, all, website, blog, social network, connecting people, youtube, myspace, facebook, twitter, dynamic, portal, community, technical, expert, professional, personal, find, school, build, join, combine, marketing, optimization, spider, search, engine, seo, script" /> <title>CookBookers</title> <link href="style/main.css" rel="stylesheet" type="text/css" /> <link rel="icon" href="favicon.ico" type="image/x-icon" /> <link rel="shortcut icon" href="favicon.ico" type="image/x-icon" /> <script src="js/jquery-1.4.2.js" type="text/javascript"></script> <style type="text/css"> #Layer1 { height:210px; background-image: url(images/top_container_bg_recipes_new.gif); } body { background-color: #3c60a4; } </style> </head> <body> <?php include_once "header_template.php"; ?> <center> <table cellpadding="0px" cellspacing="0px" style="border:0px solid #666666;" width="950"> <tr> <td> <table width="95%" height="22" border="0" align="center" cellpadding="10" cellspacing="0" style="background-color:#F2F2F2; border:0px solid #666666;"> <tr> <td style="padding-left:45px;"> <?php //die($_SESSION['username']); $qryUsers = "SELECT * from recipies WHERE user='".$_SESSION['username']."'"; //die($qryUsers); $rsUsers = @mysql_query($qryUsers) or die(mysql_error()); ?> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="16%"><h3>All Recipies of </h3></td> <td width="84%"><h3><?php print $_SESSION['username']; ?></h3></td> </tr> <tr> <td> </td> <td> </td> </tr> </table> <?php while($rowUsers = @mysql_fetch_object($rsUsers)) { ?> <?php print"<h3>Public Recipes</h3><br>"; $qryUsers = "SELECT * from recipies WHERE user='".$_SESSION['username']."'"; print"<ol>"; $rsUsers = @mysql_query($qryUsers) or die(mysql_error()); if( @mysql_num_rows($rsUsers)>0 ) { while($rowUsers = @mysql_fetch_object($rsUsers) ) { print "<li style='margin:5px 0px;'><a href=description.php?Rid=".$rowUsers->Rid.">".$rowUsers->title."</a></li>"; } } print"</ol>"; ?> </td> </tr> </table> </td> </tr> <tr> </td> </tr> </table> </center> <?php include_once "footer_template.php"; ?> </body> </html> Hi, could someone please tell me why I'm getting unexpected $end error in the following code? <?php function documentType(){ echo <<<HEREDOC <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" ` ` "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> } HEREDOC; ?> Just trying to do a basic query... not working and don't know why: here is inserts.php: <?php $username="wormste1_barry"; $password="barry"; $database="wormste1_barry"; $CarName=$_POST['CarName']; $CarTitle=$_POST['CarTitle']; $CarPrice=$_POST['CarPrice']; $CarMiles=$_POST['CarMiles']; $CarDescription=$_POST['CarDescription']; mysql_connect(localhost,$username,$password); @mysql_select_db($database) or die( "Unable to select database"); $query = "INSERT INTO tablename VALUES ('','$CarName','$CarTitle','$CarPrice','$CarMiles','$CarDescription'); mysql_query($query); mysql_close(); ?> That parses the simple form of : form.html: <HTML> <HEAD> </HEAD> <BODY> <form action="inserts.php" method="post"> car Name: <input type="text" name="CarName"><br> Car Title: <input type="text" name="CarTitle"><br> Car Price: <input type="text" name="CarPrice"><br> Car Miles: <input type="text" name="CarMiles"><br> Car Description: <input type="text" name="CarDescription"><br> <input type="Submit"> </form> </BODY> </HTML> I get the error: Parse error: syntax error, unexpected $end in /home/wormste1/public_html/tilburywebdesign/shop/FTPServers/barryottley/showroom/inserts.php on line 23 Don't know whats wrong? Am I blind? I don't see the problem with this code. It says: Parse error: syntax error, unexpected '}' in /data/21/2/40/160/2040975/user/2235577/htdocs/edit_user1.php on line 35 Code: [Select] <html> <body> <?php if ( (isset($_GET['id'])) && (is_numeric($_GET['id'])) ) { $id = $_GET['id']; } elseif ( (isset($_POST['id'])) && (is_numeric($_POST['id'])) ) { $id = $_POST['id']; } else { echo 'you have reached this page in error. no variable passed'; exit(); } // that was the part to check for passed variables. This is what does something with it require ('databaseconnect.php'); if (isset($_POST['submitted'])) { $errors = array(); } if (empty($_POST['scientific name'])) { $errors[] = 'you did not enter a scientific name' } else { $sn = escape_data($_POST['scientific_name']); } // now the common name if (empty($_POST['common_name_english'])) { $errors[] = 'you did not enter a common name' } else { $cn = escape_data($_POST['scientific_name_english']); } // now make changes if (empty($errors)) { $query = "UPDATE table SET plant_name='$id', scientific_name='$sn', common_name_english='$cn' WHERE plant_name=$id"; $result = $mysql_query ($query); if (mysql_affected_row() == 1) { echo 'edit a plant<br> The plant has edited' } else { echo 'system error<br> the plant could not be edited due to a system error.'; echo mysql_error() . 'query:' . $query ; exit(); } } else { echo 'error<br> something already insystem or did not work.'; } } else { echo 'error<br>'; foreach ($errors as $msg) { echo " - $msg<br>"; } echo ' please try again'; } // end of if } // endo of submit condition // always show form $query = "SELECT scientific_name, Common_name_english FROM table WHERE plant_name=$id"; $result = $mysql_query ($query); if(mysql_num_rows($result) == 1) { $row mysql fetch_array ($result); echo 'edit a user' <form action="edit_user1.php" method="post"> scientific name: <input type="text" name="scientific_name" size="45" value="' . $row[scientific_name] . '"><br> common name: <input type="text" name="common_name_english" size="45" value="' . $row[common_name_english] . '"><br> <input type="submit" name="submit" value="submit" /><br> <input type="hidden" name="submitted" value="TRUE" /> <input type="hidden" name="id" value="' . $id . '"/> </form>'; } else { echo 'page error'; } mysql_close(); </body> </html> Upon running my code online I receive the following error: Parse error: syntax error, unexpected ';' in /home/a4542527/public_html/create.php on line 13 indicating that the semicolon (to the right of or die(mysql_error())) in the following code is in error: create.php <?php include 'connection.php'; $name= $_Post['inputName']; $descrip= $_Post['inputDesc']; if(!$_Post['submit']){ echo "Please fill out the review"; header('Location: index.php'); } else{ mysql_query("INSERT INTO people (`id`,`name`,`descrip`) VALUES(NULL, '$name', '$descrip')" or die(mysql_error()); echo "Your review has been added"; header('Location: index.php'); } ?> If I remove this semicolon and run the code, I receive this error: Parse error: syntax error, unexpected T_ECHO in /home/a4542527/public_html/create.php on line 14 I'm not sure what I'm doing wrong. (When this script runs it allows for two text boxes to be displayed. After text is entered and submitted, the said text will be displayed on the screen. Below are the two other associated files that I'm using.) index.php <?php include 'connection.php'; $query = "SELECT * FROM people"; $result = mysql_query($query) or die(mysql_error()); while ($person = mysql_fetch_array($result)){ echo $person ['name']; echo $person ['descrip']; } ?> connection.php <?php $dbhost = 'mysql7.000webhost.com'; $dbuser = 'a4542527_root'; $dbpass = '*******'; $db = 'a4542527_test1'; $conn = mysql_connect($dbhost,$dbuser,$dbpass); mysql_select_db($db); ?> Thank-you in advance for any help or pointer in the right direction. ~Matty Wondering what the heck is wrong with it, worked before i varied the error messages, had a pal check it out, he couldn't really spot anything wrong either, obviously were both being blind at what is missing, if someone would be kind enough to explain the segment of code that's causing the error is below. if ($amount < 1);echo "You must enter the number of troops you wish to hire.";exit;}else{ if ($amount > $maxdef);echo "You cannot hire over your housing limit.";exit;}else{if ($amount = "");echo "You must enter the number of troops you wish to hire.";exit;else if ($HireCost > $CashOnHand);echo "You do not have enough cash on hand to hire these troops.";exit;() Hi, i am getting the following error message, but everything seems ok in script... Parse error: syntax error, unexpected ';' in /www/zxq.net/htdocs/admin/includes/functions.php on line 27 This is the code snippet: function addCat($cName, $cDesc) { $query = mysql_query("INSERT INTO categories VALUES(null,'$cName','$cDesc')") or die(mysql_error()); } Hi, I have a basic php code that allows the user to search and display data from a database. I have searched and searched the entire code for errors, but I cannot find any. When I try to run the code (do a search) it gives me this error: Parse error: syntax error, unexpected T_LNUMBER, expecting ',' or ';' on line 99 This is my line 99: echo ' <a href="'.$_SERVER['PHP_SELF']."?s=$news&q=$var\">Next 10 >></a>"; and this is my whole code: <?php // Get the search variable from URL $var = @$_GET['q'] ; $trimmed = trim($var); //trim whitespace from the stored variable // rows to return $limit=10; // check for an empty string and display a message. if ($trimmed == "") { echo "<p>Please enter a search...</p>"; exit; } // check for a search parameter if (!isset($var)) { echo "<p>We dont seem to have a search parameter!</p>"; exit; } //connect to your database ** EDIT REQUIRED HERE ** mysql_connect("localhost","xxxxxx","xxxxx"); mysql_select_db("xxxxxx") or die("Unable to select database"); // Build SQL Query $query = "SELECT lastname, firstname, state, zip, jobtype, otherjobtype, nightavail, weekendavail, ptft, objective, resume FROM data WHERE jobtype LIKE '%" . $trimmed . "%' ORDER BY lastname"; $numresults=mysql_query($query); $numrows=mysql_num_rows($numresults); // If we have no results, offer a google search as an alternative if ($numrows == 0) { echo "<h4>Results</h4>"; echo "<p>Sorry, your search: "" . $trimmed . "" returned zero results</p>"; echo "<p><a href='http://www.google.com/search?q=". $trimmed . "' target='_blank' title='Look up " . $trimmed . " on Google'>Click here</a> to try the search on google</p>"; } // next determine if s has been passed to script, if not use 0 if (empty($s)) { $s=0; } // get results $query .= " limit $s,$limit"; $result = mysql_query($query) or die("Couldn't execute query"); // display what the person searched for echo "<p>You searched for: "" . $var . ""</p>"; // begin to show results set echo "Results"; $count = 1 + $s ; // now you can display the results returned while ($row= mysql_fetch_array($result)) { $title = $row["1st_field"]; echo "$count.) $title" ; $count++ ; } $currPage = (($s/$limit) + 1); //break before paging echo "<br />"; // next we need to do the links to other results if ($s>=1) { $prevs=($s-$limit); print ' <a href="'.$_SERVER['PHP_SELF'].'?s=$prevs&q=$var"><< Prev 10</a>  '; } // calculate number of pages needing links $pages=intval($numrows/$limit); // $pages now contains int of pages needed unless there is a remainder from division if ($numrows%$limit) { // has remainder so add one page $pages++; } // check to see if last page if (!((($s+$limit)/$limit)==$pages) && $pages!=1) { // not last page so give NEXT link $news=$s+$limit; echo ' <a href="'.$_SERVER['PHP_SELF']."?s=$news&q=$var\">Next 10 >></a>"; } $a = $s + ($limit) ; if ($a > $numrows) { $a = $numrows ; } $b = $s + 1 ; echo "<p>Showing results $b to $a of $numrows</p>"; ?> I am completely new to php. If anyone could give me a hint I'd greatly appreciate it... Any idea why I'm getting this error? Line of code producing error: if( !isset($this->message) OR !isset($this->subject) ){ |