0

I have no clue how to code, except some really basic VBA in excel. But I have a very old webpage on one.com which has now been closed down. From my understanding it is because of the "old PHP" and that I need to rewrite the code that uses MySQL, The "mysql_connect()" is the problem I know of, but it might be that I need to change all mysql_* functions (I don't really know).

Is there an easy way for me to do this? Could I for example change "MySQL_" to "MySQLI_" and solve all my problems?

Solving this problem, is that something I should be able to do? I don't have 40 hours to try and do it, but maybe 10 hours? could I get a somewhat sufficient understanding within such a timeframe to solve a problem like this?

Thank you very much if you can give me a better understanding of the problem and if I might be able to solve this.

Note that I did not write the webpage and I no longer have any contact with the person who did.

Dharman
  • 30,962
  • 25
  • 85
  • 135
Nick
  • 142
  • 9
  • 1
    First you cannot just add a `i` to the `mysql_` calls, the parameters required are also different – RiggsFolly Nov 24 '20 at 14:57
  • There is a [PHP `mysqli_` manual](https://www.php.net/manual/en/book.mysqli.php) If you want to do a bit of reading and compare it to the old [`mysql_` function call in the manual](https://www.php.net/manual/en/book.mysql.php) – RiggsFolly Nov 24 '20 at 14:59
  • 1
    However, your old code will be open to [SQL Injection Attack](http://stackoverflow.com/questions/60174) because it was `mysql_` based. You should consider using [prepared parameterized statements](http://php.net/manual/en/mysqli.quickstart.prepared-statements.php) in either the `MYSQLI_` or `PDO` API's instead of concatenated values, so this is not going to be a simple process – RiggsFolly Nov 24 '20 at 15:06
  • 1
    It all depends on how complex your code is. Ideally, you would want to rewrite everything to use PDO. There's no point in using mysqli. It was designed to be less work when upgrading but it turns out that PDO is much easier to use than mysqli. I am not sure if 40 hours is enough given that you seem to have limited programming knowledge and you will have to learn programming first before rewriting this project. However, I strongly encourage you to do that if you want to continue using this site. – Dharman Nov 24 '20 at 15:07
  • 1
    Someone asked the same question back in 2009.... (https://stackoverflow.com/questions/1390607/how-to-change-mysql-to-mysqli) – Luuk Nov 24 '20 at 15:08

0 Answers0