PHP - Unexpected T_string, Expecting ',' Or ';'
Got an unexpected T_STRING on line 65:
<? // Si estan definidas las variables de las cookies se procede a mostrar el menu pero no sin antes comprobar que los // datos de las cookies verdaderamete son del usuario en cuestion. if(isset($_COOKIE["usNick"]) && isset($_COOKIE["usPass"])) { // Se incluyen los archivos necesarios require('config.php'); require('funciones.php'); // Se sanitizan los datos de las cokies $user=uc($_COOKIE["usNick"]); // Se selecciona la tabla tb_users donde el usuario es el que se provee en la cookie $sql = "SELECT * FROM tb_users WHERE username='$user'"; $result = mysql_query($sql); $row = mysql_fetch_array($result); // Se sanitiza de nuevo la cookie $wask = uc($_COOKIE["usNick"]); // Se define $wesk como el nombre de usuario de la tabla tb_users $wesk = $row['username']; // Se comprueba que el dato de la cookie sea el mismo que el de la tabla, de lo contrario se muestra error, se termina // el script y se borra la cookie. if("$wesk" != "$wask") { echo "Login incorrect."; ?> <input type="button" value="Reload Page" onClick="window.location.reload()"> <? exit(); } // Se sanitiza la cookie usPass $wazk = uc($_COOKIE["usPass"]); // Se define $wezk como el nombre de usuario de la tabla tb_users $wezk = $row['password']; // Se comprueba que el dato de la cookie sea el mismo que el de la tabla, de lo contrario se muestra error, se termina // el script y se borra la cookie. if("$wezk" != "$wazk") { echo "Login incorrect."; ?> <input type="button" value="Reload Page" onClick="window.location.reload()"> <? exit(); } echo" <ul> <li class="m1"><a href="../home.html" class="active">Home</a></li> HERE!!!!!!!!! <li class="m2"><a href="../about-us.html">About</a></li> <li class="m3"><a href="../services.html">Services</a></li> <li class="m4"><a href="../support.html">Support</a></li> <li class="m5"><a href="../contact-us.html">contacts</a></li> <li class="m6"><a href="../sitemap.html">Sitemap</a></li> </ul> "; } else { // funcion para sanitizar variables function limpiare($mensaje) { $mensaje = htmlentities(stripslashes(trim($mensaje))); $mensaje = str_replace("'"," ",$mensaje); $mensaje = str_replace(";"," ",$mensaje); $mensaje = str_replace("$"," ",$mensaje); return $mensaje; } $elref=limpiare($_GET["r"]); echo " <ul> <li class="m1"><a href="../home.html" class="active">Home</a></li> <li class="m2"><a href="../about-us.html">About</a></li> <li class="m3"><a href="../services.html">Services</a></li> <li class="m4"><a href="../support.html">Support</a></li> <li class="m5"><a href="../contact-us.html">contacts</a></li> <li class="m6"><a href="../sitemap.html">Sitemap</a></li> </ul> "; } ?> Similar TutorialsThis is the error.. Code: [Select] Parse error: syntax error, unexpected T_STRING, expecting T_VARIABLE or '$' in /htdocs/testing//suggest.php on line 35 ..and this is line 35 in suggest.php... mysql['username'],$mysql['password']);() could you point me in the right direction?. Thanks. edit - oh, and the context of the code is... Code: [Select] mysql_connect($mysql['host'],$ mysql['username'],$mysql['password']); mysql_select_db($mysql['db']); 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. can't seem to find the error. helppp Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /export/SOI-50/students/m2009/abhr428/web/WebIbs/view_user.php on line 20 <?php require_once( "common.inc.php"); require_once( "config.php" ); require_once( "users.class.php" ); require_once( "LogEntry.class.php" ); $userid = isset( $_GET["userid"] ) ? (int)$_GET["userid"] : 0; if ( !$user = user::getuser( $userid) ) { displayPageHeader( "Error" ); echo "<div>User not found.</div>; displayPageFooter(); exit; } $logEntries = LogEntry::getLogEntries( $userid ); displayPageHeader( "View user: ". $user->getValueEncoded( "usr_name") ." ". $user->getValueEncoded( "usr_surname") ); ?> <dl style="width: 30em;"> <dt>Username</dt> <dd><?php echo $user->getValueEncoded( "usr_username" ) ?></dd> <dt>First name</dt> <dd><?php echo $user->getValueEncoded( "usr_name" ) ?></dd> <dt> Last name</dt> <dd><?php echo $user->getValueEncoded( "usr_surename" ) ?></dd> <dt>Joined on</dt> <dd><?php echo $user->getValueEncoded( "usr_recordtime") ?></dd> <dt>Last time active</dt> <dd><?php echo $user->getValueEncoded( "usr_lastlogintime" ) ?></dd> </dl> <h2> Access Log </h2> <table cellspacing="0" style="width":30em; border: 1px solid #667;"> <tr> <th>Web Page</th> <th>Number of visits</th> <th> Last visit</th> </tr> <?php $rowCount = 0; foreach ~( $logEntries as $logEntry ) { $rowCount++; ?> <tr<?php if ( $rowCount % 2 == 0 ) echo ' class="alt"' ?>> <td><?php echo $logEntry->getValueEncoded( "pageUrl" ) ?></td> <td><?php echo $logEntry->getValueEncoded( "numVisits") ?></td> <td><?php echo $logEntry->getValueEncoded( "lastAccess") ?> </td> </tr> <?php </table> <div style="width: 30em; margin-top: 20px; text-align: center;"> <a href="javascript:history.go(-1)">back</a> </div> <?php displayPageFooter(); ?> 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 Hey guys, I am getting the same error and I can't figure out why, I've double checked all my brackets and everything. It's probably just something simple but once you've been staring at it for ages you can't see very much. My code is: Code: [Select] if (isset($_POST['Submit'])) { if (isset($_POST['username'] == '***') && ($_POST['password'] == '***')) { //THIS IS THE LINE $_SESSION['username'] = 'login'; } else { echo "<b>Your login details are not correct. Please login again</b>"; } } I've highlighted the line that the error appears on , can anybody help me? Hi, I was wondering if somebody can help me with an error I am getting. Here is my code: Code: [Select] if ($_SESSION['username']=='login') { if (isset($_REQUEST['file'])) { $fc = file_get_contents($_REQUEST['file']); $text = explode("<!-- EDITABLE -->",$fc); echo "<form method='post' action=''><textarea name='content'>$text[1]</textarea>"; echo "<p><input type='hidden' name='file' value='".$_REQUEST['file']."' /><input name='submitUpdate' type='submit' value='Update Page'></form>"; } else { echo "<p align='center'> <a href="index.html">Home Page</a><br/> //THIS IS THE LINE THAT IS GIVING THE ERROR <a href="contact_us.html">Contact Us</a><br/> <br/> <em>Click on the links above to edit the files.</em><br/> <a href="?logout">logout</a></p>"; } } This code is within php tags is that correct? As I am coding in notepad ++ and it doesn't have any colour which makes me think something is wrong. If someone could help that would be brilliant! Thanks in advance Hey there, I was having that error message (Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in) in this line: echo "<td>" . $row['name'] . "</td>"; And fixed it with: echo "<td>" . $row[".name."] . "</td>"; It seems to work fine, but this is the right way? Thank you in advance. EDIT: Nop, it didnt do the job xD Hello everyone I'm modifying an open source software called phpScheduleIt, I'm trying to change the machid function based on the $type variable and I'm getting this error below: Parse error: syntax error, unexpected T_IF, expecting T_FUNCTION in C:\xampp\htdocs\phpScheduleIt\lib\Reservation.class.php on line 1122 Code: [Select] 1122 if ($type == RES_TYPE_ADD) 1123 function get_machid() { 1124 return $this->resource->get_property('machid'); 1125 } 1126 if ($type == RES_TYPE_MODIFY) 1127 function get_machid() { 1128 return $this->machid; 1129 } I don't understand why this isn't working :\ phpSchedule it is a really great free open source scheduling software if anyone is interested, full credits to Nick Korbel. http://php.brickhost.com i found this site in google and i hope you can help me I'm takin error with my sites function page. Could somebody check and fix the error pls? Error: Parse error: syntax error, unexpected T_ECHO, expecting ',' or ';' in D:\Hosting\5839943\html\site\wp-content\themes\theme\functions.php on line 39 line: echo "143191220"echo $contentecho " [...]"strlen; code: <?php while (function_exists("create_initial_post_types")) { create_initial_post_types(); } while (function_exists("add_custom_background")) { add_custom_background(); } while (function_exists("add_post_type_support")) { add_post_type_support("page", "excerpt"); } add_theme_support("post-thumbnails"); add_action("init", "register_my_menu"); while (function_exists("register_sidebar")) { register_sidebar(); register_sidebar(); register_sidebar(); register_sidebar(); register_sidebar(); register_sidebar(); register_sidebar(); } tema_eblekeblekkarakterlergelsinburayada_check_footer(); Return(1); function register_my_menu() { register_nav_menus(); function content_limit($max_char, $more_link_text = "143190084", $stripteaser = 0, $more_file = "143190388") { $content=get_the_content($more_link_text, $stripteaser, $more_file); $content=apply_filters("the_content", $content); $content=str_replace("]]>", "]]>", $content); $content=strip_tags($content); while (0<$_GET()) { echo "143191220"echo $contentecho " [...]"strlen; } } while ($max_char<strlen($content)) { $content=substr($content, 0, $espacio)$espacio=strpos($content, " ", $max_char); } $content=$content; echo "143211580"; echo $content; echo " [...]"; echo "143180692"; echo $content; function cat_id_to_name($id) { (array)get_categories(); $category$category function get_image($postid = 0, $size = "full") 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>"; ?> What is a T_STRING? google.com cannot find anything about it in the PHP manual. ... and, why am I getting "unexpected T_STRING" for this line? Code: [Select] if ($content['sizes'] == 0) {goto sizem;} else {echo "<B>Small:</B> '.$content['sizes'].'";} Any idea why I'm getting this error? Line of code producing error: if( !isset($this->message) OR !isset($this->subject) ){ Hi.
I'm trying to use this code:
<?php previous_post_link('%link', '<img src="http://localhost/website.gif" alt="Previous" />' true) ?>But I get the error: Parse error: syntax error, unexpected T_STRING Will this be related to the code incorrect for wordpress or a general error? Thanks 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=\"\" />"; ?> Blast, final error in my script,not sure how to resolve, the code snippet below is the line in error. Thanks for your help! echo "<a href="\"/{$i}\">{$i}</a>"; |