Click here to Skip to main content
15,868,016 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I"m getting

Fatal error: Uncaught Error: Call to undefined function mysql_real_escape_string() in C:\xampp\htdocs\project\trial.php:23 Stack trace: #0 {main} thrown in C:\xampp\htdocs\project\trial.php on line 23

please help me this is my 1st project so I'm not able to solve this
help me as soon as possible

What I have tried:

Insert of Row into Database Failed - #'.mysql_errno().': '.mysql_error().'

';
}else{
echo '

Person\'s Information Inserted

';
}

# Prepare the SELECT Query
$selectSQL = 'SELECT * FROM `guide`';
# Execute the SELECT Query
if( !( $selectRes = mysql_query( $selectSQL ) ) ){
echo 'Retrieval of data from Database Failed - #'.mysql_errno().': '.mysql_error();
}else{
?>

';
}else{
while( $row = mysql_fetch_assoc( $selectRes ) ){
echo "\n";
}
}
?>
Name Address Line 1 Address Line 2 Email Id
No Rows Returned
{$row['name']}{$row['addr1']}{$row['addr2']}{$row['mail']}
Posted
Updated 7-Jan-22 9:56am
v5
Comments
Richard Deeming 10-Jan-22 9:01am    
The fact that you're using the "escape string" functions instead of a properly parameterized query suggests that you're writing code which is vulnerable to SQL Injection[^].

PHP: SQL Injection - Manual[^]
PHP: Prepared statements and stored procedures - Manual[^]

1 solution

Whatever $result is, it's not what mysqli_num_rows is expecting. It's expecting an object of type mysqli_result, but you passed in something else.

The problem is above the code you posted, where $result is set to some value or object.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900