Click here to Skip to main content
15,887,683 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi everyone! I have a problem in My system, the problem is when I send My data I leave this error, and I don't know why it happens:


Fatal error: Uncaught Error: Call to undefined function mysql_query() in C:\xampp\htdocs\clinica\dise\searchData.php:8 Stack trace: #0 {main} thrown in C:\xampp\htdocs\clinica\dise\searchData.php on line 8

And this is my code PHP:
		<?php  
include("../conex.php"); 

$pass=$_POST['pass'];
$id=$_POST['ci'];

$conexion = mysqli_connect("localhost","root","", "clini") or die("no hay conexion");
$register= mysql_query("SELECT * FROM usuario WHERE pass='$pass' AND identificacion='$id'");

 while($login=mysql_fetch_array($register)){
	 echo $login['id']." ".$login['name']." ".$login['last']." ".$login['nameDad']." ".$login['nameMom']."
	 ".$login['tipoIdentificacion']." ".$login['identificacion']." ".$login['telefono']." ".$login['email']." 
	 ".$login['address']." ".$login['born']." ".$login['rango']." ".$login['estadoC']." ".$login['sex']."
	 ".$login['pass']." ".$login['fechaReg'];
 }

?> 


What I have tried:

I tried some things in other forus but nothing
Posted
Updated 18-Nov-21 5:51am
Comments
Richard Deeming 18-Nov-21 12:04pm    
Your code is vulnerable to SQL Injection[^]. NEVER use string concatenation to build a SQL query. ALWAYS use a parameterized query.
PHP: SQL Injection - Manual[^]
PHP: Prepared statements and stored procedures - Manual[^]
Richard Deeming 18-Nov-21 12:04pm    
You're storing passwords in plain text. Don't do that.
Secure Password Authentication Explained Simply[^]
Salted Password Hashing - Doing it Right[^]

PHP even has built-in methods to help you do the right thing.
PHP: password_hash[^]
PHP: password_verify[^]

1 solution

See the notes at PHP: mysql_query - Manual[^].
 
Share this answer
 
Comments
XEmmanuel21 18-Nov-21 12:00pm    
But leave other error is this:
Warning: mysqli_query() expects at least 2 parameters, 1 given in C:\xampp\htdocs\clinica\dise\searchData.php on line 8

Fatal error: Uncaught Error: Call to undefined function mysql_fetch_array() in C:\xampp\htdocs\clinica\dise\searchData.php:10 Stack trace: #0 {main} thrown in C:\xampp\htdocs\clinica\dise\searchData.php on line 10
Richard MacCutchan 18-Nov-21 12:18pm    
You are missing the connection parameter in your call to mysqli_query.
You need to change all your calls to use the correct function names.

The link I gave you above is at the MySQL documentation site, so you should go there to check the correct function names and parameter requirements.

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