blue-genie Posted March 30, 2010 Share Posted March 30, 2010 are there different syntaxes for PHP for different versions of PHP or MySQL - or are there just many ways to achieve one thing? reason I ask, many people come up with different code snippets with different syntax and also I get some errors stating I have an error in my sql statement for my version. Quote Link to comment https://forums.phpfreaks.com/topic/196963-general-php-question/ Share on other sites More sharing options...
Catfish Posted March 30, 2010 Share Posted March 30, 2010 php syntax - ther eare many different ways to do things. just like in the real world, there's many ways you can achieve the same thing. mysql - if you are getting an error given to you, you should be able to find out why it is doing it. google, mysql manual, reading the error itself and finally asking others about it. Quote Link to comment https://forums.phpfreaks.com/topic/196963-general-php-question/#findComment-1034047 Share on other sites More sharing options...
Deoctor Posted March 30, 2010 Share Posted March 30, 2010 in mysql 4.0.-- u cannot run child queries under a single line. some thing like select * from table1 where email=(select email from table2 where some condition) where as in the mysql version >=5 u can do it out.. so like this some of the queries that run in one version will differ from other version.. like wise in php too some functions might been deprecated in one version and also u might not have enabled that one in ur php.ini file.. so this could be the basic difference.. so when ever u get an error check for the version of the php and check for the related item whether they are activated in ur ini file Quote Link to comment https://forums.phpfreaks.com/topic/196963-general-php-question/#findComment-1034060 Share on other sites More sharing options...
PFMaBiSmAd Posted March 30, 2010 Share Posted March 30, 2010 I get some errors stating I have an error in my sql statement for my version Those are generally (~90% of the time) sql syntax errors that have nothing to do with your mysql version. Mysql simply cannot figure out what you mean because you used a sql keyword or sql syntax in a location where it does not belong. The sql parser does not know what you, the programmer, intended (computers cannot read minds yet) and cannot distinguish between your wrong syntax and perhaps a feature that exists in a different version. These are usually caused by using a reserved keyword as a column or table name or by using the wrong syntax for what you are attempting (such as using the syntax for an insert query in an UPDATE query...) If you have a specific error that you need help with, you would need to post the error and the code or query responsible for the error. Quote Link to comment https://forums.phpfreaks.com/topic/196963-general-php-question/#findComment-1034080 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.