mysqli

How to call a stored procedure within another stored procedure (PHP and mysqli)

旧时模样 提交于 2019-12-25 11:46:11
问题 I am struggling to call a stored procedure within another stored procedure. Like it is now the stored procedure never return the SELECT statement back as a result to the mysqli call in PHP (but it works fine in MySQL workbench). DELIMITER $$ CREATE DEFINER=`root`@`localhost` PROCEDURE `new_bid`(IN bid_in decimal(6,2), IN ticker_in varchar(5), IN share_amount_in BIGINT) BEGIN DECLARE company_id_var INT; DECLARE highest_bid BIT; DECLARE generated_bid_id BIGINT; SET company_id_var = (SELECT ID

How to call a stored procedure within another stored procedure (PHP and mysqli)

江枫思渺然 提交于 2019-12-25 11:45:10
问题 I am struggling to call a stored procedure within another stored procedure. Like it is now the stored procedure never return the SELECT statement back as a result to the mysqli call in PHP (but it works fine in MySQL workbench). DELIMITER $$ CREATE DEFINER=`root`@`localhost` PROCEDURE `new_bid`(IN bid_in decimal(6,2), IN ticker_in varchar(5), IN share_amount_in BIGINT) BEGIN DECLARE company_id_var INT; DECLARE highest_bid BIT; DECLARE generated_bid_id BIGINT; SET company_id_var = (SELECT ID

Looping through query results multiple times with mysqli_fetch_array?

杀马特。学长 韩版系。学妹 提交于 2019-12-25 11:44:09
问题 Does the mysqli_fetch_array() function remove each value as it returns it? If not, how can I go back to the top of the array when I've finished looping through it? I need to loop through the list several times, as I'm using it to generate unique usernames (by adding numbers to the end if it's already taken). $uniqueName = true; while($row = mysqli_fetch_array($namesList)) { if ($row['Username'] == $UserBase) { $uniqueName = false; } } $number = 0; if ($uniqueName == true) { $User = $UserBase;

bind_param on a non-object [closed]

六月ゝ 毕业季﹏ 提交于 2019-12-25 11:18:12
问题 This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center. Closed 6 years ago . I'm getting this error and have no clues why: Fatal error: Call to a member function bind_param() on a non-object $string = file_get_contents($url, false

Checkboxes are checking out randomly

六月ゝ 毕业季﹏ 提交于 2019-12-25 10:17:09
问题 I've got a question. I've got a page with hundreds of checkboxes wich are generated with the Database. So when the database returns 1 it is checked otherwise it is 0 and not checked. When I try to check the checkbox and try to update that into the database, some checkboxes are randomly checking out.. Code: This is the Query if(isset($_POST['submit'])){ foreach ($_POST['untrain[{$room->room_id}]'] as $room_id) { // This query needs protection from SQL Injection! $user_id; $room_id;

Checkboxes are checking out randomly

本小妞迷上赌 提交于 2019-12-25 10:17:03
问题 I've got a question. I've got a page with hundreds of checkboxes wich are generated with the Database. So when the database returns 1 it is checked otherwise it is 0 and not checked. When I try to check the checkbox and try to update that into the database, some checkboxes are randomly checking out.. Code: This is the Query if(isset($_POST['submit'])){ foreach ($_POST['untrain[{$room->room_id}]'] as $room_id) { // This query needs protection from SQL Injection! $user_id; $room_id;

Using MySQLI how can I display data from my database on my website

馋奶兔 提交于 2019-12-25 09:34:42
问题 I have long procrastinated switching to MySQLI from MySQL. I have started a new project and decided I'd rather go ahead and start it off with good habits instead of bad ones with deprecated MySQL. I am trying to figure out how to iterate through a table in my database and display that data on my website. The process, I am sure, is straight forward but the explanation so you will understand the question is less so. I will try to be brief. Example: I have a database named DATABASE that contains

Mysql error handling/Try catch

…衆ロ難τιáo~ 提交于 2019-12-25 09:27:55
问题 If table column does not exist mysql shows error .How to fix it using try catch or error handling method Thanks 回答1: you can handle the mysql error in this way if ( ! $this->db->query('SELECT `name`,`age` FROM `example`')) { $error = $this->db->error(); // Has keys 'code' and 'message' } 来源: https://stackoverflow.com/questions/44732546/mysql-error-handling-try-catch

mysqli_select_db() expects exactly 2 parameters

柔情痞子 提交于 2019-12-25 09:19:02
问题 Getting the errors: Warning: mysqli_select_db() expects exactly 2 parameters, 1 given in C:\Users\root\Desktop\WebServer\htdocs\test.php on line 9 Warning: mysqli_query() expects at least 2 parameters, 1 given in C:\Users\root\Desktop\WebServer\htdocs\test.php on line 13 Warning: mysqli_fetch_assoc() expects parameter 1 to be mysqli_result, null given in C:\Users\root\Desktop\WebServer\htdocs\test.php on line 39 I can't notice the problem, kind of new to this, can anyone see the problem? Any

how to update table row data with unique id?

南笙酒味 提交于 2019-12-25 09:09:27
问题 code: <?php if(isset($_POST['save'])) { $comment1 = $_POST['comment2'].",".date('Y-m-d'); $comment2 = $_POST['comment2']; $id = $_POST['id']; $query = "update enquires2 set comment1 = '$comment1', comment2 = '$comment2', s_date = '$s_datee' where id='$id'"; $result = mysqli_query($link,$query); if($result==true) { echo "successfull"; } else { echo "error!"; } } ?> <form method="post" name="myform"> <table> <tr> <th>comment1</th> <th>comment2</th> <th>Action</th> </tr> <?php $sql = "select *