Jump to content

Help with communicating with MySQL


koo_04

Recommended Posts

When I try to run the PHP page I get

Fatal error: Call to undefined function mysql_connect() in C:\websites\Forum\connect.php on line 2

 

This is the code

<?php
$db = mysql_connect("localhost", "root", "Password") or die("Could not connect.");
if(!$db) 
die("no db");
if(!mysql_select_db("database_password",$db))
	die("No database selected.");
if(!get_magic_quotes_gpc())
{
  $_GET = array_map('mysql_real_escape_string', $_GET); 
  $_POST = array_map('mysql_real_escape_string', $_POST); 
  $_COOKIE = array_map('mysql_real_escape_string', $_COOKIE);
}
else
{  
   $_GET = array_map('stripslashes', $_GET); 
   $_POST = array_map('stripslashes', $_POST); 
   $_COOKIE = array_map('stripslashes', $_COOKIE);
   $_GET = array_map('mysql_real_escape_string', $_GET); 
   $_POST = array_map('mysql_real_escape_string', $_POST); 
   $_COOKIE = array_map('mysql_real_escape_string', $_COOKIE);
}
?>

 

Link to comment
https://forums.phpfreaks.com/topic/183380-help-with-communicating-with-mysql/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.