PHP - Unexpected T_encapsed_and_whitespace
I haven't used PHP in a while. I'm getting "unexpected T_ENCAPSED_AND_WHITESPACE" on the second line of this:
Code: [Select] if(isset($_GET['name'], $_GET['organization'], $_GET['email'], $_GET['message'])){ mail('memzenator@gmail.com', 'maybearobot: '.$_GET['organization'], "Name: $_GET['name'] /n/n Return Email: $_GET['email'] /n/n $_GET['message']"); } Similar TutorialsCan anybody help me to echo a url? Id like to have Code: [Select] http://maps.google.com/maps/api/staticmap?zoom=15&size=400x400&markers=color:blue|label:EXAMPLE|SG1+4PP&sensor=false but to have the postcode as a variable which has been fetched from mysql Code: [Select] <!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> <?php include($_SERVER['DOCUMENT_ROOT'].'/include/db.php'); ?> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> <style type="text/css"> <!-- --> </style> <link href="header.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="banner"> <div id="bannerleft"></div> <div id="logo"></div> <div id="bannerright"><div id="navbar" title=""> <div id="b1"><p class="centre"><a href="index.html">Directory</a></p></div> <div id="b2"><p class="centre"><a href="business.html">Add Your Business</a></p></div> <div id="b3"><p class="centre"><a href="contact.html">Contact Us</a></p></div> </div><!-- end of navbar--> </div><!--end of bannerright--> </div><!-- end of banner--> <div id="listhold"> <?php $subtype = $_GET['subtype']; echo "<h1>$subtype</h1>"; $result = mysql_query("SELECT name, phone, email, WebAddress, postcode FROM business WHERE subtype ='$subtype' AND confirmed ='Yes' ORDER BY name"); echo mysql_error(); while($row = mysql_fetch_array($result)) { echo $row['name'] . "<br>"; echo $row ['phone'] . "<br>"; echo $row['email'] . "<br>"; echo $row['WebAddress'] . "<br>"; echo $row['postcode'] . "<br>" . "<br>"; echo "<a href='http://maps.google.com/maps/api/staticmap?zoom=15&size=400x400&markers=color:blue|label:EXAMPLE|.str_replace(' ','+',$row['postcode'])&sensor=false'>"; } ?> </div> </body> </html> The above returns an error; Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING Easy one i hope... Heres my array: echo "<TABLE CELLPADDING=0 CELLSPACING=0 WIDTH=100% BORDER=0>"; echo "<TR />"; echo "<TD WIDTH=30% VALIGN=TOP />"; echo " <IMG SRC=$row['CarPrice]/> "; <----- THIS IS LINE 66 THAT THE ERROR APPEARS ON!! echo "<br />"; echo "</TD>"; echo "<TD WIDTH=10 VALIGN=TOP />"; echo " "; echo "</TD>"; echo "<TD />"; echo "<font size=3 face=arial /><B >"; echo $row['CarPrice']; echo "</B><font size=2 face=arial />"; echo "<br />"; echo $row['CarTitle']; echo "<br />"; Have i encased the $row['photo'] properly? I'm getting: Quote unexpected T_ENCAPSED_AND_WHITESPACE Bull shit! Where?! echo "<B>Brand:</B> $row['brand']"; Hi Guys I have got a page generating the following error Error:Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/sites/trade-bidz.co.uk/public_html/functions/reg_functions.php on line 3 The offending code is below (I have removed some of the URL due to security. Code: [Select] <?php function getVehData(){ $file="https://www.cdlvis.com/lookup/getxml?username=***********&mode=test&key=*********&vrm=$_POST['veh_reg']"; $dom=new DOMdocument(); $dom->load($file); $xml=simplexml_import_dom($dom); echo('<tr><td>Make<td></td></tr> <tr><td>Model<td></td></tr> <tr><td>Make<td></td></tr> <tr><td>Date of Manufacture<td></td></tr> <tr><td>First Registered<td></td></tr> <tr><td>Colour<td></td></tr> <tr><td>Body<td></td></tr> <tr><td>No. of Doors<td></td></tr> <tr><td>Engine Size (cc)<td></td></tr> <tr><td>Fuel Type<td></td></tr> <tr><td>Gearbox Type<td></td></tr> <tr><td>Previous Owners<td></td></tr> <tr><td>BHP<td></td></tr> <tr><td>Emissions<td></td></tr> </table> '); } ?> I can't seem to figure this error out... Any help would be appreciated!! echo stripslashes($post['message']) . " --- stripslashes($post['username'])<br>\n" . " on stripslashes($post['time']) ."\n<hr width=90%>\n"; Basically, what I want it to say is: 'message' --- 'username' on 'time' With, of course, 'message', 'username', and 'time' filled in with the info from the database. Hi all, Does anybody can help me with this error...? I am trying create a simple form which insert data into mysql table called 'sample' Here is my code... Code: [Select] <?php $connection = mysql_connect("localhost","root", "123"); if(!$connection) { die("db connection error" .mysql_error()); } $db_select = mysql_select_db("project", $connection); if(!$db_select) { die("db select error" .mysql_error()); } $sql = "INSERT INTO sample (id,firstname,lastname,bio,gender) VALUES ('$_POST['ID_']','$_POST['firstname']','$_POST['lastname']','$_POST['bio']','$_POST['gender']')"; if(!$sql) { die('Error: ' . mysql_error()); } echo "1 record added"; ?> And every time I am getting this annoying error Quote Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in C:\wamp\www\project\process.php on line 19 and Line 19 is Code: [Select] ('$_POST['ID_']','$_POST['firstname']','$_POST['lastname']','$_POST['bio']','$_POST['gender']')"; Thanks in advance..! :-) I Can't find the problem. The code:
mysql_query("insert into games(week, fight, league_id)values($_REQUEST['week'],'$_REQUEST[home_team]-$_REQUEST[guest_team]',$_REQUEST['home_league'])", $Link);The error message: Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in F:\san\WEB\as-\menu.php on line 64 line 64 is : $kategoriler .= "<li><a href='index.php?MX=urundetay&kategori_id'=.$row_uruns['kategori_id']'>".$veri['baslik']."</a>\n"; where is wrong Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING $listhtml .= "<a href=\"$latest['cat_title']/$latest[haha]\" title=\"Details for $latest[haha]\">$latest[haha] ($date)</a>\n"; so this is the line it says this error is originating from. I dont know any php..if anyoen can help that would be great. Thanks in advance Hey Guys! I've been looking through my script to see what the problem could be, I've got a variable setup to generate a web page, I have no idea what could be the problem, I keep receiving the error: Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in home/path/etc on line 8 But I don't see any miss-matching Quotations etc... I don't know what the problem could be, maybe you could help me? Code: 1 <?php 2 $content = "<?php 3 $productid = 1; 4 $sql = 'SELECT * FROM table1 WHERE productid =' . $productid . ''; 5 if ($result = mysql_query($sql)) { 6 if (mysql_num_rows($result)) { 7 $row = mysql_fetch_assoc($result); 8 $leader = $row['leader']; 9 } 10 } 11 ?>"; 12 echo($content); 13 ?> Thanks! Regards Matthew 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> 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> 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? 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; ?> 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.'; } } } ?> <?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 I'm getting a unexpected t_if error and not sure where my fix is. Code: [Select] <?php if($templateVar == '') { $templateVar = 'peach'; //defaulting to be safe } else { $templateVar = $templateVar; //passed from controller } ?> <?php $this->load->view($templateVar . '/header'); ?> <?php $this->load->view($templateVar . '/navigation'); ?> <!-- End Navigation --> <?php $this->load->view($templateVar . '/msgbox'); ?> <?php if((empty($bodyType))||(!isset($bodyType))||(trim($bodyType)=="")){$this->load->view($templateVar . '/body_full');} elseif($bodyType == "full"){$this->load->view($templateVar . '/body_full');} /* Commented out for now, as currently we only have one layout dimension, this is $ out various sections that have different layouts, 2 columns, 3 columns, columns$ on and so forth. elseif($bodyType == "2column"){$this->load->view($templateVar . '/body_2column$ elseif($bodyType == "3column"){$this->load->view($templateVar . '/body_3column$ elseif($bodyType == "blog"){$this->load->view($templateVar . '/body_blog');} */ else{$this->load->view($templateVar . '/body_full');} ?> <?php $this->load->view($templateVar . '/footer'); ?> Issue line: Code: [Select] if((empty($bodyType))||(!isset($bodyType))||(trim($bodyType)=="")){$this->load->view($templateVar . '/body_full');} |