Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange
Make your voice heard. Take the 2019 Developer Survey now

Questions tagged [mysqli]

Referred to as the MySQLi extension or MySQL improved extension. Allows access to additional features provided in MySQL 4.1.3 and newer. It is included with PHP version 5 and later.

1
vote
1answer
8 views

Get related columns depending on a ID

I have a table with a m:n (many to many) relationship. Basically, if I select an article_id, I want to return all the other articles that have the same tag_id as the selected article_id. | article_id ...
0
votes
1answer
21 views

Why is this blob saving when used as a concatenated string but not as a prepared statement

I have a PHP mysqli prepared statement that looks like this: $editSQL = "UPDATE tblClientReminders SET Header = ?, Notes = ?, DepartmentID = ?, TierID = ?, RemindType =...
1
vote
1answer
34 views

Searching through dates query not working?

I'm trying to query the recent week rows by using dates. BUT the query is not returning any result. It takes forever to execute. I checked my DataBase where date is saved in 1446976737 format which ...
0
votes
1answer
82 views

Rolling up multiple rows into a single row and column from two tables

Here is my code SELECT register cr.id, register_cr.first_name, register_cr.father_name, register_cr.surname, register_cr....
2
votes
1answer
76 views

How to select multiple item from database

Please help me. How to select student result from databese using multiple select. But not work....... My Student Database like - std_profile id StudentId stdName stdRoll stdClass 1 ...
-1
votes
1answer
34 views

join 2 table and the value in a specific manner

I have 2 table one is master and another one is the child, now I want to write a query in such a way that all the value from the master should display and the count of that particular parent id row ...
0
votes
0answers
16 views

Access MYSQL database in HIPAA compliant hosting from different hosting

