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? Quote 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 Quote 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. Quote 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. Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.