mysqli

Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, object given in

你离开我真会死。 提交于 2020-05-14 04:02:11
问题 I'm got a little bit problem when I try to run this code. My problem is on line 32 : 回答1: Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, object given in mysqli_fetch_array's 1st parameter must be a result of a query. what you are doing is you are you are passing the connection(which doesnt makes sense) and the query command itself. read the doc here: http://php.net/manual/en/mysqli-result.fetch-array.php to fix this, execute the query first, then store the result to a

How are mysqli_connect Arguments optional?

坚强是说给别人听的谎言 提交于 2020-05-09 10:04:59
问题 According to w3schools.com, all the arguments of the mysqli_connect function are optional: mysqli_connect($host,$username,$password,$dbname,$port,$socket); What does it mean to be 'Optional'? What don't I understand is how can we skip any of those values and let it use the default values? Thanks in advance. 回答1: You can specify default MySQL credentials straight in the php.ini configuration file. Please see http://php.net/manual/en/mysqli.configuration.php#ini.mysqli.default-port as a

How are mysqli_connect Arguments optional?

那年仲夏 提交于 2020-05-09 10:04:32
问题 According to w3schools.com, all the arguments of the mysqli_connect function are optional: mysqli_connect($host,$username,$password,$dbname,$port,$socket); What does it mean to be 'Optional'? What don't I understand is how can we skip any of those values and let it use the default values? Thanks in advance. 回答1: You can specify default MySQL credentials straight in the php.ini configuration file. Please see http://php.net/manual/en/mysqli.configuration.php#ini.mysqli.default-port as a

PHP 7.2.1, Uncaught Error: Class 'mysqli' not found [duplicate]

╄→尐↘猪︶ㄣ 提交于 2020-05-09 06:56:25
问题 This question already has answers here : How to solve “Fatal error: Class 'MySQLi' not found”? (19 answers) Closed 2 years ago . in the first place it seems like I do not have mysqli installed, after running this if: if (!function_exists('mysqli_init') && !extension_loaded('mysqli')) { echo 'We don\'t have mysqli!!!'; } else { echo 'Phew we have it!'; } It returned the "we don't have mysqli!!!". So after looking on how to install this I couldn't really find a way, after visiting http://php

automatically create new pages with php and mysqli

微笑、不失礼 提交于 2020-05-08 19:00:27
问题 still getting my feet wet with php and mysqli, have so much to learn, but at this point this question is one of my most important priorities. I did some research about this issue but am currently overwhelmed by pretty sophisticated stuff for my level, to be honest. I'd like to find the simplest most efficient way to "automatically" generate a great number of pages each with varying data in it. the example of page 1's code below is extremely simplified, because the actual page actually has a

Multiple Prepared statements in PHP with MySQLi

喜夏-厌秋 提交于 2020-05-08 09:21:26
问题 I want to do two prepared statements, one right after the other in PHP with MySQLi. I am a novice at PHP and MySQLi so I don't know whether I should close the statement, close the database connection, put all of the code in a function, or just have code not inside a function. Basically I just want to insert a record into one table and then insert the same record into another table using MySQLi. Thanks! 回答1: Directly off the mysqli page: http://php.net/manual/en/mysqli.commit.php <?PHP mysqli

Multiple Prepared statements in PHP with MySQLi

北慕城南 提交于 2020-05-08 09:20:44
问题 I want to do two prepared statements, one right after the other in PHP with MySQLi. I am a novice at PHP and MySQLi so I don't know whether I should close the statement, close the database connection, put all of the code in a function, or just have code not inside a function. Basically I just want to insert a record into one table and then insert the same record into another table using MySQLi. Thanks! 回答1: Directly off the mysqli page: http://php.net/manual/en/mysqli.commit.php <?PHP mysqli

PHP MySQLi Asynchronous Queries with

假如想象 提交于 2020-05-07 11:36:27
问题 I am trying to use asynchronous queries via PHP MySQLi. The following code has been simplified, the original is code is too verbose to list here because of class dependencies and all that. Also please assume the reference to the connection mysqli_handle has already been setup. $query_1 = "SHOW TABLES FROM moxedo"; $query_2 = "CREATE TABLE `moxedo`.`mox_config_n85ad3` (`id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT , `group_id` INT(3) UNSIGNED NOT NULL , `is_enabled` INT(1) UNSIGNED NOT NULL ,

How can I get an unknown username given an ID?

最后都变了- 提交于 2020-05-03 04:14:32
问题 I got a numerical ID of 20 characters witch looks like 10527391670258314752 , given this ID, how can I get the username associated with it? The table looks like this: id | name | password | balance 10527391670258314752 | Jhon | 12345 | 12.51 The username retrieved from the database should then be stored into $_SESSION['name'] . I've tried this: $connection = mysqli_connect('localhost', 'root', '', 'user_data'); $id = '10527391670258314752'; $query = "SELECT username FROM user_data WHERE id =

How can I get an unknown username given an ID?

二次信任 提交于 2020-05-03 04:11:28
问题 I got a numerical ID of 20 characters witch looks like 10527391670258314752 , given this ID, how can I get the username associated with it? The table looks like this: id | name | password | balance 10527391670258314752 | Jhon | 12345 | 12.51 The username retrieved from the database should then be stored into $_SESSION['name'] . I've tried this: $connection = mysqli_connect('localhost', 'root', '', 'user_data'); $id = '10527391670258314752'; $query = "SELECT username FROM user_data WHERE id =