A
A
Apple_ins2016-11-25 00:02:52
PHP
Apple_ins, 2016-11-25 00:02:52

How to check if an element exists in the database?

Browser throws an error: Warning: mysql_query() expects parameter 1 to be string, object given in info.php on line 7
Error #02;

<?php
$connect = mysqli_connect(скрыто)
or die('Ошибка #01');
 
$cc = $_POST['info'];
$res1 = "SELECT * FROM user WHERE cc_user = 'cc'";
$res = mysql_query($connect,$res1) or die('Ошибка #02');
if(mysql_num_rows($res)){
echo 'Что-то достали';
}else{
echo 'Ничего нет';
}
 mysqli_close($connect);
 ?>

Help fix...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Vershinin, 2016-11-25
@Apple_ins

replace

$res = mysql_query($connect,$res1) or die('Ошибка #02');

on the
and
on
if(mysqli_num_rows($res)){

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question