MySQL Server

47K

Solutions

23K

Contributors

MySQL is an open source, relational database management system that runs as a server providing multi-user access to a number of databases. Acquired by Oracle in 2009, it is frequently used in combination with PHP installations, powering most of the WordPress installations.

Share tech news, updates, or what's on your mind.

Sign up to Post

i have page to add new package with inputs and i have multi row dynamic create row for more details to this package inside this page

and also i have multi image uploader the same idea for invoice but add to this multi images

i have this photos to help you think my case
newpackage.php

<?php include "header.php"; ?>      
		<?php

			/// validate vars
										
			$num=" SELECT MAX( package_id ) as package_id FROM packages ";
			$query=mysqli_query($connect,$num);
			if($query){
				$row = mysqli_fetch_array($query);
				if($row){
					$max= $row['package_id'];
					if($max > 500){
						$package_id= $max + 1 ;
					}
					else{
						$first= 500 ;
						$package_id= $max + 501 ;
					}
					$filter_package_id=$package_id;
				}
			}
		?>

		<script src="../tinymce/tinymce.min.js"></script>
			<script>
			tinymce.init({
			selector: '.mytextarea'
			});
		</script>
      <!-- Right side column. Contains the navbar and content of the page -->
      <div class="content-wrapper">
        <!-- Content Header (Page header) -->
        <section class="content-header">
          <h1>
            Packages
            <small>Control panel</small>
          </h1>
          
        </section>

        <!-- Main content -->
        <section class="content">
          
          <!-- Main row -->
          <div class="row">
            <!-- Left col -->
            <section class="col-lg-12 connectedSortable">
              

              <!-- quick email widget -->
    

Open in new window

0
Learn Ruby Fundamentals
LVL 12
Learn Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

Hi,

Right now I have install and test the MySQL InnodB cluster and MariaDB cluster, and now I want to move/copy/migrate all data or oracle 10g/12c to MySQL and MariaDB, what should be the way ?

Any tools you recommend ? we only have the Oracle dump file to import, should we just use MariaDB import to import files from Oracle?

We have the MariaDB 10.3.9 running with Maxscale and SQL_mode = Oracle enabled !

the way should be information enough to show us how many Oracle SP, function,view and table we can't import to MariaDB/MySQL as DB is diff anyway so that we can see if this method is possible.
0
Hi

I want to create a detailed user log.

currently, I have created a table that stores the Id, date, userId, table name and table id.

if I run a query it works fine to display basic details. however, if I want to display the contents of the table name and Id I inserted I run into a crappy situation where I would need to create a procedure. the procedure would run the basic select and dynamically join the other table based on the table name and table id I inserted into the log database.

another problem is that not at tables are the same therefore this method would only partially work anyways.

the table names field is manually added when adding the log data set

how can I accomplish a nice log?
0
I would like to call a stored procedure in one database from another database using a variable for a name.

call dbone.stored_procedure_name works when I use the database name but I would like to call it by setting a variable for the database name.

set mydb='dbone';

call mydb.stored_procedure_name;


Is this possible and if so what is the syntax?
0
hi,

right now what to do some DML test for MariaDB and see what will happen when large amount of data is inserting to the mariaDB but DURing that time MariaDB is failover, will data keep deploying to the new master or hanged, dropped.

MysQL innoDB cluster can't handle it and transaction will dropped by returning a message by saying connection dropped ! not what I am expecting.

I run this on MySQL and it works but not in MariaDB, any reason:

CREATE TABLE batchdatatest(id int NOT NULL PRIMARY KEY AUTO_INCREMENT, val int);

DELIMITER $$

CREATE PROCEDURE prepare_data()

  BEGIN
    
  DECLARE i INT DEFAULT 100;

  WHILE i < 10000 DO
       INSERT INTO batchdatatest(val) VALUES (i);
         SET i = i + 1;
     
  END WHILE;

END$$

DELIMITER ;

Open in new window


error is :

MySQL Database Error: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'BEGIN
    
  DECLARE i INT DEFAULT 100;

  WHILE i < 10000 DO
       INSERT' at line 5

Open in new window


any reason ?
0
I have an application built using php/mariadb

i want to create a demo of the site that has standard data in it. A user can then play around with the data.

I do not want the new data entered by the demo user to exist for another user

what are my opions?

Thanks
0
Hi,

I want to fetch data from 3 table for time periods , i am using UNION All but its show error.
My sql code is
$sql_search = "(SELECT invoice_amount_wt_gst, cr_note, company, client, invoice_no, job_no FROM psb_billing WHERE invoice_date BETWEEN '$recv_date' AND '$invoice_end_date' and currency = '$currency' and company = $comp)
	UNION ALL
