# MySQL database

**URL:** https://www.phphelp.com/c/mysql-database/6.md?page=2

[Latest](https://www.phphelp.com/latest.md) · [Categories](https://www.phphelp.com/categories.md)

**Page:** 3

---

## [MySQL warning about INSERT INTO VALUES()](https://www.phphelp.com/t/mysql-warning-about-insert-into-values/34007)

<div class="topic-metadata">

**Author:** [@Pedroski55](https://www.phphelp.com/u/Pedroski55)\
**Replies:** 2\
**Last updated:** [September 26, 2021, 6:24pm UTC](https://www.phphelp.com/t/mysql-warning-about-insert-into-values/34007 "2021-09-26T18:24:43Z")

</div>

Lately, just on my home computer, I get this warning when I use INSERT( …) VALUES(…) Just as an example, say I have: $mysql = 'INSERT INTO allstudentsAnswers20BEHW(studentnr, name, weeknr, score, Answer1, Answer2, Ans…

---

## [Converting to PDO with AES\_ENCRYPT insert fails](https://www.phphelp.com/t/converting-to-pdo-with-aes-encrypt-insert-fails/33996)

<div class="topic-metadata">

**Author:** [@Waspman](https://www.phphelp.com/u/Waspman)\
**Replies:** 4\
**Last updated:** [September 23, 2021, 6:40pm UTC](https://www.phphelp.com/t/converting-to-pdo-with-aes-encrypt-insert-fails/33996 "2021-09-23T18:40:21Z")

</div>

Converting mysqli procedural to PDO style and everything works except one INSERT INTO statement, and I can’t see why it fails. Below is the bit of the script where it fails (I have changed it to use javascript alerts wh…

---

## [I have a mysqli dbh file and i am getting an error for line 8](https://www.phphelp.com/t/i-have-a-mysqli-dbh-file-and-i-am-getting-an-error-for-line-8/33951)

<div class="topic-metadata">

**Author:** [@DragonWitch101](https://www.phphelp.com/u/DragonWitch101)\
**Replies:** 14\
**Last updated:** [September 17, 2021, 1:20am UTC](https://www.phphelp.com/t/i-have-a-mysqli-dbh-file-and-i-am-getting-an-error-for-line-8/33951 "2021-09-17T01:20:02Z")

</div>

$servername = "host"; $dBUsername = ""; $dBPassword = ""; $dBName = ""; $conn = mysqli\_connect($servername,$dBUsername,$dBPassword,$dBName); if (!$conn) { die("Connection failed: ".mysqli\_connect\_error()); } l…

---

## [Check if value exist in db - new php version](https://www.phphelp.com/t/check-if-value-exist-in-db-new-php-version/33954)

<div class="topic-metadata">

**Author:** [@Neo71](https://www.phphelp.com/u/Neo71)\
**Replies:** 1\
**Last updated:** [September 16, 2021, 2:32pm UTC](https://www.phphelp.com/t/check-if-value-exist-in-db-new-php-version/33954 "2021-09-16T14:32:14Z")

</div>

in php 5 this code was correct // ceck if CF alredy exist $ctrl\_cf = @mysql\_query($db,“SELECT id FROM avvisi WHERE cf=’$cfavviso’”) or die(mysql\_error()); if(@mysql\_num\_rows($ctrl\_cf)\>0) { ?\> \<?php }else{ Now…

---

## [Best way to maintain secondary table](https://www.phphelp.com/t/best-way-to-maintain-secondary-table/33944)

<div class="topic-metadata">

**Author:** [@Waspman](https://www.phphelp.com/u/Waspman)\
**Replies:** 3\
**Last updated:** [September 14, 2021, 8:50pm UTC](https://www.phphelp.com/t/best-way-to-maintain-secondary-table/33944 "2021-09-14T20:50:03Z")

</div>

Have a main “personaldata” table and a linked “medicalinfo” table. Table structures are personaldata: id, forename, surname, birthdate, gender, address… etc. medicalinfo: id medinfo Everyone has a personaldata record…

---

## [Connect multiple tables with main table(phpmyadmin)](https://www.phphelp.com/t/connect-multiple-tables-with-main-table-phpmyadmin/33915)

<div class="topic-metadata">

**Author:** [@Mekaboo](https://www.phphelp.com/u/Mekaboo)\
**Replies:** 2\
**Last updated:** [September 9, 2021, 3:53am UTC](https://www.phphelp.com/t/connect-multiple-tables-with-main-table-phpmyadmin/33915 "2021-09-09T03:53:15Z")

</div>

Hey :blush: I have a main table (tbl\_member) that connects to login script but then I have various other tables for chat, forum, etc. How do I connect all the tables so they can function as one unit or do I have to add …

---

## [Newbie Needs A simple Database Created](https://www.phphelp.com/t/newbie-needs-a-simple-database-created/33818)

<div class="topic-metadata">

**Author:** [@WildFire2000](https://www.phphelp.com/u/WildFire2000)\
**Replies:** 14\
**Last updated:** [September 2, 2021, 7:57pm UTC](https://www.phphelp.com/t/newbie-needs-a-simple-database-created/33818 "2021-09-02T19:57:25Z")

</div>

I am a newbie when it comes to html, php and MySQL. I would like to know if someone can make a small sample program that will do the following: 1 Able to manually add a reference number 2 Able to add a name Then I wi…

---

## [Fetch single row from database using \`$\_GET\['MyVariable'\]; in PHP](https://www.phphelp.com/t/fetch-single-row-from-database-using-get-myvariable-in-php/33869)

<div class="topic-metadata">

**Author:** [@cekiw1999](https://www.phphelp.com/u/cekiw1999)\
**Replies:** 1\
**Last updated:** [September 1, 2021, 12:30pm UTC](https://www.phphelp.com/t/fetch-single-row-from-database-using-get-myvariable-in-php/33869 "2021-09-01T12:30:05Z")

</div>

I have this code from Github which fetches multiple rows from the database and returns Arrays of rows upon success. I don’t want to fetch multiple rows nor return arrays of rows. I only want to fetch a single row using $…

---

## [SQLSTATE\[HY000\] \[2019\] Unknown character set issue](https://www.phphelp.com/t/sqlstate-hy000-2019-unknown-character-set-issue/33864)

<div class="topic-metadata">

**Author:** [@Mekaboo](https://www.phphelp.com/u/Mekaboo)\
**Replies:** 6\
**Last updated:** [August 31, 2021, 6:11am UTC](https://www.phphelp.com/t/sqlstate-hy000-2019-unknown-character-set-issue/33864 "2021-08-31T06:11:36Z")

</div>

Hey all!! Got this error and made edits to my DB credentials in file but nothing is working. Trying to figure where the error is within my code but not successful. \<?php $dbservername=""; $dbuser=""; $d…

---

## [Copy columns from table1 to table2](https://www.phphelp.com/t/copy-columns-from-table1-to-table2/33840)

<div class="topic-metadata">

**Author:** [@Pedroski55](https://www.phphelp.com/u/Pedroski55)\
**Replies:** 1\
**Last updated:** [August 23, 2021, 11:57pm UTC](https://www.phphelp.com/t/copy-columns-from-table1-to-table2/33840 "2021-08-23T23:57:54Z")

</div>

Basically, I want to copy 3 columns from table1 to table2, which both have the same column names. My table1: allstudents20BE1 has 9 columns: id, studentnr, name, email, password, max\_attendance, attendance, has\_been\_inc…

---

## [Php mysql: I would like to create 3 tables connected by foreign keys and have the end user input the data from one form](https://www.phphelp.com/t/php-mysql-i-would-like-to-create-3-tables-connected-by-foreign-keys-and-have-the-end-user-input-the-data-from-one-form/33788)

<div class="topic-metadata">

**Author:** [@mukiria](https://www.phphelp.com/u/mukiria)\
**Replies:** 3\
**Last updated:** [August 2, 2021, 5:52pm UTC](https://www.phphelp.com/t/php-mysql-i-would-like-to-create-3-tables-connected-by-foreign-keys-and-have-the-end-user-input-the-data-from-one-form/33788 "2021-08-02T17:52:10Z")

</div>

I would like to create 3 tables connected by foreign keys and have the end user input the data from one form The tables are client, work, and accessories The sql file is below CREATE TABLE \`Work\` ( \`WorkId\` int(11) …

---

## [Mysqli multiple query](https://www.phphelp.com/t/mysqli-multiple-query/33758)

<div class="topic-metadata">

**Author:** [@Bpeter](https://www.phphelp.com/u/Bpeter)\
**Replies:** 2\
**Last updated:** [July 28, 2021, 12:11am UTC](https://www.phphelp.com/t/mysqli-multiple-query/33758 "2021-07-28T00:11:22Z")

</div>

I have a webshop database from which I need to extract image file names. An article number can have multiple filenames. The path of my code is as follows: I have to start from The SKU numbers, get the ID, if it is a chil…

---

## [Least case Stament with When then Result](https://www.phphelp.com/t/least-case-stament-with-when-then-result/33687)

<div class="topic-metadata">

**Author:** [@Book](https://www.phphelp.com/u/Book)\
**Replies:** 4\
**Last updated:** [July 7, 2021, 5:42pm UTC](https://www.phphelp.com/t/least-case-stament-with-when-then-result/33687 "2021-07-07T17:42:27Z")

</div>

i wrote a query to return the max value of multiple columns and then to return the name of the column with the max value, the query seems to be working except for 2 things it should exclude anything where the ‘qty’ colu…

---

## [Group multiple inputs with the same ID into a single row and insert it into new table](https://www.phphelp.com/t/group-multiple-inputs-with-the-same-id-into-a-single-row-and-insert-it-into-new-table/33641)

<div class="topic-metadata">

**Author:** [@sashavalentina](https://www.phphelp.com/u/sashavalentina)\
**Replies:** 2\
**Last updated:** [June 25, 2021, 8:57am UTC](https://www.phphelp.com/t/group-multiple-inputs-with-the-same-id-into-a-single-row-and-insert-it-into-new-table/33641 "2021-06-25T08:57:18Z")

</div>

I have a system that saves the user purchase into a table called ordered\_items. Where the purchase data will be saved into this table if the product stock available is more than the quantity that the user intended to pur…

---

## [How to limit/select database results shown on webpage?](https://www.phphelp.com/t/how-to-limit-select-database-results-shown-on-webpage/33573)

<div class="topic-metadata">

**Author:** [@anncf](https://www.phphelp.com/u/anncf)\
**Replies:** 7\
**Last updated:** [June 11, 2021, 12:23am UTC](https://www.phphelp.com/t/how-to-limit-select-database-results-shown-on-webpage/33573 "2021-06-11T00:23:34Z")

</div>

Hi! :blush: On my webpage I’m posting database inputs related to the UN sustainability goals. I have a page dedicated to each goal, but I only want to show subsidiary goals from my database relating to a specific goal. C…

---

## [Extract data](https://www.phphelp.com/t/extract-data/33565)

<div class="topic-metadata">

**Author:** [@mariusd](https://www.phphelp.com/u/mariusd)\
**Replies:** 5\
**Last updated:** [May 31, 2021, 8:27pm UTC](https://www.phphelp.com/t/extract-data/33565 "2021-05-31T20:27:06Z")

</div>

What would be the equation form to pull out the results for a field for the last 7 days? let’s say i would like to know what amount of data a user took over that period. The table field in the users table is known as do…

---

## [Issue with special characters not being converted properly](https://www.phphelp.com/t/issue-with-special-characters-not-being-converted-properly/33559)

<div class="topic-metadata">

**Author:** [@Linkman](https://www.phphelp.com/u/Linkman)\
**Replies:** 2\
**Last updated:** [May 28, 2021, 5:28pm UTC](https://www.phphelp.com/t/issue-with-special-characters-not-being-converted-properly/33559 "2021-05-28T17:28:46Z")

</div>

I have an issue where the function mysqli\_real\_escape\_string, which is necessary causes funky behavior with line breaks. For example, when I store a message that looks like this: $message = mysqli\_real\_escape\_string("Th…

---

## [Creating new user keeps failing](https://www.phphelp.com/t/creating-new-user-keeps-failing/33543)

<div class="topic-metadata">

**Author:** [@WarrenD](https://www.phphelp.com/u/WarrenD)\
**Replies:** 12\
**Last updated:** [May 27, 2021, 8:01pm UTC](https://www.phphelp.com/t/creating-new-user-keeps-failing/33543 "2021-05-27T20:01:33Z")

</div>

Hello All, I am working on a PHP website with MySQL DB. Initially the code was working, and but as I carried on working on it, the create new user function stopped working, I am not sure if I changed something in it to …

---

## [Post to php database does not work](https://www.phphelp.com/t/post-to-php-database-does-not-work/33533)

<div class="topic-metadata">

**Author:** [@raoul.k](https://www.phphelp.com/u/raoul.k)\
**Replies:** 4\
**Last updated:** [May 22, 2021, 4:01am UTC](https://www.phphelp.com/t/post-to-php-database-does-not-work/33533 "2021-05-22T04:01:06Z")

</div>

Hi guys, So I’ve trying to post a Colour hexa code, a name and surname to a database but I think I’m missing something. Because the execution to the data base does not work. The connection to the right server is made bu…

---

## [Php not showing data randomly](https://www.phphelp.com/t/php-not-showing-data-randomly/33320)

<div class="topic-metadata">

**Author:** [@dmanghani](https://www.phphelp.com/u/dmanghani)\
**Replies:** 23\
**Last updated:** [May 20, 2021, 12:56pm UTC](https://www.phphelp.com/t/php-not-showing-data-randomly/33320 "2021-05-20T12:56:40Z")

</div>

some of my data in mysql shows when running Select \*… It adds / substracts correctly but when echoing data through php the data is not visible, also it ignores data in calculations. what are the reasons or trouble sho…

---

## [Left join: Right number of rows, fields are null](https://www.phphelp.com/t/left-join-right-number-of-rows-fields-are-null/33492)

<div class="topic-metadata">

**Author:** [@BFlokstra](https://www.phphelp.com/u/BFlokstra)\
**Replies:** 2\
**Last updated:** [May 17, 2021, 12:47pm UTC](https://www.phphelp.com/t/left-join-right-number-of-rows-fields-are-null/33492 "2021-05-17T12:47:28Z")

</div>

I’m trying to execute the following query: SELECT role\_permissions.role as role, role\_permissions.permission as permission\_id, permissions.id as perm\_id, permissions.description as perm\_description FROM \`role\_permission…

---

## [SELECT statement doesnt retrive anything](https://www.phphelp.com/t/select-statement-doesnt-retrive-anything/33510)

<div class="topic-metadata">

**Author:** [@mariusd](https://www.phphelp.com/u/mariusd)\
**Replies:** 19\
**Last updated:** [May 15, 2021, 5:57pm UTC](https://www.phphelp.com/t/select-statement-doesnt-retrive-anything/33510 "2021-05-15T17:57:18Z")

</div>

Hi there, I just did a simple update to the latest version of mysql 8 and a select statement i have stopped retrieving results. The same statement worked on the previous version of mysql 8. When i run the statement in …

---

## [Unsend to database](https://www.phphelp.com/t/unsend-to-database/33453)

<div class="topic-metadata">

**Author:** [@ahmad127](https://www.phphelp.com/u/ahmad127)\
**Replies:** 5\
**Last updated:** [May 6, 2021, 12:52pm UTC](https://www.phphelp.com/t/unsend-to-database/33453 "2021-05-06T12:52:51Z")

</div>

Hi. I wrote a form that has a radio button and a checkbox and text in it. I tried the same form with a small number before and the data entered the database. But now I have increased the number of inputs. And gives an e…

---

## [How to update data from two tables](https://www.phphelp.com/t/how-to-update-data-from-two-tables/33461)

<div class="topic-metadata">

**Author:** [@Ches](https://www.phphelp.com/u/Ches)\
**Replies:** 3\
**Last updated:** [May 5, 2021, 6:52pm UTC](https://www.phphelp.com/t/how-to-update-data-from-two-tables/33461 "2021-05-05T18:52:55Z")

</div>

Hello, I’m having a hard to finish this CRUD project that I have because I dont know the proper sintax on how to update the data from two tables. Here is the tables: Table Users: id Name Email Table Car: id (forei…

---

## [Is my ERD correct?](https://www.phphelp.com/t/is-my-erd-correct/33433)

<div class="topic-metadata">

**Author:** [@idontknowphp](https://www.phphelp.com/u/idontknowphp)\
**Replies:** 7\
**Last updated:** [May 3, 2021, 2:05pm UTC](https://www.phphelp.com/t/is-my-erd-correct/33433 "2021-05-03T14:05:37Z")

</div>

---

## [How can you capture time duration in MySQL](https://www.phphelp.com/t/how-can-you-capture-time-duration-in-mysql/33440)

<div class="topic-metadata">

**Author:** [@idontknowphp](https://www.phphelp.com/u/idontknowphp)\
**Replies:** 7\
**Last updated:** [May 3, 2021, 5:13am UTC](https://www.phphelp.com/t/how-can-you-capture-time-duration-in-mysql/33440 "2021-05-03T05:13:38Z")

</div>

I need to create a table where it includes a user’s time duration on how much time he stays on a certain page… what data type should I use? should it be timestamp or datetime or time?

---

## [I am confused with one to many and many to many relationship](https://www.phphelp.com/t/i-am-confused-with-one-to-many-and-many-to-many-relationship/33428)

<div class="topic-metadata">

**Author:** [@idontknowphp](https://www.phphelp.com/u/idontknowphp)\
**Replies:** 3\
**Last updated:** [May 1, 2021, 11:10am UTC](https://www.phphelp.com/t/i-am-confused-with-one-to-many-and-many-to-many-relationship/33428 "2021-05-01T11:10:02Z")

</div>

For example… restaurants and reviews Some would say it’s a one to many but others would say it’s many to many. I also thought about one to many but many restaurants can have many reviews, right?

---

## [Where can I see my saved ERD](https://www.phphelp.com/t/where-can-i-see-my-saved-erd/33427)

<div class="topic-metadata">

**Author:** [@idontknowphp](https://www.phphelp.com/u/idontknowphp)\
**Replies:** 1\
**Last updated:** [May 1, 2021, 1:06am UTC](https://www.phphelp.com/t/where-can-i-see-my-saved-erd/33427 "2021-05-01T01:06:13Z")

</div>

I am using MySQL workbench

---

## [How can you auto generate the time on Date time data type?](https://www.phphelp.com/t/how-can-you-auto-generate-the-time-on-date-time-data-type/33390)

<div class="topic-metadata">

**Author:** [@idontknowphp](https://www.phphelp.com/u/idontknowphp)\
**Replies:** 4\
**Last updated:** [April 23, 2021, 3:52am UTC](https://www.phphelp.com/t/how-can-you-auto-generate-the-time-on-date-time-data-type/33390 "2021-04-23T03:52:59Z")

</div>

---

## [How do you increment a field by just clicking on the options on MySQL?](https://www.phphelp.com/t/how-do-you-increment-a-field-by-just-clicking-on-the-options-on-mysql/33389)

<div class="topic-metadata">

**Author:** [@idontknowphp](https://www.phphelp.com/u/idontknowphp)\
**Replies:** 2\
**Last updated:** [April 21, 2021, 11:15pm UTC](https://www.phphelp.com/t/how-do-you-increment-a-field-by-just-clicking-on-the-options-on-mysql/33389 "2021-04-21T23:15:12Z")

</div>

Is there a way to just auto increment an Id or field without typing any code? Like just clicking on the options just like selecting what type of data type it is? I see the auto increment option but I can’t click on it. …

[Previous page](https://www.phphelp.com/c/mysql-database/6.md?page=1)

[Next page](https://www.phphelp.com/c/mysql-database/6.md?page=3)
