heldenbrau Posted November 18, 2010 Share Posted November 18, 2010 I keep getting the following error: Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: A link to the server could not be established With this code: <?php $level = $_POST[level]; $first = $_POST[first]; $second = $_POST[second]; $third = $_POST[third]; $fourth = $_POST[fourth]; $mysqli = new mysqli("*****", "*****", "******", "********"); if ($mysqli === false) { die("ERROR: Could not connect to database. " . mysqli_connect_error()); } $vidlink=mysql_real_escape_string($_POST[vidlink]); $title=mysql_real_escape_string($_POST[title]); $des=mysql_real_escape_string($_POST[des]); $website=mysql_real_escape_string($_POST[website]); $cat= mysql_real_escape_string($first . $second . $third . $fourth); why won't it work? Link to comment https://forums.phpfreaks.com/topic/219113-mysql_real_escape_string-error/ Share on other sites More sharing options...
ManiacDan Posted November 18, 2010 Share Posted November 18, 2010 When using mysqli_connect, you need to use mysqli_real_escape_string. -Dan Link to comment https://forums.phpfreaks.com/topic/219113-mysql_real_escape_string-error/#findComment-1136258 Share on other sites More sharing options...
Pikachu2000 Posted November 18, 2010 Share Posted November 18, 2010 You need to use mysqli_real_escape_string() with a mysqli connection call. You can't mix and match the two. Link to comment https://forums.phpfreaks.com/topic/219113-mysql_real_escape_string-error/#findComment-1136259 Share on other sites More sharing options...
heldenbrau Posted November 18, 2010 Author Share Posted November 18, 2010 Thanks, working now. Link to comment https://forums.phpfreaks.com/topic/219113-mysql_real_escape_string-error/#findComment-1136325 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.