(SELECT on_ac, tds, client, job_no, invoice_no FROM receiving_report WHERE receiving_date BETWEEN '$recv_date' AND '$invoice_end_date' and currency = '$currency' and company = $comp)
	UNION ALL
(SELECT bf_amount, bf_credit_amount FROM psb_clients_bbf WHERE currency = '$currency' and bf_company = $comp)";	

Open in new window



i don't understand where i am wrong. and when i am using join query its show me lots of data. i think Its also fetch the wrong data.
my join query is
"SELECT PB.invoice_amount_wt_gst, PB.cr_note, PB.company, PB.client, PB.invoice_no, PB.job_no, PB.invoice_date, PB.currency, R.receiving_date, R.client, R.on_ac, R.tds, R.currency, BB.clients, BB.bf_amount, BB.bf_credit_amount, BB.currency, BB.bf_company FROM psb_billing PB left join receiving_report R on PB.company = R.company left join psb_clients_bbf BB on PB.client = BB.clients WHERE PB.invoice_date BETWEEN '$recv_date' AND '$invoice_end_date'  ";

Open in new window

 
i attached the table sql file.
I appreciate your's help.
Thank you
0
Is it possible at all to include multiple fields included in crosstab query? For example in below code I now have 2 fields I need to look at as below:

SELECT
  IfNull(c.Adviser, 'GRAND TOTAL') AS Adviser,
  Sum(CASE WHEN Month(i.CompDate) = 1 THEN i.comms + i.broker_fee + i.legal_fees ELSE 0 END) Jan,

Open in new window



What I now need if possible:
Sum(CASE WHEN Month(i.CompDate) = 1 THEN i.comms ELSE 0 END) OR Sum(CASE WHEN Month(i.signedupdate) = 1 THEN i.legal_fees ELSE 0 END)  Jan,

Open in new window



Does that make any sense?
0
So I have been using MSSQL 2012 for a while now and I like it.  I am developing an aspx webform which requires that I host the page and database.  I found a good hoster but the database they utilize is MYSQL.

First of all are there any significant performance differences between the full SQL and MYSQL.  Would it be simple to convert my database to MYSQL?  Are there any size limitations to MYSQL?  Any other notable differences?
0
PHP - MySQL

I am attempting to create a page that uploads images and saves them for viewing for members who belong to a website.

The page is posting to itself but not putting anything into the database, not letting the viewer know it has been uploaded OR giving any kind of error message. I took out one of the fields – description – as it is not needed so I am wondering if there is anything in the code that still refers to this field and the rest of the data is just not going into the database to begin with. My database columns are – file_name, file_size, file_type.

<?php 

require ('./includes/config.inc.php');

require (MYSQL);

$counter = 3; // Number of files to allow for.

