mark103 Posted January 18, 2012 Share Posted January 18, 2012 Hi guys, I have got a problem with the parse error. Error: Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home/mysite/public_html/Protected.php on line 64 The parse error are highlighing in line 64. I found out that the problem are coming from this line: Protected: '<p id='Protected_Required'>' . $row["Protected_Required"] . '</p>'';[/Code] here's the current code: [code]<?php session_start(); define('DB_HOST', 'localhost'); define('DB_USER', 'mydbuser'); define('DB_PASSWORD', 'mydbpass'); define('DB_DATABASE', 'mydbname'); $errmsg_arr = array(); $errflag = false; $link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD); if(!$link) { die('Failed to connect to server: ' . mysql_error()); } $db = mysql_select_db(DB_DATABASE); if(!$db) { die("Unable to select database"); } function clean($var){ return mysql_real_escape_string(strip_tags($var)); } $username = clean($_GET['user']); $pass = clean($_GET['pass']); if($username == '' && $pass == ''){ // both are empty $errmsg_arr[] = 'Username and password are missing. You must enter both or the other one.'; $errflag = true; } if($errflag) { $_SESSION['ERRMSG_ARR'] = $errmsg_arr; echo implode('<br />',$errmsg_arr); } else { $insert = array(); if(isset($_GET['user'])) { $insert[] = 'username = \'' . clean($_GET['user']) .'\''; } if(isset($_GET['pass'])) { $insert[] = 'pass = \'' . clean($_GET['pass']) . '\''; } if (count($insert)>0) { $names = implode(',',$insert); if($username && $pass) { $query="SELECT id, images, Protected_Required FROM mydatalist WHERE username='$username'"; $result1=mysql_query($query) or die('Error:<br />' . $qry . '<br />' . mysql_error()); while ($row = mysql_fetch_array($result1)) { echo '<a href="http://' . $row["images"] . '">Link</a> </td> | <a href="delete.php?id='.$row['id'].'">Delete</a></td> | Protected: '<p id='Protected_Required'>' . $row["Protected_Required"] . '</p>''; } } } } ?> Do you know how to fix the error I get? Any advice would be much appreciated. Thanks in advance. Link to comment https://forums.phpfreaks.com/topic/255322-parse-error-unexpected-t_string/ Share on other sites More sharing options...
Pikachu2000 Posted January 18, 2012 Share Posted January 18, 2012 Too many single quotes. Link to comment https://forums.phpfreaks.com/topic/255322-parse-error-unexpected-t_string/#findComment-1309064 Share on other sites More sharing options...
scootstah Posted January 18, 2012 Share Posted January 18, 2012 Change to Protected: <p id="Protected_Required">' . $row["Protected_Required"] . '</p>'; Link to comment https://forums.phpfreaks.com/topic/255322-parse-error-unexpected-t_string/#findComment-1309065 Share on other sites More sharing options...
mark103 Posted January 18, 2012 Author Share Posted January 18, 2012 Thanks scootstah, I can see it have fixed the problem. However, I want to know how i can set the data next to the protected like "protected: enabled". My site is showing like this: Link | Delete | Protected: Enabled Do you know how i can do that? Link to comment https://forums.phpfreaks.com/topic/255322-parse-error-unexpected-t_string/#findComment-1309069 Share on other sites More sharing options...
bspace Posted January 19, 2012 Share Posted January 19, 2012 don't put a para after the "protected:" enclose the "protected:" in the para echo '<p id="Protected_Required">Protected: ' . $row["Protected_Required"] . '</p>'; Link to comment https://forums.phpfreaks.com/topic/255322-parse-error-unexpected-t_string/#findComment-1309077 Share on other sites More sharing options...
mark103 Posted January 19, 2012 Author Share Posted January 19, 2012 Look! you don't understand what i am trying to do. I said I want to set the Enabled after the "protected:". Like this: Link | Delete | Protected: Enabled On my site, it's only show like this: Link | Delete | Protected: Enabled Any idea? Link to comment https://forums.phpfreaks.com/topic/255322-parse-error-unexpected-t_string/#findComment-1309084 Share on other sites More sharing options...
Pikachu2000 Posted January 19, 2012 Share Posted January 19, 2012 Paragraphs are block elements. This is now a formatting problem, not a PHP problem. Link to comment https://forums.phpfreaks.com/topic/255322-parse-error-unexpected-t_string/#findComment-1309093 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.