gli Posted April 18, 2008 Share Posted April 18, 2008 <?php $skypename = $_POST['skypename']; $result = mysql_query("UPDATE users SET skypename='$skypename' WHERE id='$_SESSION['id']'") or die(mysql_error()); ?> when i add WHERE id='$_SESSION['id']' then Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/www/jimperija.atwebpages.com/settingsprocess.php on line 7 where is the problem in my code ? thanks Link to comment https://forums.phpfreaks.com/topic/101765-problem-with-adding-seasion-information-in-mysql-query/ Share on other sites More sharing options...
Zhadus Posted April 18, 2008 Share Posted April 18, 2008 <?php $skypename = $_POST['skypename']; $result = mysql_query('UPDATE users SET skypename=\"' . $skypename . '\" WHERE id=\"' . $_SESSION['id'] . '\"') or die(mysql_error()); ?> You are using the single and double quotations incorrectly. Link to comment https://forums.phpfreaks.com/topic/101765-problem-with-adding-seasion-information-in-mysql-query/#findComment-520675 Share on other sites More sharing options...
gli Posted April 18, 2008 Author Share Posted April 18, 2008 thnx. but now there is new error You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '\"lolozz\" WHERE id=\"\"' at line 1 Link to comment https://forums.phpfreaks.com/topic/101765-problem-with-adding-seasion-information-in-mysql-query/#findComment-520680 Share on other sites More sharing options...
dennismonsewicz Posted April 18, 2008 Share Posted April 18, 2008 Try this: $result = mysql_query('UPDATE users SET skypename= '$skypename' WHERE id="' . $_SESSION['id'] . '"') Link to comment https://forums.phpfreaks.com/topic/101765-problem-with-adding-seasion-information-in-mysql-query/#findComment-520683 Share on other sites More sharing options...
gli Posted April 18, 2008 Author Share Posted April 18, 2008 ouh zhadus thnx all was okey. denis thnx but in your code was some error. thnx guys Link to comment https://forums.phpfreaks.com/topic/101765-problem-with-adding-seasion-information-in-mysql-query/#findComment-520689 Share on other sites More sharing options...
dennismonsewicz Posted April 18, 2008 Share Posted April 18, 2008 sorry yeah try this: $result = mysql_query('UPDATE users SET skypename= '$skypename' WHERE id='" . $_SESSION['id'] . "'") Link to comment https://forums.phpfreaks.com/topic/101765-problem-with-adding-seasion-information-in-mysql-query/#findComment-520692 Share on other sites More sharing options...
dennismonsewicz Posted April 18, 2008 Share Posted April 18, 2008 did this work? Link to comment https://forums.phpfreaks.com/topic/101765-problem-with-adding-seasion-information-in-mysql-query/#findComment-520711 Share on other sites More sharing options...
morph07 Posted April 18, 2008 Share Posted April 18, 2008 back to start... from your first post, the code: WHERE id='$_SESSION['id']' you must revised it to WHERE id='$_SESSION["id"]' another option is to assigning it to another variable.... Link to comment https://forums.phpfreaks.com/topic/101765-problem-with-adding-seasion-information-in-mysql-query/#findComment-520730 Share on other sites More sharing options...
jonsjava Posted April 18, 2008 Share Posted April 18, 2008 <?php $skypename = $_POST['skypename']; $result = mysql_query("UPDATE users SET skypename='$skypename' WHERE id='{$_SESSION['id']}';") or die(mysql_error()); ?> Link to comment https://forums.phpfreaks.com/topic/101765-problem-with-adding-seasion-information-in-mysql-query/#findComment-520733 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.