if (isset($_POST['submitted'])) { // Handle the form.

	//require_once ('mysql_connect.php'); // Connect to the database.
	
	for ($i = 0; $i < $counter; $i++) { // Handle each uploaded file.
	
		// Create index names to refer to the proper upload and description.
		$filename = 'upload';
	
		// Check for a file.
		if (isset($_FILES[$filename]) && ($_FILES[$filename]['error'] != 4)) {

			
			// Add the record to the database.
			$query = "INSERT INTO notices (file_name, file_size, file_type) VALUES ('{$_FILES[$filename]['name']}', {$_FILES[$filename]['size']}, '{$_FILES[$filename]['type']}')";
			$result = mysql_query ($query);
		
			if ($result) {
				
				// Return the upload_id from the database.
				$upload_id = mysql_insert_id();
				
				// Move the file over.
				if 

Open in new window

0
Build an E-Commerce Site with Angular 5
LVL 12
Build an E-Commerce Site with Angular 5

Learn how to build an E-Commerce site with Angular 5, a JavaScript framework used by developers to build web, desktop, and mobile applications.

Here is my configuration for protecting one of my directories using mod_authn_dbd...
<VirtualHost *:80>

DBDriver mysql

DBDParams host=127.0.0.1,port=3306,dbname=myDB,user=root,pass=*****

DBDMin  4
DBDKeep 8
DBDMax  20
DBDExptime 300

<Directory "/path/to/ProtectedDir">
AuthDBDUserPWQuery "SELECT encrypt(passwd) AS password FROM myTable WHERE user_name = %s AND DUE_DATE>=CURDATE()"
  AuthType Basic
 AuthName "CurrentIssue"
 Require valid-user
 AuthBasicProvider socache dbd
</Directory>


    ServerName www.mySite.com
    ServerAlias mySite.com
    DocumentRoot /Server/WebSites/mySite
    ErrorLog /Server/WebSites/mySite/error.log
    CustomLog /Server/WebSites/mySiterequests.log combined

<Directory "/Server/WebSites/mySite">
    AllowOverride None
    Require all granted
</Directory>

</VirtualHost>

Open in new window

My question is how do I protect another Directory using a different mysql DB?

I've tried adding
DBDParams host=127.0.0.1,port=3306,[u]dbname2[/u]=myDB,user=root,pass=*****

Open in new window

and
<Directory "/path/to/ProtectedDir2">
AuthDBDUserPWQuery "SELECT encrypt(passwd) AS password FROM myTable2 WHERE user_name = %s "
  AuthType Basic
 AuthName "Admin"
 Require valid-user
 AuthBasicProvider socache dbd
</Directory>

Open in new window

As expected this breaks both Directories.
Any ideas on how I would accomplish this?
Is there any way to use mod_authn_dbd with htaccess?
0
Dear Experts

it is observed the  crm application running on LAMP stack often crashes, users unable to use the application webserver is on one server and database mysql 5.5 is on another server did perform the mysql tuner and attached is report, the system has 64G RAM as per the recommendations from mysql tuner can I set my.cnf as per the following, please suggest
total physcial ram capacity is 64G
based on the mysql tuner recommendations should I have to to set as per the below
innodb_buffer_pool_size = 55.2G
innodb_log_file_size= 25% of above i,e 55.2 which is 13.75G
please suggest can I change in my.cnf as above.
mysql-tunerlog.txt
0
Dear Experts

application server web-based of LAMP stack becomes extremely slow and makes application unable to use, web-server(application file system) is having 16GB Ram and database server is separate with 64GB ram and did run mysql tuner attached for your reference below posted recommendation section, when try to set values as recommended mysql fails to start  withe following error log, please help on what values to set so that below error is fixed, thank youmysqltuner12.txt
Plugin 'InnoDB' init function returned error.
180911 14:18:19 Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
180911 14:18:19 Unknown/unsupported storage engine: InnoDB
180911 14:18:19 Aborting

Below -extract of recommendations section from the attached

-- Recommendations ---------------------------------------------------------------------------
General recommendations:
    Control warning line(s) into /var/log/mysqld.log file
    Control error line(s) into /var/log/mysqld.log file
    Set up a Password for user with the following SQL statement ( SET PASSWORD FOR 'user'@'SpecificDNSorIp' = PASSWORD('secure_password'); )
    Restrict Host for user@% to user@SpecificDNSorIp
    MySQL was started within the last 24 hours - recommendations may be inaccurate
    Reduce your overall MySQL memory footprint for system stability
    Dedicate this server to your database for highest performance.
    Adjust your join queries to always utilize …
0
I have this query to check the last 3 months sales figures and another query to check the refund figures

       
           // sales
            SELECT DATE_FORMAT(order_date, '%b') as month, SUM(order_total) as totalSales FROM
            (
               SELECT order_date, order_total
               FROM order_summary
               WHERE order_date <= NOW()
               and order_date >= Date_add(Now(),interval - 3 month)
               AND `order_status` = 'Approved'
               
               UNION ALL
               SELECT  Date_add(Now(),interval - 2 month)  AS order_date, 0 as order_total
               UNION ALL
               SELECT  Date_add(Now(),interval - 1 month)   AS order_date, 0 as order_total
               UNION ALL
               SELECT  Now() AS order_date, 0 as order_total
            ) as test
            GROUP BY DATE_FORMAT(order_date, '%m-%Y')
            ORDER BY DATE_FORMAT(order_date, '%m-%Y') desc

Open in new window


           // refunds
        SELECT DATE_FORMAT(credit_date, '%b') as month, SUM(`credit_value`) as totalCredit FROM
            (
               SELECT credit_value, credit_date
               FROM credit
               WHERE credit_date <= NOW()
               and credit_date >= Date_add(Now(),interval - 3 month)
               AND `reason` = 'Refund'
               
               UNION ALL
               SELECT  Date_add(Now(),interval - 2 month)  AS credit_date, 0 as credit_value
               UNION ALL
               SELECT  Date_add(Now(),interval - 1 month)   AS credit_date, 0 as credit_value
               UNION ALL
               SELECT  Now() AS credit_date, 0 as credit_value
            ) as test
            GROUP BY DATE_FORMAT(credit_date, '%m-%Y')
            ORDER BY DATE_FORMAT(credit_date, '%m-%Y') desc
            ");

Open in new window


I want to show the data in a table like:

Month          Sales          Refunds

Sep                100                 0
Aug                100                20
Jul                   50                   5

I thought of trying to combine the queries into one but that seems very complex. And trying to nest the foreach loops creates 6 rows instead of 3. What would be the best way to achieve this?
0
how to bring common database to object structured JSON.
Hi. I have a database query that will result a list out of tokens for translation.

application.title = "Korpuskonfigurator"
application.dialogs.username = "Username"
application.dialogs.errors.missingfields = "Bitte alle Felder ausfüllen."
anschlagsart = "Anschlagsart"

And so forth. I have to bring this is an object structured JSON file for an external translation engine.
It have to look like s the following JSON sample. The token is splits by its points the structure have to be created.
I tried now a long time, but I complete fail. I hope anybody can give me a hint.

{
  "application": {
    "title": "Korpuskonfigurator",
    "cart": "Projektverwaltung",
    "nyi": "Noch nicht verfügbar!",
    "dialogs": {
      "username": "Username",
      "id": "ID",
      "name": "Korpusname",
      "errors": {
        "missingFields": "Bitte alle Felder ausfüllen.",
        "specialCharacters": "Keine Sonderzeichen erlaubt!"
      }
    },
    "inspector": {
      "stowageHeight": "Stauhöhe",
      "newValue": "Neuer Wert",
      "firstDrilling": "Erste Bohrung",
      "original": "Original",
      "openOPC": "Ändern",
      "positions": "Positionen",
      "finalPosition": "Final",
      "corrPosition": "Korrekturwert",
      "origPosition": "Originalwert",
      "suggestedPosition": "Vorschlagswert",
      "delta": "Delta"
    },
    "helpmenu": {
      "minz": "Min. Z",
      "maxz": "Max. Z",
      "fov": 

Open in new window

0
I want to get the past 3 months sales data and display it something like:

August 2018 - $.....
July 2018 - $....
June 2018 - $.....

I have tried something like this:

        $this->db->query("SELECT SUM(`order_total`) as `totalSales`
        FROM `order_summary`
        WHERE `order_date` >= LAST_DAY(NOW()) + INTERVAL 1 DAY - INTERVAL 3 MONTH
        ");
        $results = $this->db->resultSet();
        return $results;

Open in new window


And I tried to put `order_total` in a foreach loop but it just spits out one figure. I am guessing there is something wrong with the SQL query?
0
Dear Experts
We are having CRM application which is web-based runs on LAMP stack. the operation team reports between specific time period user get time out when they save the records or convert the records or retrieve the records, can you please suggest on how to capture log files which occurs during that time for example 5pm to 6pm, only during this time I would like to capture a following log files.
1) /var/log/mysql.log
2)/var/www/html/crmapp/crm.log
3) /var/log/slowquerylog
4)/var/log/httpd/error.log
please help with steps on above 1 to 4 log capture during specific time period , this will be helpful to investigate , thank you very much.
0
Having issues with resume upload parsing page:

http://ablcareers-dev.cloudaccess.host/search-abl-jobs/resume/013947 as an example

When a user clicks to upload their resume, and selects CONFIRM INFO, the page refreshes after a couple of seconds and it appears as if no data has been processed.

Code is below, simple file upload and script. Working with Joomla.

<form class="uk-form"  name="frmMain" method="post" id="frmMain" enctype="multipart/form-data">
	<input type="hidden" name="jobId" value="<?= $this->jobID ?>" />
	<input type="hidden" name="email" value="<?= $this->email ?>" />
	<input type="hidden" name="action" value="resume" />


           <input class="form-control  uk-form-large uk-width-7-10" id="filResume1" type="file" name="filResume1" /> <button class="uk-button-primary submit uk-button" >Confirm Info</button>
           <label class="error" for="filResume1"></label>
           <button class="noresume uk-button uk-button-primary" >I  don't have a resume</button>
		   <p style="font-size:12px">No Resume? No Problem you can still apply manually</p>

	
	
		<p id="spProcessing"></p>

	
</form>

<script>
jQuery('.submit').click(function() {
	jQuery('#spProcessing').text('Processing resume ............... ');
	jQuery('#frmMain').submit();
});
jQuery('.noresume').click(function() {
	jQuery('#frmMain').submit();


});
</script>

Open in new window


There are no errors in the console, and I cannot figure out what may be the cause of the issue.

Would the PHP / MySQL version possibly affect tthe functionality of this?

Any insight would be helpful,

Thank you!
0
Dear Experts.
i have a simple WINDOWS  webserver with an installation of MYSQL (5.6) that hosts some wordpress Databases
one of my dabases gives the following error

, , , 2018-09-11 08:39:27 183c InnoDB: cannot calculate statistics for table "wordpress941"."wp_posts" because the .ibd file is missing. For help, please refer to http://dev.mysql.com/doc/refman/5.6/en/innodb-troubleshooting.html

i looked inside the Database folder and the file wp_posts.ibd is there but it looks apparently corrupted i have no idea how can i fix this on a windows server.
can someone please help.

restore from backup didnt help apparently the last 14 days have all been backed up with the corrupted files.
0
Newly released Acronis True Image 2019
Newly released Acronis True Image 2019

In announcing the release of the 15th Anniversary Edition of Acronis True Image 2019, the company revealed that its artificial intelligence-based anti-ransomware technology – stopped more than 200,000 ransomware attacks on 150,000 customers last year.

Hi, i am runing program on Node-Red. The data format in JASON. I am trying to pull out "payload": "Open" and insert into mysql. No errors but the data in sql state as [object OBJECT] . Did attached the database field.

test2 : msg : Object
object
topic: "test2"
payload: "Open"
qos: 0
retain: false
_topic: "test2"
_msgid: "2356ede6.954ba2"

Open in new window


var temp;

temp ={"payload":msg.payload};
msg.topic = "insert into ctesting (data1) values ('"+temp+"')";


return msg;

Open in new window

db.png
0
We are trying to create a search function inside a website to access and search a MySQL Database. The General Search options would be to search the whole database for a specific phrase and combine with a date range. Help is needed to build a PHP script to link to our database and offer a web-based form to allow users to search as detailed above. I have no experience of PHP but have some HTML knowledge.
0
I wrote an Access database about 18 years ago for the data entry of client data. Now I want to develop a web data entry system, so the clients can enter their own data. I have 45 years of traditional programming and Access experience. But I find developing for the web, very different. Can anyone suggest how I can go about learning how the web pieces work together, preferably with examples and how a framework is used. At some point, I'd be happy to pay for teaching, mentoring and support, but in the end I want to be able to support it myself. The application is very simple. There are over 100 clients to support; a few thousand records a month in total; monthly invoicing. It was suggested that I develop with PHP, MySQL and Javascript. I saw a course with Expert Exchange for using CakePHP, so I thought that I would start with that and see where to go after that.
0
Dear experts!

I am just wondering if there is a way for me to convert information from relational database such as MSSQL, MySQL etc... into a NO SQL or simply something like memcache in a key -value pair? This is what I want to achieve:

1. instead of having user hitting the SQL DB with requests when they want to get product information etc....
2. store the information into NO SQL or memcache (for a faster and dynamic data retrieval)
3. block the user from hacking SQL DB with sql injection
4. allow a faster update with the data by updating product information in NO SQL or memcache from the SQL DB. ****(I wish to know some good suggestions if I can have a real time update) **** before I have 2 SQL DB and using bash script to do the product information sync like every 30mins or so

Any good idea is appreciated. Thanks!
0
Hello Experts!

I need help on the following:

Assuming myTable has the following data:
id         Name        Class          Subject        Marks
1          Stu1           SS1A          Eng               40
2          Stu2           SS1A          Eng               50
3          Stu3           SS1B          Eng               60
4          Stu1           SS1A          Maths          45
5          Stu2           SS1A          Maths          55

How can I achieve the following in report using either WHILE LOOP or FOREACH or mysqli_fetch_fields or whatever (Note: number of Subject above (that will form columns) is unknown)?

Class_Name: SS1A
SN       Name         Eng           Maths         No_of_Subjects
1          Stu1            40             45                2
2          Stu2            50             55                2

Thank you so much in advance.
0
I had created a form, but there is drop down menu its telling me Invalid data entered in column. I created table in SQL and used enum  as field type. Attached you will see main.sql file and folder with INDEX.php form.
main.sql
MainForm.PNG
index.php
0

MySQL Server

47K

Solutions

23K

Contributors

MySQL is an open source, relational database management system that runs as a server providing multi-user access to a number of databases. Acquired by Oracle in 2009, it is frequently used in combination with PHP installations, powering most of the WordPress installations.