Jump to content

General PHP question


blue-genie

Recommended Posts

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.

 

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.