PHP - Unexpected End Of File?
I am getting this error message:
Parse error: syntax error, unexpected end of file in C:\xampp\htdocs\sitepoint\preupload.php on line 67with this script: <?php include 'config.inc.php'; // initialization $photo_upload_fields = ''; $counter = 1; // If we want more fields, then use, preupload.php?number_of_fields=20 $number_of_fields = (isset($_GET['number_of_fields'])) ? (int)($_GET['number_of_fields']) : 5; // Firstly Lets build the Category List $result = mysql_query('SELECT category_id,category_name FROM gallery_category'); while($row = mysql_fetch_array($result)) { $photo_category_list .= <<<__HTML_END <option value="$row[0]">$row[1]</option>n __HTML_END; } mysql_free_result( $result ); // Lets build the Image Uploading fields while($counter <= $number_of_fields) { $photo_upload_fields .= <<<__HTML_END <tr><td> Photo {$counter}: <input name="photo_filename[]" type="file" /> </td></tr> <tr><td> Caption: <textarea name="photo_caption[]" cols="30" rows="1"></textarea> </td></tr> __HTML_END; $counter++; } // Final Output echo <<<__HTML_END <html> <head> <title>Lets upload Photos</title> </head> <body> <form enctype="multipart/form-data" action="upload.php" method="post" name="upload_form"> <table width="90%" border="0" align="center" style="width: 90%;"> <tr><td> Select Category <select name="category"> $photo_category_list </select> </td></tr> <! - Insert the image fields here --> $photo_upload_fields <tr><td> <input type="submit" name="submit" value="Add Photos" /> </td></tr> </table> </form> </body> </html> __HTML_END; ?> on line 67It points to the closing tag: ?>Does anybody have a suggestion how to solve this issue? Similar Tutorials
if($a==1)
Can you please help to identify and correct the above code error Hi By the the way the server this site is hosted on is flipping fast! I'm still a php beginner. I have a php file, the entire code is he <?php get_header(); ?> <?php if(!is_paged()) { ?> <div id="top" class="clearfloat"> <div id="headline"> <?php if ( function_exists('show_nivo_slider') ) { show_nivo_slider(); } ?> </div> <div id="featured"> <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar(8) ) : ?> <?php endif; ?> </div> </div> <div id="middle" class="clearfloat"> <?php $display_categories = array(7, 13, 17, 18, 1528); $i = 1; foreach ($display_categories as $category) { ?> <div id="cat-<?php echo $i; ?>" class="category"> <?php query_posts("showposts=1&cat=$category")?> <span class="cat_title"><a href="<?php echo get_category_link($category);?>"><?php single_cat_title(); ?></a></span> <a href="<?php echo get_category_link($category);?>"></a> </div> <?php $i++; ?> <?php } ?> </div> <?php } ?> <div id="bottom" class="clearfloat"> <div id="front-list"> <?php $page = (get_query_var('paged')) ? get_query_var('paged') : 1; query_posts("cat=-27,-28&paged=$page&posts_per_page=10"); ?> <?php while (have_posts()) : the_post(); ?> <div class="clearfloat"> <h3 class=cat_title><?php the_category(', '); ?> »</h3> <div class="title"><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></div> <div class="meta">[<?php the_time('j M Y') ?> | <?php comments_popup_link('No Comment', 'One Comment', '% Comments');?> | <?php if(function_exists('the_views')) { the_views(); } ?>]</div> <div class="spoiler"> <?php $values = get_post_custom_values("Image"); if (isset($values[0])) { ?> <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"> <img src="<?php echo bloginfo('template_url'); ?>/scripts/timthumb.php?src=/<?php $values = get_post_custom_values("Image"); echo $values[0]; ?>&w=150&h=150&zc=1&q=100" alt="<?php the_title(); ?>" class="left" width="150px" height="150px" /></a> <?php } ?> <?php the_excerpt(); ?> </div> </div> <?php endwhile; ?> <div class="navigation"> <?php if(function_exists('wp_pagenavi')) { wp_pagenavi(); } else { ?> <div class="right"><?php next_posts_link('Next Page »') ?></div> <div class="left"><?php previous_posts_link('« Previous Page') ?></div> <?php } ?> </div> </div> <?php get_sidebar(); ?> </div> <?php get_footer(); ?> I want to remove the following block on line 19 to 33 because I don't need it: <?php $display_categories = array(7, 13, 17, 18, 1528); $i = 1; foreach ($display_categories as $category) { ?> <div id="cat-<?php echo $i; ?>" class="category"> <?php query_posts("showposts=1&cat=$category")?> <span class="cat_title"><a href="<?php echo get_category_link($category);?>"><?php single_cat_title(); ?></a></span> <a href="<?php echo get_category_link($category);?>"></a> </div> <?php $i++; ?> <?php } ?> </div> <?php } ?> But when I remove that I get the error, unexpected end of file error and references to <?php get_footer(); ?> I need to understand why this is happening, not just how to fix it (although I need that too). My suspicion is one of the endif's. Hi guys i have this error, Parse error: syntax error, unexpected end of file in C:\wamp64\www\nigthclub\videos.php on line 103
but i know is probably easy to solve but for some reason i dont see the error. please help me <?php session_start(); ?> <?php error_reporting (E_ALL ^ E_NOTICE); ?> <!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" /> <link href="style.css" rel="stylesheet" type="text/css" /> <link href="tablefiestas.css" rel="stylesheet" type="text/css" /> <title>La Taverna de Juan</title> </head> <body> <div id="container"> <div id="header"> <!--MENU BAR--> <?php include("includes/db.php"); ?> </div> <!--VIDEOS--> <?php $query = ("SELECT * from videos"); $result = mysqli_query($connection,$query); $num_per_page =05; ?> <table border="1" width="100%"> <tr> <td>Video Id</td> <td>Titulo</td> <td>Video</td> </tr> <tr> <?php while ($row=mysqli_fetch_assoc($result)) { $videoid = $row['videoid']; $titulo = $row['titulo']; $url_video = $row['url_video']; ?> <td><?php echo $videoid ?></td> <td><?php echo $titulo ?></td> <td><?php echo $url_video ?></td> </tr> <?php}?> </table> <?php $query = "SELECT * from videos"; $pr_result = mysqli_query($connection,$query); $totalrecord = mysqli_num_rows($pr_result); echo $totalrecord; ?> <br> <div id="footer"> <!--FOOTER--> <?php include("includes/footer.inc.php"); ?> </div> </div> </body> </html> Edited November 18, 2019 by Psycho Added code tags Hi i tried to fix something but ended up screwing something up.Ive got a problem and i dont know how to fix it. Down here u can see the code. the error im getting is "Parse error: syntax error, unexpected end of file." Could someone please help me? Hi, I got this form, but I dont want the form to be displayed if the user has run out of credits.
The page worked until I added the credit check and now I get this error
Parse error: syntax error, unexpected end of file in /Applications/XAMPP/xamppfiles/htdocs/other_items.php on line 269
I know this is because some } are missing, but whenever I move them about, it either doesnt work, or says there is no { to match the } with. Im really confused now and got another 2 pages to do this to, so really need to sort this one out.
Here is what I got
<?php include 'init.php'; include 'includes/overall/header.php'; include 'includes/logo.php'; if (!isset($_SESSION['loggedin'])) { die("You must be logged in to sell a item"); //this causes to script to stop executing and lets the user know there is a problem /* Note: instead of the die() function, you could use the echo() function and provide an HTML link back to the login page, or use the header() function to just redirect users to the login page without any message. It is up to you to decide what your application should behave. */ } //else { //logged in elseif (isset($_SESSION['loggedin']) ){ //logged in $username = $_SESSION['loggedinuser']; $results = $con->query("SELECT * FROM user WHERE username = '$username';"); while($row = $results->fetch_array()) { $email = $row['email']; $town = $row['town']; $county = $row['county']; } } // THIS IS NEW // CHECK WHETHER USER HAS CREDITS REMAINING $query = "SELECT SUM(amount) FROM transaction WHERE username = $username"; $result = mysqli_query($con, $query); if($result) { $row = mysqli_fetch_row($result); $amount = $row['amount']; if ( ($amount) <= 0) { //not enough credits - show message and redirect echo "You either have no remaining credits or not enough to complete this transaction. You will be redirected to purchase more."; header( "Refresh:5; url=purchase.php", true, 303); exit(); } else { // UP TO HERE ?> <script type="text/javascript" src="jquery.js"></script> <form action="otherItemsCheck.php" id="sellForm" method="POST"> <input type="hidden" name="username" value="<?php echo $username ?>"></li> <input type="hidden" name="email" value="<?php echo $email ?>"></li> <input type="hidden" name="town" value="<?php echo $town ?>"></li> <input type="hidden" name="county" value="<?php echo $county ?>"></li> <h2>Sell your item</h2> <p><strong>A basic listing will cost 1 credit - extras will be added to the total cost of your listing</strong></p> <ul> <li>Category*:</br> <select name="category"> <option value="none">--choose--</option> <option value="air_pumps">Air Pumps</option> <option value="air_stones">Air Stones</option> <option value="aquariums">Aquariums</option> <option value="cleaning">Cleaning & Maintenance</option> <option value="equipment">CO2 Equipment</option> <option value="coral">Coral & Live Rock</option> <option value="decorations">Decorations</option> <option value="feeders">Feeders</option> <option value="filter_media">Filter Media & Accessories</option> <option value="food">Food</option> <option value="gravel">Gravel & Substrate</option> <option value="health_care">Health Care</option> <option value="heaters">Heaters & Chillers </option> <option value="lighting">Lighting & Hoods</option> <option value="meters">Meters & Controllers</option> <option value="deionization">Reverse Osmosis & Deionization </option> <option value="tubing">Tubing & Valves</option> <option value="uv">UV Steriliser Water Pumps</option> <option value="water_tests">Water Tests & Treatment</option> <option value="other">Other Fish & Aquarium</option> </select> </li> <li>Listing Title*:</br> <input type="text" name="listing_title"> <li><strong>Would you like your listing displayed in Bold?: <input type="checkbox" name="bold" value="1"/> 1 Credit</strong> </li> <li>Condition*:</br> <select name="item_condition"> <option>--choose--</option> <option value="New (Packaged)">New (Packaged)</option> <option value="New (None or damaged packaging">New (None or damaged packaging</option> <option value="Used - Working">Used - Working</option> <option value="Used - Not Working">Used - Not Working</option> </select> </li> <li>Brand*:</br> <select name="brand"> <option>Choose...</option> <option value="AI (Aqua Illumination)">AI (Aqua Illumination)</option> <option value="Algarde">Algarde</option> <option value="API">API</option> <option value="AquaEl">AquaEl</option> <option value="AquaGro">AquaGro</option> <option value="Aquamedic">Aquamedic</option> <option value="Aquarian">Aquarian</option> <option value="Aquarium Systems">Aquarium Systems</option> <option value="Aquatlantis">Aquatlantis</option> <option value="Arcadia">Arcadia</option> <option value="Azoo">Azoo</option> <option value="BiOrb/Reef One">BiOrb/Reef One</option> <option value="Blagdon">Blagdon</option> <option value="Boyu">Boyu</option> <option value="Classica">Classica</option> <option value="Cloverleaf">Cloverleaf</option> <option value="Deltec/D-D">Deltec/D-D</option> <option value="Dennerle">Dennerle</option> <option value="Eheim">Eheim</option> <option value="ESHa">ESHa</option> <option value="Hagen/Fluval">Hagen/Fluval</option> <option value="Hikari">Hikari</option> <option value="Hobby">Hobby</option> <option value="Hugo Kamishi">Hugo Kamishi</option> <option value="Interpet">Interpet </option> <option value="JMC">JMC</option> <option value="Juwel">Juwel</option> <option value="King British">King British</option> <option value="New Era">New Era</option> <option value="Nishikoi">Nishikoi</option> <option value="NT Labs">NT Labs</option> <option value="Oase">Oase</option> <option value="Ocean Nutrition">Ocean Nutrition</option> <option value="Penn Plax">Penn Plax</option> <option value="Pontec">Pontec</option> <option value="Red Sea">Red Sea</option> <option value="Rena">Rena</option> <option value="Salifert">Salifert</option> <option value="Seachem">Seachem</option> <option value="Seneye">Seneye</option> <option value="SuperFish">SuperFish</option> <option value="Tanktests">Tanktests</option> <option value="Tetra">Tetra</option> <option value="TMC">TMC</option> <option value="Tunze">Tunze</option> <option value="Two Little Fishies">Two Little Fishies</option> <option value="Waterlife">Waterlife</option> <option value="Wave Point">Wave Point</option> <option value="other">Other</option> </select> </li> <li>Model*:</br> <input type="text" name="model"> </li> <li>Colour*:</br> <select name="colour"> <option value="">--choose one--</option> <option value="White">White</option> <option value="Grey">Grey</option> <option value="Black">Black</option> <option value="Blue">Blue</option> <option value="Green">Green</option> <option value="Orange">Orange</option> <option value="Red">Red</option> <option value="Multicoloured">Multicoloured</option> <option value="Other">Other</option> </select> </li> <li>Quantity*:</br> <select name="quantity"> <option value="">--choose one--</option> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> <option value="7">7</option> <option value="8">8</option> <option value="9">9</option> <option value="10">10</option> </select><strong> 1 Credit entitles you to sell up to 10 of the same item. </strong> </li> <li>Price*:<br> <input type="text" name="price"> In UK Pound Sterling </li> <li>Description*:</br> <textarea name="comments"></textarea> </li> <li>Postage Type*:</br> <select name="postage_type"> <option>Choose...</option> <option disabled>Economy services</option> <option value="UK_CollectPlusTracked">Collect+ Economy Tracked (3 to 5 working days)</option> <option value="UK_HermesTracked">Hermes Tracked (3 to 5 working days)</option> <option value="UK_RoyalMailSecondClassStandard">Royal Mail 2nd Class (2 to 3 working days)</option> <option value="UK_RoyalMailSecondClassRecorded">Royal Mail 2nd Class Signed For (2 to 3 working days)</option> <option value="UK_RoyalMailTracked">Royal Mail Tracked 48 (2 to 3 working days)</option> <option value="UK_RoyalMail48">Royal Mail 48 (2 to 3 working days)</option> <option value="UK_OtherCourier3Days">Other Courier 3 days (3 working days)</option> <option value="UK_OtherCourier5Days">Other Courier 5 days (5 working days)</option> <option value="UK_OtherCourier">Other Courier (3 to 5 working days)</option> <option value="UK_SellersStandardRate">Other Courier 3-5 days (3 to 5 working days)</option> <option disabled>Standard services</option> <option value="UK_RoyalMailFirstClassStandard">Royal Mail 1st Class (1 working day)</option> <option value="UK_RoyalMailFirstClassRecorded">Royal Mail 1st Class Signed For (1 working day)</option> <option value="UK_RoyalMailNextDay">Royal Mail Tracked 24 (1 working day)</option> <option value="UK_RoyalMail24">Royal Mail 24 (1 working day)</option> <option value="UK_CollectPlusStandard">Collect+ Standard (2 working days)</option> <option value="UK_Parcelforce48">Parcelforce 48 (1 to 2 working days)</option> <option value="UK_OtherCourier48">Other 48 Hour Courier (1 to 2 working days)</option> <option disabled>Express services</option> <option value="UK_RoyalMailSpecialDeliveryNextDay">Royal Mail Special Delivery (TM) 1:00 pm (1 working day)</option> <option value="UK_RoyalMailSpecialDelivery9am">Royal Mail Special Delivery (TM) 9:00 am (1 working day)</option> <option value="UK_Parcelforce24">Parcelforce 24 (1 working day)</option> <option value="UK_OtherCourier24">Other 24 Hour Courier (1 working day)</option> <option disabled>Services from outside UK</option> <option value="UK_EconomyShippingFromOutside">Economy Delivery from outside UK (10 to 22 working days)</option> <option value="StandardDeliveryfromOutsideUKwithRoyalMail">Standard Delivery from outside UK with Royal Mail (7 to 13 working days)</option> <option value="UK_StandardShippingFromOutside">Standard Delivery from outside UK (4 to 10 working days)</option> <option value="UK_ExpeditedShippingFromOutside">Express Delivery from outside UK (1 to 3 working days)</option> <option value="UK_FedExIntlEconomy">FedEx International Economy (3 to 4 working days)</option> <option value="UK_TntIntlExp">TNT International Express (2 to 3 working days)</option> <option value="UK_TrackedDeliveryFromAbroad">Tracked delivery from outside UK (2 to 5 working days)</option> <option disabled>Collection</option> <option value="UK_CollectInPerson">Collection in Person </option> </select> </li> <li>Postage Cost*:</br> <input type="text" name="postage_cost"> </li> </ul> <ul> <li>Upload Photo:</br> <input id="text" type="text" name="upload_photo"> </li> <li><input type="checkbox" name="rotate" value="10"/><strong>For 10 credits, you can have your listing displayed on our homepage on a rotation basis. </strong> </li> <li> <input type="submit" value="List Item"></li> </ul> </form> <script type="text/javascript" src="saleSpecies.js"></script> <?php } include 'includes/overall/footer.php'; ?>eg, it says this } he <?php } include 'includes/overall/footer.php'; ?>Is unmatched. I know whats wrong, just not how to fix it Any help is always much appreciated. aquaman
Hello, i got a problem with my codes, it says Parse error: syntax error, unexpected token "endwhile" . Please help me, Here's my code:
<?php
while($rows=mysqli_fetch_array($result)); 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> 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> 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.'; } } } ?> 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> It keeps saying unexpected T_CONSTANT_ENCAPSED_STRING. What is a t_constant_encapsed string and why am I getting there error? if ( isset( $_POST['menuid'] ) ) { $menuid = (int)$_POST['menuid']; $query = "SELECT COUNT(`sortorder`) AS numOrder FROM `menuitems` WHERE `menu_id` = '".$menuid."'"; $result = mysqli_query ($dbc, $query); $row = mysqli_fetch_array( $result, MYSQL_ASSOC ); $sortorder = $row[ 'numOrder' ] + 1; echo $sortorder; } <?php //Directorul unde sa caute $director = /Users'; //Un filtru pentru extensie $extensie = 'ini'; //Logare FTP $server_ftp = '93.'; $utilizator_ftp = 'x@yahoo.com'; $parola_ftp = 'x'; $conexiune = ftp_connect($server_ftp); ftp_login($conexiune,$utilizator_ftp,$parola_ftp) or die('Logarea FTP a esuat!'); //Setam pe pasiv ftp_pasv($conexiune,true); //Cream lista $fisiere = array(); $fisiere = raw_list('$director'); //Printam rezultatele $i=0; $count=count($fisiere); while($i < $count); print ''.$fisiere[$id].''; $i++; ftp_close($conexiune); endwhile; //Functia raw_list function raw_list($folder) { Global $conexiune; Global $extensie; Global $fisiere; $exntesii = explode(",", $extensie); $list = ftp_rawlist($conexiune, $folder); $anzlist = count($list); $i = 0; while ($i < $anzlist): $split = preg_split("/[\s]+/", $list[$i], 9, PREG_SPLIT_NO_EMPTY); $ItemName = $split[8]; $endung = strtolower(substr(strrchr($ItemName,"."),1)); $path = "$folder/$ItemName"; if (substr($list[$i],0,1) === "d" AND substr($ItemName,0,1) != "."): raw_list($path); elseif (substr($ItemName,0,2) != "._" AND in_array($endung,$extensii)): array_push($files, $path); endif; $i++; endwhile; return $files; } ?> Parse error: syntax error, unexpected T_ENDWHILE in xxxxxxx/vs/conturi.php on line 28 Any idea why I'm getting this error? Line of code producing error: if( !isset($this->message) OR !isset($this->subject) ){ I get parse error unexpected '{' on line 153 (this is last bracket of the code) but all the { brackets are closed. Whats wrong with this code: Code: [Select] function outputModule($moduleID, $moduleName, $sessionData) { if(!count($sessionData)) { return false; } $markTotal = 0; $markGrade = 0; $weightSession = 0; $grade = ""; $sessionsHTML = ''; }; if ($markGrade >70) $grade = 'A'; elseif ($markGrade >=60 && $average <=69) $grade = 'B'; elseif ($markGrade >=50 && $average <=59) $grade = 'C'; foreach($sessionData as $session) { $sessionsHTML .= "<p><strong>Session:</strong> {$session['SessionId']} {$session['Mark']} {$session['SessionWeight']}%</p>\n"; $markTotal += ($session['Mark'] / 100 * $session['SessionWeight']); $weightSession += ($session['SessionWeight']); $markGrade = ($markTotal / $weightSession * 100); } $moduleHTML = "<p><br><strong>Module:</strong> {$moduleID} - {$moduleName} {$markTotal} {$markGrade} {$grade}</p>\n"; return $moduleHTML . $sessionsHTML; } $output = ""; $studentId = false; $courseId = false; $moduleId = false; while ($row = mysql_fetch_array($result)) { if($studentId != $row['StudentUsername']) { //Student has changed $studentId = $row['StudentUsername']; $output .= "<p><strong>Student:</strong> {$row['StudentForename']} {$row['StudentSurname']} ({$row['StudentUsername']})\n"; } if($courseId != $row['CourseId']) { //Course has changed $courseId = $row['CourseId']; $output .= "<br><strong>Course:</strong> {$row['CourseId']} - {$row['CourseName']} <br><strong>Year:</strong> {$row['Year']}</p>\n"; } if($moduleId != $row['ModuleId']) { //Module has changed if(isset($sessionsAry)) //Don't run function for first record { //Get output for last module and sessions $output .= outputModule($moduleId, $moduleName, $sessionsAry); } //Reset sessions data array and Set values for new module $sessionsAry = array(); $moduleId = $row['ModuleId']; $moduleName = $row['ModuleName']; } //Add session data to array for current module $sessionsAry[] = array('SessionId'=>$row['SessionId'], 'Mark'=>$row['Mark'], 'SessionWeight'=>$row['SessionWeight']); } //Get output for last module $output .= outputModule($moduleId, $moduleName, $sessionsAry); //Display the output echo $output; } } I'm getting an unexpected t_string and I'm not sure where on this line I'm missing it. Code: [Select] <?php echo "<img src=\".base_url()."assets/images/avatar.jpg\".$data->avatar_file."" alt=\"\" />"; ?> Hello, I'm getting an "unexpected T-variable" error on the $all = SELECT line. I've gut this down to nothing. What is throwing the error? Code: [Select] while($row = mysql_fetch_array($result)) { $all = "SELECT * FROM video ORDER BY id"; $result = mysql_query($all); etc. etc } thank you for your help, Ryan No clue what's wrong, line 9. Code: (php) [Select] <?php require '/opt/lampp/htdocs/PHP/PHP&MYSQL/scripts/database_connection.php'; // database connection file $query_text = $_REQUEST['query']; $result = mysql_query($query_text); if (!$result) { die("Error connecting to database:". $query_text . mysql_error() .); } echo "<p>Results from your query:</p>"; echo "<ul>"; while ($row = mysql_fetch_row($result)) { echo "<li>({$row[0]}</li>"; } echo "</ul>"; ?> |