PHP - T_encapsed_and_whitespace
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 Similar TutorialsI 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']"); } Can 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 I'm getting: Quote unexpected T_ENCAPSED_AND_WHITESPACE Bull shit! Where?! echo "<B>Brand:</B> $row['brand']"; 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 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 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> '); } ?> 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 |