I have a requirement which is described in the diagram. Now what i want to do is, I want access the mysql database in HIPAA compliant hosting from source one & other websites via new mysqli('host',...
0
votes
0answers
493 views

PHP+Mysqli Auto Increment after deleting a row in a user-interface table

** I have a table with add edit delete, if I delete one row,(example I deleted an 8th row, after refresh it should show me 8,9, and not 7,9)in middle, automatically it should change to next value. **...
1
vote
2answers
285 views

Avoid Sql Conflicts When Inserting data At Same Time

Let suppose I have a query that runs multiple times because it is in a while loop which inserts data into a table. INSERT INTO <table>( psuiKey, group_id) VALUES ('54ds8a784daEd','1'); The ...
0
votes
1answer
169 views

MySQLI stored procedure return PK/AI insertID

I am using a PHP framework called CodeIgniter for my application. This is using the MySQLI driver for its database work. This framework has built in support for things like a query builder where I ...
0
votes
1answer
1k views

SUM of column by GROUP BY which is WHithin a GROUP BY [closed]

i want to display the rows GROUP BY main Reference Id and then show the amount GROUP BY type. this my query SELECT gl.`drcr`,gl.`amount`,gl.`name`,gl.`type`, gl.`narration`,gl.`main_reference`...
0
votes
0answers
125 views

multiple queries to multi_query while checking for affected rows

So I have the following update and conditional insert queries: mysqli_query($con,"UPDATE ulogs SET invalid_hits = invalid_hits + 1 WHERE auser_id = $alink AND date = '$edate'"); if(...
1
vote
2answers
784 views

mysqli large amount of connections

I run a php site with mysqli. I got 3551496 Connections, but there were only 30 processes How can It be What should I do about it? The server is up for 6 month, The problem is that I keep getting ...
3
votes
0answers
33 views

Query to send users message within a crm

I need help understanding the logic of a query I`m trying to write. I want the employees to be able to message other employees. I need the employee to see the list of all employees he can send ...
3
votes
1answer
763 views

PHP MySQLi Lock Tables Query Sometimes Does Not Complete

I am attempting to lock some tables while running some code and unlocking the tables when I am done. Process: Run Lock Tables MySQL Query. Run some PHP Code. Run Unlock Tables MySQL Query. While ...
0
votes
2answers
290 views

Between Operator for varchar datatype

I have column 'hdd' having values '1GB','500GB,''1TB' and '100TB' When retrieving rows where value between 1TB and 100 TB like this: select * from product where hdd between '1TB' and '100TB' It ...
2
votes
1answer
5k views

Simplest way to check if current user has permission to a MySQL table (from PHP / mysqli) for some desired operation?

While using an already established mysqli connection to a MySQL database from PHP, I'm looking for a simple way to check if this connection (i.e. the authenticated user for this connection, if any) ...
-3
votes
1answer
25 views

Fetch data from three tables two tables have one same column [closed]

I have three tables a,b,c table a sender status type name1 approved one name1 approved one name1 approved two name2 pending one table b sender p_id name1 001 ...
0
votes
1answer
259 views

mysqli importer file - disable foreign keys

I am using this script to import a mysql file but I want to set foreign key checks to 0 when he will do the import. https://github.com/davcs86/php-mysqlimporter/blob/master/php-mysqlimporter.php ...
0
votes
3answers
3k views

Searching for a keyword across multiple columns

I have a set of names of schools stored in each row in my schools table. the same table has four different category columns which store the names of the subjects they offer. I want to enable ...
0
votes
1answer
128 views

How to find the most common phrases in a MySQL database

I have a table which contains articles on movies. Each article has a title and many of them have common phrases in them. I would like to do some analysis on the data and extract these common phrases ...
1
vote
2answers
20k views

Commands out of sync; you can't run this command now

I have a query which was working fine a few days back: SELECT id, title, details, filetype, filepath, size, details, location, datetime, IF(hid=1, 'Anonymous', ( SELECT ...
3
votes
1answer
416 views

Different types of users in one table, How to add data off different users

I have 5 type of users: Super Admin Coordinator Supervisor Student External Examiner All of them have some common attributes like ID, name, email etc. I have inserted them in one table user ...
0
votes
1answer
48 views

MySQLi Tutorials [closed]

I have just finished building my site, and now it's time to finally put a database in it and actually connect it to a database. So far I have downloaded Xampp and installed everything and tested it. ...
1
vote
1answer
380 views

Store Mysql Index in separate .Ibd file?

Is there any option to store table index in separate .ibd file? something like file_per_table mode? Becuase my table is growing more than 200gb. Table .ibd file have index for that table also. so If ...
2
votes
1answer
104 views

Split Mysql Table internally

How to split the huge mysql table (size around 200GB) internally? Is there any mechanism other than partition? The table size is daily growing. Table created using innodb with indices. Thanks in ...
0
votes
1answer
10k views

Select last record from my table [closed]

I am new to SQL and PHP. I'm having a problem with selecting the last record from my table. I run the following query: SELECT * FROM 2521118 ORDER BY id DESC LIMIT 1 My table name is 2521118 and the ...
1
vote
1answer
304 views

Delete rows where matched value is twice as much

I'm trying to match two tables with two columns, table1 and table2. Each has id and price columns. I want the query to match each id and compare the price, then delete the row if the price in the ...
0
votes
1answer
61 views

How can I connect my other table using the mysqli_insert_id?

I've got a problem like this , I cannot get the id of the parent table . table_name : transaction_tbl - transaction_id -file_name -file_path -description table_name : transaction_details -...
0
votes
1answer
14k views

How to insert multiple values in a specific field in a table using mysqli?

I am working on a project and I I have a scenario like this: I have many field in my table : table_name : transaction_tbl -id -name -description -ref_number : text(datatype) In my inserting here is ...
-2
votes
1answer
23k views

Warning: mysqli_connect(): (HY000/1045): Access denied for user 'root'@'localhost' (using password: NO)

On my local WAMP stack things are working perfectly. When I upload the database on GOdaddy.com, this error shows up. Warning: mysqli_connect(): (HY000/1045): Access denied for user 'root'@'...
1
vote
1answer
2k views

Calculate total attendance for each workshop

I want to get overall attendance in each workshop. NumberOFWeeks column holds the number of weeks the workshop runs. for example Workshop 101 runs for 6 weeks meaning 6 days. So far I have done this ...
0
votes
1answer
2k views

Error: Incorrect usage of UNION and ORDER BY

I have this query: SELECT DISTINCT CONCAT (MONTH(`Date`),'-',YEAR(`Date`)) from wp_result_plugin WHERE Bet=2 AND month(`Date`) = EXTRACT(month FROM (NOW())) ORDER BY MONTH(`Date`) ASC UNION ...
0
votes
1answer
50 views

Returning auto-generated primary key after SQL insertion

I am trying to submit data to a database and then have it return the value of the user_id (primary key) created by the insertion, but I can't get it to return the value. I use the same query in ...
0
votes
0answers
52 views

How to group two query that have already been grouped

I am creating a chat system and i have two queries: The first query selects the Max(id) meaning the last message that has been received or sent by the member that is connected and that has not yet ...
0
votes
1answer
105 views

Update multiple meta_value with single query

Here is a similar structure of a table that I am working on. |--ID--|--user_id--|--meta_key---|--meta_value--| |--1 --|--444444---|--first_name-|------NULL----| |--2 --|--444444---|--last_name--|-----...
1
vote
1answer
3k views

Can't insert arabic text into mysql database using mysql prompt

I had a local table with arabic values.when exported i got the following query. DROP TABLE IF EXISTS `type`; CREATE TABLE IF NOT EXISTS `type` ( `bs_id` int(11) NOT NULL AUTO_INCREMENT, `types` ...
1
vote
1answer
109 views

Receiving duplicate results in one condition of JOINED query

I always end up here when Googling for solutions, so I thought I'd cut out the middleman since I'm unable to fix this via searching/forums. It's my first time posting, so please forgive any faux pas ...
6
votes
3answers
20k views

Get table name from union query?

This is my query SELECT Id, productName, Largeimagepath, Discount, Price, Image FROM tablename1 where Active =1 union SELECT Id, productName, Largeimagepath, Discount, Price, Image FROM tablename2 ...
0
votes
0answers
36 views

Packet and N-SubPacket Msql query ( same as catgeory and N sub catgeory )

First of i am PHP Developer , and working on huge project alone .i think i have made many mistake in creating table. and below is one of those. I am making packet type system when in my Packet Table ,...
0
votes
0answers
1k views

Mysql Insert taking too long. Table need optimzation

I have around 60 tables and a video table with over 600,000 rows. with 4 Btree and 2 FULLText Indexes and have around 30 Columns. Server Specs are high, over 30G of Ram, Intel Xeon Processor. Mysql ...
3
votes
1answer
3k views

Cannot change root access in MySQL to %

This is a new MySQL Server install. I created my root password as part of the setup (on Centos 6.4). When I connect to the server through a terminal, I can connect to MySQL and issue commands, using ...
2
votes
1answer
262 views

Changing Charset to utf8 for all the fields and tables in mysql

How should I use the mysql and awk to change the charset for all the fields and tables for a specific database? I did not include username or password, so for sure it will not work. Should I run it ...
1
vote
1answer
2k views

MySqli - select from db based on time difference with CURTIME() or SUBTIME()

I have a db with some customers data. There I store their last login time as datetime. I want to run a cron php script every min which will query mysqli for their last login datetime and if that was ...
3
votes
2answers
765 views

Should I use select count(*) for counting records or having a field like comments_no for tables like post, comments?

In my recent project which is about social networking for an Asian country, I'm in doubt whether I use the below SQL statement for counting records: SELECT COUNT(id) shareLikeNo FROM ...
1
vote
2answers
502 views

how to get count(*) from table which either has column or not?

I have a post table as below: CREATE TABLE `post` ( `p_id` smallint(5) unsigned NOT NULL AUTO_INCREMENT, `user_id` smallint(5) unsigned NOT NULL, `cat_id` tinyint(3) unsigned NOT NULL, `...