mysql_real_escape_string is undefined

前端 未结 5 2006
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-06 10:41

I am using PHP version 5.3 and trying to use mysql_real_escape_string($unescaped_string) in my code, but I get the error:

Fatal error: Call to u         


        
5条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-06 11:45

    Interestingly, after exploring all the other solutions here, I realized the problem is actually due to the php5-mysql extension not having been installed yet - it's not installed by default on a fresh Ubuntu, neither when u install fresh php. So, for me the solution became: install the php5-mysql extension:

    sudo apt-get install php5-mysql
    

    After this, I wasn't getting those nasty mysql_* errors again ;-)

提交回复
热议问题