PHP from 5.6 to 7.2 advice [duplicate] - php

This question already has answers here:
MySQLi equivalent of mysql_result()?
(12 answers)
How to change mysql to mysqli?
(12 answers)
Closed 11 months ago.
Fatal error: Call to undefined function mysqli_result()
I am having some issues migrating old code from Php 5.6 to 8 (I know, I'm late !).
The initial code was:
$datama=mysql_query("SELECT COUNT(*) as TOTALFOUNDA FROM errorlog WHERE IP ='$ff' and datenow>'$last' and counting='3'");
$anymatchesa=mysql_result($datama,0,"TOTALFOUNDA");
And I came up with this (the connexion to the DB with $conx is OK) :
$datama=mysqli_query($conx,"SELECT COUNT(*) as TOTALFOUNDA FROM errorlog WHERE IP ='$ff' and datenow>'$last' and counting='3'");
$anymatchesa=mysqli_result($datama,0,"TOTALFOUNDA");
But I get an error
Fatal error: Call to undefined function mysqli_result()...

Related

How can i Solve this error : Uncaught Error: Call to undefined function mysql_real_escape_string() [duplicate]

This question already has answers here:
mysql_real_escape_string is undefined
(5 answers)
How can I prevent SQL injection in PHP?
(27 answers)
Why shouldn't I use mysql_* functions in PHP?
(14 answers)
Closed 1 year ago.
I am using PHP 8.0 Version but recently i get this error :
Uncaught Error: Call to undefined function mysql_real_escape_string()
is there any solution for this ?
mysql_real_escape_string was DEPRECATED in PHP 5.5.0 and REMOVED in PHP 7.0.0.¹
PHP recommends using MySQLi or PDO instead.
¹ https://www.php.net/manual/en/function.mysql-real-escape-string.php

I have problem with php code connecting to MySQL [duplicate]

This question already has answers here:
Can I mix MySQL APIs in PHP?
(4 answers)
Closed 3 years ago.
I want to print all database name list that are in my wamp server mysql
and I'm getting some errors
$link_id=mysqli_connect('localhost','root',"");
$a=mysql_list_dbs($link_id);
while($row = mysqli_fetch_object($a))
{
echo $row->Database."<br>";
}
( ! ) Fatal error: Uncaught Error: Call to undefined function mysql_list_dbs() in C:\wamp64\www\connection.php on line 3
( ! ) Error: Call to undefined function mysql_list_dbs() in C:\wamp64\www\connection.php on line 3
You can not mix mysql_* and mysqli_* functions, they are two different APIs. The mysql_* functions have been deprecated and should no longer be used. mysqli_* doesn't have an equivalent function, but you can do mysqli_query($link_id, 'SHOW DATABASES') and then iterate over the results. See mysqli_query() for examples.

session_start(); causing 500 internal error [duplicate]

This question already has answers here:
Reference - What does this error mean in PHP?
(38 answers)
How can I get useful error messages in PHP?
(41 answers)
What does the PHP error message "Notice: Use of undefined constant" mean?
(2 answers)
How can I make PHP display the error instead of giving me 500 Internal Server Error [duplicate]
(7 answers)
Closed 3 years ago.
I am trying to restore my old site which was built on PHP 5.6;
the following code is causing a 500 Error It has something to do with the session_start however I don't know how I can fix this to work.
Please could someone take a look and find a possible solution.
<?php
session_start();
include('_config/logged-out.php');
$login = clean($_GET[login]);
if(isset($_SESSION[usr_name]) && isset($_SESSION[usr_level]) && login!=logout) echo('<meta http-equiv="refresh" content="0;url=https://example.com" />'); else { } ?>

php Fatal error: Can't use function return value in write context in functions.php [duplicate]

This question already has answers here:
Reference - What does this error mean in PHP?
(38 answers)
Closed 6 years ago.
getting this php fatal error on this line when try apply theme
case('homeimage_texts'):
if(!empty(Params::getParam('homeimage'))){
foreach(Params::getParam('homeimage',false,false,false) as $key => $value){
osc_set_preference($key,trim($value),'osclasswizards_theme');
}
}
osc_add_flash_ok_message(__('Banner settings updated correctly', OSCLASSWIZARDS_THEME_FOLDER), 'admin');
osc_redirect_to(osc_admin_render_theme_url('oc-content/themes/'.OSCLASSWIZARDS_THEME_FOLDER.'/admin/settings.php#banner'));
break;
It looks like a PHP version issue. I you are using PHP 5.3 or below you may get this error message.

Common undefined index error in PHP [duplicate]

This question already has answers here:
Reference - What does this error mean in PHP?
(38 answers)
Closed 9 years ago.
When I am using my code in wamp (old php 3.2 may be) there is no warning or note but when I run the same code it is giving me a warning or a note:
Notice: Undefined index: emailseaech in
C:\xampp\htdocs\employee\RecruitingProcess\manageuser\pages\defaultresume.php
on line 6
for this
$emailseaech = $_GET["emailseaech"];
I am using ajax http to read the date passing value.
$emailseaech = '';
if(!empty($_GET["emailseaech"]))
$emailseaech=$_GET["emailseaech"];

Categories