mysqli

mysqli_num_rows($result)==0 returning error [duplicate]

旧街凉风 提交于 2019-12-25 19:56:21
问题 This question already has answers here : mysql_fetch_array()/mysql_fetch_assoc()/mysql_fetch_row()/mysql_num_rows etc… expects parameter 1 to be resource or result (32 answers) Closed 9 months ago . I am trying to create a change password page with this php script. I want to be able to tell the user whether or not they have put in the correct username and password so that it may be changed. When I check the rows, regardless if it returns rows or not, I always get this error: Warning: mysqli

wamp / php error Fatal error: Class 'mysqli_connect' not found in C:\wamp\www\finalproject\Connections\Main_DB.php on line 9 [duplicate]

情到浓时终转凉″ 提交于 2019-12-25 19:04:08
问题 This question already has answers here : Class 'mysqli_connect' not found (2 answers) Closed 4 years ago . hi could someone assist me in this issue. this is my connection string: <?php #FileName = "Connection_php_mysql.htm" #Type = "MYSQL" #HTTP = "true" $hostname_Main_DB = "localhost"; $database_Main_DB = "mydb"; $username_Main_DB = "root"; $password_Main_DB = ""; $con = new mysqli_connect($hostname_Main_DB,$username_Main_DB. $password_Main_DB, $database_Main_DB) or die ( "Failed to connect

Secure code with Mysqli [closed]

喜夏-厌秋 提交于 2019-12-25 18:54:45
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 5 years ago . Is this code good proteceted, and if not could you tell me how to secure that. I use Mysqli...Also I would like to someone show me how this can be exploited if it is not secure? if(isset($_POST['vrsta_predmeta']) AND !empty($_POST['vrsta_predmeta']) AND isset($_POST['res_text']) AND isset($_POST['glavni_dug'])

Php? PDO or mySQLi

强颜欢笑 提交于 2019-12-25 18:49:10
问题 Just writing a PHP website and using mySqli for my database connectivity. Really enjoying it as I can use Prepare statements and then do a $result = $stmt->get_result(); which loads results into an associated array. However, thought it best be time to upload a few pages and the DB to hosting site to test speed and such to find that it does not support the $stmt->get_result(); command, having it needing to use the mysqlnd driver which my host does not support. Looking into this nor does many

UNION mysql gives weird numbered results

穿精又带淫゛_ 提交于 2019-12-25 18:46:29
问题 I am combining tables to get all their latest entries. The first query below works fine. When I add a third table to it the results get weird. This one works: (SELECT AL.alID, AL.al_date AS ts FROM AL) UNION (SELECT MRA.mraNR, MRA.mra_date FROM MRA) ORDER BY ts DESC LIMIT 20 And gives result: AL.alID | ts 14864 | 2014-08-01 23:43:08 14865 | 2014-08-01 23:36:46 2401 | 2014-08-01 18:07:06 2401 | 2014-08-01 18:06:00 While, this query: (SELECT AL.alID, AL.al_date AS ts FROM AL) UNION (SELECT MRA

re SQL Injection Attack using MySQL, does this meet baseline requirements?

三世轮回 提交于 2019-12-25 18:42:20
问题 I have a Single Page Application in which the browser does all the logic work. Except for initial loading, the server is pretty much a fancy interface to the database. The browser sends data dictionary keys, column name / value pairs, and where clauses for SELECT, for example. The server assembles the parts into SQL, executes the queries, and replies. NEW: In a SELECT, for example, the table name and columns pulled are from the data dictionary - the browser supplies the data dictionary key

Login using PHP and mysqli

情到浓时终转凉″ 提交于 2019-12-25 18:37:29
问题 so I was trying to do a login with php and mysqli and this is how its going at the moment: $DBServer = 'X'; // ip o lo que sea $DBUser = 'X'; $DBPass = 'X'; $DBName = 'X'; $conn = new mysqli($DBServer, $DBUser, $DBPass, $DBName); if ($_POST['login']) { $usuario = (isset($_POST['usuario'])) ? $_POST['usuario'] : ''; $pass = (isset($_POST['pass'])) ? $_POST['pass'] : ''; if ($usuario == "" or $pass == "") { echo 'Rellena todos los campos'; } else { $query = "SELECT * FROM users WHERE user = ?

get data from ajax call

对着背影说爱祢 提交于 2019-12-25 18:35:03
问题 I have a selectbox where i can choose my clients and each client could have 1 or more sites, so when you change your client selection the sites selectbox should also change, but teh main problem is that i can't fill the sites selectbox with options. I thought it should be the best way to return an array or something. 回答1: I took a little bit of time but wrote something that might work and simple. Also if you're using AJAX you really don't need to have form tags. You can create form with dives

Query does not run when using mysqli_real_escape_string

百般思念 提交于 2019-12-25 18:32:37
问题 I'm converting an old script to be compliant with MySQLi and ran in to an issue... $link = mysqli_connect("localhost", "user", "password", "database"); if (mysqli_connect_errno()) { printf("Connect failed: %s\n", mysqli_connect_error()); exit(); } $myQuery = "INSERT INTO table (name, description) VALUES ('$name', '$description')"; if (!mysqli_query($link, $myQuery)) { printf('Error'); } else { printf('Success'); } mysqli_close($link); This works fine, no errors. But when I add the mysqli_real

mysqli_num_rows() expects parameter 1 to be mysqli_result, array given

谁说我不能喝 提交于 2019-12-25 18:14:09
问题 I've been trying to look deep into the script, but I still can't find the problem. here's the script global $con; $a= "SELECT id_list FROM list ORDER BY id_list"; $b = mysqli_query($con, $a); $c= mysqli_fetch_assoc($b); if(mysqli_num_rows($c)==0){ echo'0'; }else{ echo '1'; } the error that appear is mysqli_num_rows() expects parameter 1 to be mysqli_result, array given thank you in advance. 回答1: You have use mysqli_result parameter so mysqli_num_rows($b) . read manual here link 来源: https:/