-1

I've followed a tutorial to add a MySQL database into my PHP website. I've been following this tutorial: https://www.youtube.com/watch?v=tPspjWX8GXw

I'm using PHP Version 5.5.33 and XAMPP. I've even replaced all of my code with his working code and it still didn't work.

The exact error:

Fatal error: Call to undefined function mysql_connect() in C:\xampp\htdocs\assign\Model\FoodModel.php on line 33

Thanks in advance.

chris85
  • 23,846
  • 7
  • 34
  • 51
Takari
  • 29
  • 2
  • 3
  • 8
  • Are you sure you are using 5.5.33? Might as well just update to `PDO` or `mysqli` anyway. Also not a good tutorial. Tutorials shouldn't have SQL injections written into them. – chris85 May 01 '16 at 19:40

1 Answers1

0

Use the mysqli extension instead of mysql. Please make sure you don't use very old tutorials with the mysql extension, it's outdated.

Andreas
  • 2,821
  • 25
  • 30
  • Thank you for the suggestion . I'm new to PHP and I'm doing my absolute best to learn from different tutorials. I've replaced mysql with mysqli , however I still have problems. Ex:Warning: mysqli_select_db() expects exactly 2 parameters, 1 given – Takari May 01 '16 at 20:33