PHP - Unexpected T_echo, Expecting ',' Or ';' Error Help
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") Similar TutorialsI'm getting a syntax error in this code. Basically I'm printing out a form, and depending on the value of an option, I want "checked" to be printed out. I was getting a syntax error by using the non-shorthand version of an if statement too. Any ideas why? '<input type="radio" name="position" value="1" '.(get_option("shPosition") == 1 ? echo "checked" :).' /> Top <input type="radio" name="position" value="0" '.(get_option("shPosition") == 0 ? echo "checked" :).' /> Bottom' Hi I am having problems with this script checked and checked but with no joy can you assist a php newb Code: [Select] <?php # Product Entry $page_title = 'Product Entry'; if (isset($_POST['Submit'])) { $errors = array(); if (empty($_POST['SKU_ProductID'])) { $errors[] = 'Please enter Product ID.'; } else { $sid = trim($_POST['SKU_ProductID']); } if (empty($_POST['SKU_MerchSKUID'])) { $errors[] = 'Please enter Merchant SKU.'; } else { $mid = trim($_POST['SKU_MerchSKUID']); } if (empty($_POST['Game_Title'])) { $errors[] = 'Please enter Game Title.'; } else { $gt = trim($_POST['Game_Title']); } if (empty($_POST['Platform'])) { $errors[] = 'Please enter Platform.'; } else { $pl = trim($_POST['Platform']); } if (empty($_POST['Genre'])) { $errors[] = 'Please enter Genre.'; } else { $ge = trim($_POST['Genre']); } if (empty($_POST['Weight'])) { $errors[] = 'Please enter Weight.'; } else { $we = trim($_POST['Weight']); } if (empty($_POST['Supplier'])) { $errors[] = 'Please enter Supplier.'; } else { $sup = trim($_POST['Supplier']); } if (empty($_POST['Supplier_Price'])) { $errors[] = 'Please enter Supplier Price.'; } else { $sp = trim($_POST['Supplier_Price']); } if (empty($_POST['Cashback'])) { $errors[] = 'Please enter Cashback %.'; } else { $cb = trim($_POST['Cashback']); } if (empty($_POST['Cashback_Amount'])) { $errors[] = 'Please enter Cashback Amount.'; } else { $cba = trim($_POST['Cashback_Amount']); } if (empty($errors)) { require_once ('connect.php'); $q = "INSERT INTO Products (SKU_ProductID, SKU_MerchSKUID, Game_Title, Platform, Genre, Weight, Supplier, Supplier_Price, Cashback, Cashback_Amount) VALUES ('$sid' , '$mid' , '$gt' , '$pl' , '$ge' , '$we' , '$sup' , '$sp' , '$cb' , '$cba')"; $r = @mysql_query ($dbc, $q); if ($r) { echo '<H1>This game has been added to the database.</H1>'; } else { echo '<H1>Product Addition Error</H1> <p class="error">The game could not be added to the database.</p>'; echo '<p>' . mysqli_error($dbc) . '<br /><br />Query: ' . $q . '</p>'; } mysqli_close($dbc); exit (); } else { echo '<H1>Error!</H1> <p class="error">The Following error(s) occurred:<br />'; foreach ($errors as $msg { [b]echo " - $msg<br />\n";[/b] } echo '</p><p>Please try again.</p><p><br /></p>'; } [b]}[/b] ?> The errors regards syntax I see on dreamweaver are in bold. Thanks Paul 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..! :-) This topic has been moved to Third Party PHP Scripts. http://www.phpfreaks.com/forums/index.php?topic=315281.0 I have been getting that error and I cannot figure out why it is happening Here is the error: Parse error: syntax error, unexpected T_ENDWHILE, expecting ',' or ';' in /home/scswc188/public_html/index.php on line 23 Here is my Code (Database Credentials removed for obvious reasons) <?PHP // Conect to the Mysql Server $connect = mysql_connect("IP","USER","PASS"); //connect to the database mysql_select_db("TABLE"); //query the database $query = mysql_query("SELECT * FROM users_online WHERE online = 1"); // fetch the results / convert into an array WHILE($rows = mysql_fetch_array($query)): $users = $rows['name']; echo "'<font color='black'>Online:<font color='green'>$users, </font></font>;" endwhile; ?> or here http://pastebin.com/ZYh4t2pD Thanks Edit: Found the php tag 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(); ?> <?php error_reporting(E_ALL); include_once("conninfo2.php"); include_once('classes/bcrypt.php'); class User { private $_bcrypt; $this->_bcrypt = new Bcrypt; if($this->_bcrypt->verify($password, $this->data()->password)){ } if(isset($_POST['username'])) { $firstname = strip_tags($_POST['firstname']); $surname = strip_tags($_POST['surname']); $pnumber = strip_tags($_POST['pnumber']); $username = strip_tags($_POST['username']); $email1 = strip_tags($_POST['email1']); $email2 = strip_tags($_POST['email2']); $password1 = $_POST['password1']; $password2 = $_POST['password2']; //code below will make sure all fields are filled in if(trim($firstname) == "" || trim($surname) == "" || trim($pnumber) == "" || trim($username) == "username" || trim($email1) == "" || trim($email2) == "" ||trim($password1) == "" || trim($password2) == "") { echo "Error, all fileds need to be filled in"; $db = null; exit(); } //code below checks that the emails entered both match one another if($email1 != $email2) { echo "Emails do not match, please try again"; $db = null; exit(); } //code below matches the passwords entered else if($password1 != $password2) { echo "Passwords do not match please try again"; exit(); } if(!filter_var($email1, FILTER_VALIDATE_EMAIL)) { echo "Your email is invalid, please try again"; $db = null; exit(); } //checks if the email exists within the database $stmt = $db->prepare("SELECT email FROM login WHERE email=:email1 LIMIT 1"); $stmt->bindValue(':email1',$email1, PDO::PARAM_STR); try{ $stmt->execute(); $count = $stmt->rowCount(); } catch(PDOException $e) { echo $e->getMessage(); $db = null; exit(); } //checks if the username exists $usernameSQL = $db->prepare("SELECT username FROM login WHERE username=:username LIMIT 1"); $usernameSQL->bindValue(':username',$username,PDO::PARAM_STR); try{ $usernameSQL->execute(); $usernameCount = $usernameSQL->rowCount(); } catch(PDOExemption $e) { echo $e->getMessage(); $db = null; exit(); } //checks if the email is already within the database if($count > 0) { echo "This email already exists"; $db = null; exit(); } //checks the username if($usernameCount > 0) { echo "This username is unavailable please try another"; $db = null; exit(); } $user = new User; $bcrypt = new Bcrypt; try { $email1->create(array( 'username' => Input::get('username'), 'password1' => $bcrypt->hash(Input::get('password')), 'firstname' => Input::get('name'), 'surname' => Input::get('surname'), 'pnumber' => Input::get('pnumber'), 'email1' => Input::get('email'), 'ipaddress' => Input::get('ipaddress'), 'signup_date' => date('Y-m-d H:i:s'), 'group' => 1 )); //grab the last id used within the database $lastId = $db->lastInsertId(); $stmt3 = $db->prepare("INSERT INTO activated (user, token) VALUES ('$lastId', :token)"); $stmt3->bindValue(':token',$token,PDO::PARAM_STR); $stmt3->execute(); //email activation $from = "From Auto Responder @ Mediaedit <admin@mediaedit.com>"; $subject = "IMPORTANT: Please activate your account"; $link = 'http://mediaed.it/roxanne/activate.php?user='.$lastId.'&token='.$token.''; //email body $message = " Thanks for register with Mediaedit, before your able to use our services you will need to verify your email so that we know your human $link "; //headers $headers = 'MIME-Version: 1.0' . "rn"; $headers .= "Content-type: textrn"; $headers .= "From: Mediaedit"; //send email now mail($email1, $subject, $message, $headers, '-f noreply@mediated.it'); $db->commit(); echo "Thanks for registering, before you can us our services you need to activate your account an email has been sent which you will recieve shortly"; $db = null; exit(); } catch(PDOException $e){ $db->rollBack(); echo $e->getMessage(); $db = null; exit(); } } ?>i keep getting Parse error: syntax error, unexpected T_VARIABLE, expecting T_FUNCTION I just edited the tablerate.php in magento, and now I am getting this error, but I don't know what's wrong. Anybody here can help me?
The error message reads "Parse error: syntax error, unexpected '*', expecting function (T_FUNCTION) in /home/echoshom/public_html/app/code/core/Mage/Shipping/Model/Carrier/Tablerate.php on line 50"
Attached is tablerate.php
Attached Files
Tablerate.php 9.23KB
2 downloads Hey, Its something to do with the ' or \ I know that as Ive been trying alot. Code Code: [Select] if ($this->isAdmin && count ($func_players) > SettingsManager::GetSetting(Settings::BAN_LIMIT)) return $this->sendErrorBox('max', 'You can\'t ban that many Users at once!', 'Gosh', 'iBan'); foreach($func_players as $func_player) $func_player->ban(&this->playerName, $this->isAdmin); return $this->sendErrorBox('max', sprintf( '%s ha%s been banned.' $this->getPlayerString($func_players), count($func_players) == 1 ? 's' : 've'), 'SykoPwns:P', 'Sykos:iBan'); Thanks for your help! Ive tried alot of things I think I could just take out the \ or something!! 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 Hi. I am having a problem with a php while loop.I am trying to draw a polygon using coordinates from a online data table called buildinglist.the loop is supposed to loop through each row drawing a polygon with each set of coordinates : <?php // Include file to Connnect to online database include_once "mysql_connect.php"; // Collects data from table $data = mysql_query("SELECT * FROM buildinglist") or die(mysql_error()); // puts the "buildinglist" info into the $info array // $info = mysql_fetch_array( $data ); ?> <!DOCTYPE HTML> <html> <head> <style type="text/css"> #theMap {background-image:url('MapImg.png'); } polygon:hover{fill:gold;} </style> <script type="text/javascript"> // This function is called when the lake is clicked. function buildingClick(<?php $id ?>) { // Display a fact. alert("<?php print $id; ?>"); } </script> </head> <body> <svg id="theMap" x="0" y="0" width="900" height="900"> <?php while($info = mysql_fetch_array( $data )){ //THE PROBLEM IS WITH THIS LINE// echo "<polygon fill="$info['fill_colour']" stroke="black" id="$info['id']" points="$info['coordinates']" />"; } ?> </svg> </body> </html> Can anybody help?it would be highly appreciated Eoin. Hi, I'm trying to create a cms and am encountering an error which I can't figure out. The error message reads: Parse error: syntax error, unexpected T_IS_NOT_EQUAL, expecting ',' or ')' in C:\wamp\www\cms\admin.php on line 6 The section of code that is giving me the error is as follows: if (isset( $_GET['action'] != "login") && $_GET['action'] != "logout" && !$_SESSION['username'] ) { //THIS IS LINE 6 login(); exit; } Is there anybody that can help me figure out what is going wrong? Thanks in advance not sure what the error is Parse error: syntax error, unexpected ';', expecting T_FUNCTION in /export/SOI-50/students/m2009/abhr428/web/WebIbs/User.class.php on line 59 Code: [Select] <?php require_once "DataObject.class.php"; class user extends DataObject { protected $data = array( "usr_id" => "", "usr_username" => "", "usr_password" => "", "usr_name" => "", "lastName" => "", "jointime" => "" ); public static function getUsers( $startRow, $numRows, $order ) { $conn = parent::connect(); $sql = "SELECT SQL_CALC_FOUND_ROWS * FROM " . TBL_USERS . " ORDER BY $order LIMIT :startRow, :numRows"; try { $st = $conn->prepare( $sql ); $st->bindValue( ":startRow", $startRow, PDO::PARAM_INT ); $st->bindValue( ":numRows", $numRows, PDO::PARAM_INT ); $st->execute(); $users = array(); foreach ( $st->fetchAll() as $row ) { $users[] = new user( $row ); } $st = $conn->query( "SELECT found_rows() AS totalRows" ); $row = $st->fetch(); parent::disconnect( $conn ); return array( $users, $row["totalRows"] ); } catch ( PDOException $e ) { parent::disconnect( $conn ); die( "Query failed: " . $e->getMessage() ); } } public static function getUser( $id ) { $conn = parent::connect(); $sql = "SELECT * FROM " . TBL_USERS . " WHERE usr_id = :id"; try { $st = $conn->prepare( $sql ); $st->bindValue( ":id", $id, PDO::PARAM_INT ); $st->execute(); $row = $st->fetch(); parent::disconnect( $conn ); if ( $row ) return new User( $row ); } catch ( PDOException $e ) { parent::disconnect( $conn ); die( "Query failed: " . $e->getMessage() ); } } ?> 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 i get the following error in my site.... Parse error: syntax error, unexpected ';', expecting T_FUNCTION in /home/billi/public_html/code/includes/form.php on line 1 the coding of form.php is as follows Code: [Select] <? class Form { var $values = array(); //Holds submitted form field values var $errors = array(); //Holds submitted form error messages var $num_errors; //The number of errors in submitted form /* Class constructor */ function Form(){ /** * Get form value and error arrays, used when there * is an error with a user-submitted form. */ if(isset($_SESSION['value_array']) && isset($_SESSION['error_array'])){ $this->values = $_SESSION['value_array']; $this->errors = $_SESSION['error_array']; $this->num_errors = count($this->errors); unset($_SESSION['value_array']); unset($_SESSION['error_array']); } else{ $this->num_errors = 0; } } /** * setValue - Records the value typed into the given * form field by the user. */ function setValue($field, $value){ $this->values[$field] = $value; } /** * setError - Records new form error given the form * field name and the error message attached to it. */ function setError($field, $errmsg){ $this->errors[$field] = $errmsg; $this->num_errors = count($this->errors); } /** * value - Returns the value attached to the given * field, if none exists, the empty string is returned. */ function value($field){ if(array_key_exists($field,$this->values)){ return htmlspecialchars(stripslashes($this->values[$field])); }else{ return ""; } } /** * error - Returns the error message attached to the * given field, if none exists, the empty string is returned. */ function error($field){ if(array_key_exists($field,$this->errors)){ return "<font size=\"2\" color=\"#ff0000\">".$this->errors[$field]."</font>"; }else{ return ""; } } /* getErrorArray - Returns the array of error messages */ function getErrorArray(){ return $this->errors; } }; ?> please help! I am getting this error and cant figure it out: Parse error: syntax error, unexpected ')', expecting '&' or T_VARIABLE in /path/to/app/cool.php on line 150 this is line 50: function GetParentIDS(){ this is the rest of the function: global $wpdb; $CATS = ""; $Maincategories = get_categories('use_desc_for_title=1&hide_empty=0&hierarchical=0'); $Maincatcount = count($Maincategories); foreach ($Maincategories as $Maincat) { if($Maincat->parent ==0){ $CATS .= $Maincat->cat_ID.","; } } return $CATS; } this is the function above it: function sidebarArticles(){ global $wpdb; global $PPT; $string=""; $posts = query_posts('meta_key=type&meta_value=article&posts_per_page=5'); foreach($posts as $article){ $Artimage = get_post_meta($article->ID, 'image', true); $string .= "<li>"; if(strlen($Artimage) > 1){ $string .= '<a href="'.get_permalink($article->ID).'" title="'.$article->post_title.'"><img src="'.$PPT->ImageCheck($Artimage).'" style="float:right; max-width:40px; max-height:40px;" /></a>'; } $string .= "<h4><a href='".get_permalink($article)."'>".$article->post_title."</a></h4> <cite>Posted <em>".$PPT->TimeDiff($article->post_date)."</em></cite> <p>".$article->post_excerpt."</p> </li>"; } return $string; } Any ideas? Having a problem with a php code. Im new to php and have only been learning for one day but have had previous experiances with php in which i have copied and pasted and edited to suit my needs . This is my code Code: [Select] <?php $username = $_POST["user"]; $password = $_POST["pass"]; $login = $_GET["login"]; setcookie("username","$username",time()+86400); if($login=="yes") { $con = mysql_connect("localhost","root","arceye"); mysql_select_db("login"); $get = mysql_query("SELECT count(id) FROM login WHERE user='$username' and pass='$password'"); $result = mysql_result($get, 0); if($result!=1) { echo "Invalid Username Or Password"; } else { echo "Login Successful" $_SESSION["username"] = $username; } } i named that login.php im running a wamp server thinge on localhost. when i try to run it on http://localhost/login.php i get the error Parse error: syntax error, unexpected T_VARIABLE, expecting ',' or ';' in C:\wamp\www\login.php on line 23 can anyone help i had 5 other error but managed to use common sense to fix them this one i cant seem to work out. Thanks in advance MOD EDIT: code tags added. 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 Hi guys, I have a problem with the script. There is a parse error in line 7 which it end of the line. I need your help to make them get correct, as I am not a programmer and know very little PHP. Here it is the code: <?php try { include_once('HideUrlConfig.php'); } ?> Parse error: syntax error, unexpected $end, expecting T_CATCH in /home/username/public_html/mysite.com/myscript.php on line 6 What do I needs to change it with? |