msafvati Posted January 21, 2008 Share Posted January 21, 2008 hi i have a problem when i update my data!!! please guide me <?php $connectionstring=odbc_connect("user","",""); $new_Edu=$_GET['txt1']; $new_Back=$_GET['txt2']; $new_Otherskiils=$_GET['txt3']; $new_Age=$_GET['txt4']; $new_Tell=$_GET['txt5']; $new_=$_GET['txt6']; $SqlUpdate="UPDATE tblReguser SET (Edu = "'.$new_Edu.'", Background = "'.$new_Back.'" , Otherskills = "'.$new_Otherskiils.'" , Age = "'.$new_Age.'" , Tell = "'.$new_Tell.'" where username = "'.$new_Adress.'" )"; $resultup=odbc_do($connectionstring,$Sqlupdate); echo "Record successfully updated!"; odbc_close($connectionstring); ?> error is : Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in D:\MAS\Prj2\Local path\MASUdate\Update.php on line 249 line 249 is : $sqlUpdate thank u Quote Link to comment https://forums.phpfreaks.com/topic/87005-where-is-problem/ Share on other sites More sharing options...
mmarif4u Posted January 21, 2008 Share Posted January 21, 2008 I am not sure why u r using () in the following query. $SqlUpdate="UPDATE tblReguser SET (Edu = "'.$new_Edu.'", Background = "'.$new_Back.'" , Otherskills = "'.$new_Otherskiils.'" , Age = "'.$new_Age.'" , Tell = "'.$new_Tell.'" where username = "'.$new_Adress.'" )"; Quote Link to comment https://forums.phpfreaks.com/topic/87005-where-is-problem/#findComment-444913 Share on other sites More sharing options...
ratcateme Posted January 21, 2008 Share Posted January 21, 2008 you need to change that line to $SqlUpdate="UPDATE tblReguser SET (Edu = '".$new_Edu."', Background = '".$new_Back."' , Otherskills = '".$new_Otherskiils."' , Age = '".$new_Age."' , Tell = '".$new_Tell."') WHERE username = '".$new_Adress."'"; Scott. Quote Link to comment https://forums.phpfreaks.com/topic/87005-where-is-problem/#findComment-444915 Share on other sites More sharing options...
msafvati Posted January 21, 2008 Author Share Posted January 21, 2008 thank u means dont i use () in query? i delete () from query but i have same problem! Quote Link to comment https://forums.phpfreaks.com/topic/87005-where-is-problem/#findComment-444918 Share on other sites More sharing options...
ratcateme Posted January 21, 2008 Share Posted January 21, 2008 $SqlUpdate="UPDATE tblReguser SET Edu = '".$new_Edu."', Background = '".$new_Back."' , Otherskills = '".$new_Otherskiils."' , Age = '".$new_Age."' , Tell = '".$new_Tell."' WHERE username = '".$new_Adress."'"; use this Scott. Quote Link to comment https://forums.phpfreaks.com/topic/87005-where-is-problem/#findComment-444919 Share on other sites More sharing options...
mmarif4u Posted January 21, 2008 Share Posted January 21, 2008 Ok try this: $SqlUpdate="UPDATE tblReguser SET Edu = '$new_Edu', Background ='$new_Back', Otherskills = '$new_Otherskiils', Age ='$new_Age', Tell ='$new_Tell' where username ='$new_Adress'"; Quote Link to comment https://forums.phpfreaks.com/topic/87005-where-is-problem/#findComment-444920 Share on other sites More sharing options...
msafvati Posted January 21, 2008 Author Share Posted January 21, 2008 thank u i changed my query and my problem is solved but a new problem exist in my project please guide me Warning: odbc_do() [function.odbc-do]: SQL error: [Microsoft][ODBC Microsoft Access Driver]Invalid use of null pointer , SQL state S1009 in SQLExecDirect in D:\MAS\Prj2\Local path\MASUdate\Update.php on line 251 line 251 is : $resultup=odbc_do($connectionstring,$Sqlupdate); Quote Link to comment https://forums.phpfreaks.com/topic/87005-where-is-problem/#findComment-444928 Share on other sites More sharing options...
mmarif4u Posted January 21, 2008 Share Posted January 21, 2008 I am sorry,i did not work on SQL ... So wait for someone who knows about it.will help you out. Quote Link to comment https://forums.phpfreaks.com/topic/87005-where-is-problem/#findComment-444930 Share on other sites More sharing options...
Ken2k7 Posted January 21, 2008 Share Posted January 21, 2008 Hello, Check this line: $connectionstring=odbc_connect("user","",""); I think you're missing a parameter in that odbc_connect() function. I haven't dealt with it much, but if you want, you can use mysql_connect() and mysql_query() rather than odbc_connect() and odbc_do() respectively. Cheers, Ken Quote Link to comment https://forums.phpfreaks.com/topic/87005-where-is-problem/#findComment-444936 Share on other sites More sharing options...
msafvati Posted January 21, 2008 Author Share Posted January 21, 2008 thank u i cant use mysql becuse it dont connect with my php.i use only from ODBC... please guide me for ODBC Quote Link to comment https://forums.phpfreaks.com/topic/87005-where-is-problem/#findComment-444950 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.