walkonet Posted December 6, 2006 Share Posted December 6, 2006 Hello all ive been folowing a book (PHP and MYSQL for dynamic website by Larry Ullman)and ive created a basic show records page that basically shows the users that are registed to the site. now im on a script that will delete the user from the databse and I got this error: [color=red]Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ',' or ';' in C:\wamp\www\PHPScript\delete_users.php on line 70[/color]ive check the coding 4 times and found alot of missing '{' , '}' but i cant seem to find the problem in this one.here the code for delte_users.php: NOTE: line 70 is designated in red.[code]<?php # Delete Users delete_users.php//This page deletes users!!!//This page is accessed through view_users.php$page_title = 'Delete A User';include('./includes/header.html');//Check for a valid iser ID, through GET or POSTif( (isset($_GET['id'])) && (is_numeric($_GET['id'])) ) {//Accessed through view_users.php $id = $_GET['id'];} elseif ( (isset($_POST['id'])) && (is_numeric($_POST['id'])) ) { $id = $_POST['id'];} else { //no valid id kill the script. echo '<h1 id="mainhead>Page Error!</h1> <p class="error">this page has been accessed in error.</p><p><br /></p>'; include('./includes/footer.html'); exit();}require_once('./connect/mysql_connect.php');// Check to see if the form has been submitted.if(isset($_POST['submitted'])) { if($_POST['sure'] == 'Yes') {//delete them //Make the query. $query = "DELETE FROM users WHERE user_id=$id"; $result = @mysql_query ($query); //Run the query. if(mysql_affected_rows() == 1) {//if it ran ok //print a message echo '<h1 id="mainhead">Delete A User</h1> <p>The user has been deleted.</p><p><br /></p>'; } else { //if it didnt run ok echo '<h1 id="mainhead">System Error!</h1> <p class="error">The user could not be deleted because of a system error.</p>'; //public message echo '<p>' . mysql_error() . '<br /><br />Query: ' . $query . '</p>'; //debugging message } } else { // wasnt shure about deleting the user. echo '<h1 id="mainhead">Delete A User</h1> <p>The user HAS NOT been deleted.</p><p><br /><br /></p>'; }} else { //Show the form //Retrieve users information $query = "SELECT CONCAT(last_name, ',', first_name) FROM users WHERE user_id=$id"; $result = @mysql_query ($query); //run the query. if (mysql_num_rows($result) == 1) {//valid user_id show the form. //Get the users information. $row = mysql_fetch_array ($result, MYSQL_NUM); //Create the form. echo '<h2>Delete A User</h2> <form action="delete_users.php" method="post"> <h3>Name: ' . $row[0] . '</h3> <p>Are you sure you want to delete this user?<br /> <input type="radio" name="sure" value="Yes" />Yes <input type="radio" name="sure" value="No" checked="checked" />No</p> <p><input type="submit" name="submit" value="Submit" /></p> <input type="hidden" name="submitted" value="TRUE" /> <input type="hidden" name="id" value="' . $id '" /> [color=red]</form>';[/color] } else { //not a valid user. echo '<h1 id="mainhead">Page Error!</h1> <p class="error">This page has been accessed in error.</p><p><br /><br /></p>'; } } //end main submit conditional.mysql_close(); //close connectioninclude('./includes/footer.html');?>[/code]any help would be very much appriciated! Link to comment https://forums.phpfreaks.com/topic/29687-solved-t_constant_encapsed_string-error/ Share on other sites More sharing options...
obsidian Posted December 6, 2006 Share Posted December 6, 2006 You're missing the dot to close out your concatonation in the line above:[code]// change this:<input type="hidden" name="id" value="' . $id '" />// to this:<input type="hidden" name="id" value="' . $id . '" />[/code] Link to comment https://forums.phpfreaks.com/topic/29687-solved-t_constant_encapsed_string-error/#findComment-136260 Share on other sites More sharing options...
walkonet Posted December 6, 2006 Author Share Posted December 6, 2006 man your kidding me lmao thanks... so much .... lol probably gonna be more but this one was tough to debug for me... Link to comment https://forums.phpfreaks.com/topic/29687-solved-t_constant_encapsed_string-error/#findComment-136263 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.