Kryllster Posted July 9, 2010 Share Posted July 9, 2010 I get this error: Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' in C:\wamp\www\crimson\skill_comments.php on line 6 from this code: <?php // Define form variables and checks $message = "Please do NOT leave any fields empty Thank You!!"; // Start the process of creation $skillname = $_POST['skillname']; $class = $_POST['class']; $type = $_POST['type']; $description = $_POST['description']; $name = $_POST['name']; if ( empty($_POST['skillname']) || empty($_POST['class']) || empty($_POST['type']) || empty($_POST['description']) || empty($_POST['name']) ) { echo $message; exit(); } // connection to database info here $host = "localhost"; // Host name $db_username = "rodan"; // Mysql username $db_password = "yu5t1ll2"; // Mysql password $db_name = "skillcomments"; // Database name $tbl_name = "comments"; // Table name // Connect to server and select databse. $sql = mysql_connect("$host", "$db_username", "$db_password"); if (!$sql) { die('Could not connect: ' . mysql_error()); exit(); } else{ mysql_select_db("$db_name")or die("cannot select DB"); } // Test for duplicate Username. If True then back to form. If not continue. $sql = "select * from $tbl_name where skillname='" . $_POST['skillname'] . "'"; $result = mysql_query($sql); if (mysql_num_rows($result) >= 1) { echo "That Skillname is already taken please choose another!"; exit(); } else{ // Populate table from form and defined info mysql_query("INSERT INTO $tbl_name (skillname, class, type, description, name) Values ('$skillname','$class','$type','$description','$name')"); } ?> Some of this code is copy and paste from previous code that works I dont understand why its not working. Thanks in advance, Quote Link to comment https://forums.phpfreaks.com/topic/207278-why-do-i-get-this-error/ Share on other sites More sharing options...
PFMaBiSmAd Posted July 9, 2010 Share Posted July 9, 2010 The code you posted does not produce that error. Any chance when you uploaded it to your server that the upload failed and only part of the file exists on your actual server? Quote Link to comment https://forums.phpfreaks.com/topic/207278-why-do-i-get-this-error/#findComment-1083765 Share on other sites More sharing options...
Kryllster Posted July 9, 2010 Author Share Posted July 9, 2010 yes that was partially the problem I was editing the wrong file once I editted the correct one it all works fine now thanks. Now I feel really stupid. Quote Link to comment https://forums.phpfreaks.com/topic/207278-why-do-i-get-this-error/#findComment-1083771 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.