PABLO2013 Well-Known Member Licensed User Longtime User Sep 28, 2018 #1 I would appreciate if you can help me with this error ... I have tried to resolve it, but no. Perform a database restore and now it does not connect ... I do not know the reason. it seems that the credentials are correct thanks Code: [28-Sep-2018 08:31:26 America/Los_Angeles] PHP Fatal error: Uncaught Error: Call to undefined function mysql_connect() in /registro.php:8 Stack trace: #0 {main} thrown in /registro.php on line 8 [28-Sep-2018 08:31:48 America/Los_Angeles] PHP Fatal error: Uncaught Error: Call to undefined function mysql_connect() in /registro.php:8 Stack trace: #0 {main} thrown in /registro.php on line 8 Code: <? $databasehost = "mysql"; $databasename = "REGISTROxxxxxx"; $databaseusername ="xxxx"; $databasepassword = "xxxxx"; $con = mysql_connect($databasehost,$databaseusername,$databasepassword) or die(mysql_error()); mysql_select_db($databasename) or die(mysql_error()); mysql_query("SET CHARACTER SET utf8"); $query = file_get_contents("php://input"); $sth = mysql_query($query); if (mysql_errno()) { header("HTTP/1.1 500 Internal Server Error"); echo $query.'\n'; echo mysql_error(); } else { $rows = array(); while($r = mysql_fetch_assoc($sth)) { $rows[] = $r; } print json_encode($rows); } ?> Code: job.PostString("http://www.xxxxxxxr.com/registro.php", Query) Query = SELECT * FROM AVxxxxxOPRESUPUESTO
I would appreciate if you can help me with this error ... I have tried to resolve it, but no. Perform a database restore and now it does not connect ... I do not know the reason. it seems that the credentials are correct thanks Code: [28-Sep-2018 08:31:26 America/Los_Angeles] PHP Fatal error: Uncaught Error: Call to undefined function mysql_connect() in /registro.php:8 Stack trace: #0 {main} thrown in /registro.php on line 8 [28-Sep-2018 08:31:48 America/Los_Angeles] PHP Fatal error: Uncaught Error: Call to undefined function mysql_connect() in /registro.php:8 Stack trace: #0 {main} thrown in /registro.php on line 8 Code: <? $databasehost = "mysql"; $databasename = "REGISTROxxxxxx"; $databaseusername ="xxxx"; $databasepassword = "xxxxx"; $con = mysql_connect($databasehost,$databaseusername,$databasepassword) or die(mysql_error()); mysql_select_db($databasename) or die(mysql_error()); mysql_query("SET CHARACTER SET utf8"); $query = file_get_contents("php://input"); $sth = mysql_query($query); if (mysql_errno()) { header("HTTP/1.1 500 Internal Server Error"); echo $query.'\n'; echo mysql_error(); } else { $rows = array(); while($r = mysql_fetch_assoc($sth)) { $rows[] = $r; } print json_encode($rows); } ?> Code: job.PostString("http://www.xxxxxxxr.com/registro.php", Query) Query = SELECT * FROM AVxxxxxOPRESUPUESTO
KMatle Expert Licensed User Longtime User Sep 28, 2018 #2 There were some changes in PHP/MySQL: Code: $con = mysqli_connect($host,$user,$pw) or die(mysqli_error()); mysqli_select_db($con,$db) or die(mysqli_error()); mysqli_query($con,"SET CHARACTER SET utf8"); mysqli_query($con,"SET NAMES 'utf8'"); Note the i Code: mysqli_query Warning: This function has been DEPRECATED as of PHP 5.3.0 and REMOVED as of PHP 5.4.0. Click to expand... Upvote 0
There were some changes in PHP/MySQL: Code: $con = mysqli_connect($host,$user,$pw) or die(mysqli_error()); mysqli_select_db($con,$db) or die(mysqli_error()); mysqli_query($con,"SET CHARACTER SET utf8"); mysqli_query($con,"SET NAMES 'utf8'"); Note the i Code: mysqli_query Warning: This function has been DEPRECATED as of PHP 5.3.0 and REMOVED as of PHP 5.4.0. Click to expand...
DonManfred Expert Licensed User Longtime User Sep 28, 2018 #3 Probably because of an Update of the PHP version running on the server. PABLO2013 said: mysql_connect() Click to expand... All mysql_* classes are deprecated. Switch to mysqli classes. Edit: See @KMatle answer above this. Upvote 0
Probably because of an Update of the PHP version running on the server. PABLO2013 said: mysql_connect() Click to expand... All mysql_* classes are deprecated. Switch to mysqli classes. Edit: See @KMatle answer above this.
PABLO2013 Well-Known Member Licensed User Longtime User Sep 28, 2018 #4 kMatle kMatle What you tell me is to change Thanks DonManfred thanks kMatle Code: $con = mysql_connect($databasehost,$databaseusername,$databasepassword) or die(mysql_error()); mysql_select_db($databasename) or die(mysql_error()); mysql_query("SET CHARACTER SET utf8"); $query = file_get_contents("php://input"); $sth = mysql_query($query); by Code: $con = mysqli_connect($host,$user,$pw) or die(mysqli_error()); mysqli_select_db($con,$db) or die(mysqli_error()); mysqli_query($con,"SET CHARACTER SET utf8"); mysqli_query($con,"SET NAMES 'utf8'"); tks Upvote 0
kMatle kMatle What you tell me is to change Thanks DonManfred thanks kMatle Code: $con = mysql_connect($databasehost,$databaseusername,$databasepassword) or die(mysql_error()); mysql_select_db($databasename) or die(mysql_error()); mysql_query("SET CHARACTER SET utf8"); $query = file_get_contents("php://input"); $sth = mysql_query($query); by Code: $con = mysqli_connect($host,$user,$pw) or die(mysqli_error()); mysqli_select_db($con,$db) or die(mysqli_error()); mysqli_query($con,"SET CHARACTER SET utf8"); mysqli_query($con,"SET NAMES 'utf8'"); tks
PABLO2013 Well-Known Member Licensed User Longtime User Sep 28, 2018 #5 Thank you this came from an update and restoration of php and phpmyadmin and you are very right, thank you Upvote 0
Thank you this came from an update and restoration of php and phpmyadmin and you are very right, thank you
PABLO2013 Well-Known Member Licensed User Longtime User Sep 28, 2018 #6 KMatle sorry, you have a version for this same or example ... no php programming ... thanks Upvote 0
DonManfred Expert Licensed User Longtime User Sep 28, 2018 #7 If you need a good MySQLi-Class (Compatible with PHP 7): Here Upvote 0
PABLO2013 Well-Known Member Licensed User Longtime User Sep 28, 2018 #8 tks Manfred, i will try it....tks Upvote 0
PABLO2013 Well-Known Member Licensed User Longtime User Sep 28, 2018 #9 ?php $databasehost = "localhost"; $databasename = "xxxx"; $databaseusername ="xxxx"; $databasepassword = "xxxx"; $con = mysqli_connect($databasehost,$databaseusername,$databasepassword, $databasename) or die(mysqli_error($con)); mysqli_set_charset ($con , "utf8"); $query = file_get_contents("php://input"); $sth = mysqli_query($con, $query); if (mysqli_errno($con)) { header("HTTP/1.1 500 Internal Server Error"); echo $query.'\n'; echo mysqli_error($con); } else { $rows = array(); while($r = mysqli_fetch_assoc($sth)) { $rows[] = $r; } $res = json_encode($rows); echo $res; mysqli_free_result($sth); } mysqli_close($con); ?> Upvote 0
?php $databasehost = "localhost"; $databasename = "xxxx"; $databaseusername ="xxxx"; $databasepassword = "xxxx"; $con = mysqli_connect($databasehost,$databaseusername,$databasepassword, $databasename) or die(mysqli_error($con)); mysqli_set_charset ($con , "utf8"); $query = file_get_contents("php://input"); $sth = mysqli_query($con, $query); if (mysqli_errno($con)) { header("HTTP/1.1 500 Internal Server Error"); echo $query.'\n'; echo mysqli_error($con); } else { $rows = array(); while($r = mysqli_fetch_assoc($sth)) { $rows[] = $r; } $res = json_encode($rows); echo $res; mysqli_free_result($sth); } mysqli_close($con); ?>
KMatle Expert Licensed User Longtime User Sep 28, 2018 #10 Now you must protect the script against SQL injection. Take a Google search. See "Prepared Statements". Upvote 0
Now you must protect the script against SQL injection. Take a Google search. See "Prepared Statements".
PABLO2013 Well-Known Member Licensed User Longtime User Sep 28, 2018 #11 kmatle you say me : Now you must protect the script against SQL injection. But what is the main idea of this,i check about Prepared Statements, but I do not understand the main idea, could you tell me, thanks. I tell you to make a small security for my application ... basically take the serial of the device and compare it with serials previously added to the database .. in this case, as would be the general idea of Prepared Statements, if you have a basic example , thank you very much for your help, now my application came back to work a bit unstable ... but I'm trying to see what happens. Thank you Last edited: Sep 28, 2018 Upvote 0
kmatle you say me : Now you must protect the script against SQL injection. But what is the main idea of this,i check about Prepared Statements, but I do not understand the main idea, could you tell me, thanks. I tell you to make a small security for my application ... basically take the serial of the device and compare it with serials previously added to the database .. in this case, as would be the general idea of Prepared Statements, if you have a basic example , thank you very much for your help, now my application came back to work a bit unstable ... but I'm trying to see what happens. Thank you