Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x

MySQL Server

47K

Solutions

22K

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

Dear Experts,
I select data from my database like this

$sql = "SELECT _key,urun,tarih FROM order WHERE _key between 75 and 120";

$res = $mysqli->query($sql);

if ($res->num_rows > 0) {
    while($row = $res->fetch_assoc()) {
	$key= $row["_key"];	
	$urun= $row["urun"];
	$tarih= $row["tarih"];
	
	if ($key=="98") {$newvariable98=$urun ;}
	if ($key=="106") {$newvariable106=$urun ;}
	if ($key=="120") {$newvariable120=$urun ;}
	
	}
 }

Open in new window


since $row is an array, is there a better way to select key 98,106,120 data? Thank you
0
Free Tool: Port Scanner
LVL 11
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

I have in table column named user_date, and I have jquery on frontend to get user status ADULT or YOUNG. When user pick the date, script automaticaly write ADULT or YOUNG, depending on his picked date and current date, = >18 or <18. Now I would, to get number of young users which for one month will be ADULT, and get that number like some alert.
0
i am fresher in php: i have table (admin) where two row is there intime,outtime
i wants to calculete time Diffrence and show to frontend how can i do that12.PNG

i Want to show total time diffrence like this format 08.00.12hrs[hours:minutes:second]
0
Object of class mysqli could not be converted to string in

this message show whne  i try to write in textarea about 700 words

how i can solve this problem
0
good afternoon:
i am some issue of display the attence for Each user:
 I Have Two Table :
First Table Contains Admin table Which Conatains:
userid
intime
outtime
second Table Contains use table Which Conatains:
id
username
password
role
I Have a landing page where i am displaying userinformfation from usertable and one link is there viewattendence ,if user click then it display userattendence  based on her id
But issue is there that attenence is in admin table(login and logout):then how can i get the attendence beacause in landing page  user passses id not userid:and url search for id which is not there in admin table
For this issue i am using mysql query is:
$sql = "select admins.id, admins.intime, admins.outtime
                                 from admins inner join userregisters  Having  admins.userid='" . $_GET["id"] . "'";

Open in new window

How can i do that plz suggest me
0
I have some code which pulls tweets from a database, removes any URLs and highlights the hashtag from the string.
I am getting an error on this 1 tweet, and im not sure how to fix it.

Hilarious!! “@kellyfurneaux: Which one is Jodie?! #Sony https://t.co/sAdxCv3bDe�

Open in new window


It appears to be the â character which is 3rd from the end, because when I remove that character it works

	String.prototype.parseURL = function() {
		return this.replace(/[A-Za-z]+:\/\/[A-Za-z0-9-_]+\.[A-Za-z0-9-_:%&~\?\/.=]+/g, function(url) {
			return url.link(url);
		});
	};
	data.text = (data.text.parseURL());

	data.text = data.text.replace(/(\#[a-zA-Z0-9\-\_]+)/g,"<span class='hashtag'> $1 </span>");

Open in new window



Console Error
Uncaught TypeError: Cannot read property 'parseURL' of null
    at createTweet (createTweet.js:8)
    at Object.<anonymous> (twitterwall.js:127)
    at Function.each (jquery-3.1.1.min.js:2)
    at appendTweets (twitterwall.js:109)
    at Object.success (twitterwall.js:77)
    at i (jquery-3.1.1.min.js:2)
    at Object.fireWith [as resolveWith] (jquery-3.1.1.min.js:2)
    at A (jquery-3.1.1.min.js:4)
    at XMLHttpRequest.<anonymous> (jquery-3.1.1.min.js:4)

Open in new window



Could someone help here??
0
Hi Experts.

I'm having a sql file about 3.5GB with some tables about 7 millions records , and a Ubuntu 16.04 server configured to run on a VPS with 8 vCPU, 32GB RAM. (RAM Disk)
The RAM Disk mount command is:
# sudo mount -t tmpfs -o size=25G tmpfs /opt

When importing that sql file using default MySQL configuration, its took about 3 hours and a half to finish.
After using this optimized MySQL configuration, it's took only about 20 minutes:
innodb_buffer_pool_size = 8G
innodb_log_buffer_size = 256M
innodb_log_file_size = 1G
innodb_write_io_threads = 16
innodb_flush_log_at_trx_commit = 0

When importing, import speed goes around 1MiB/s to 7MiB/s. In the end, the average importing speed with this new parameters is 2.5 MiB/s.
My question is, which parameter should i optimize to increase average importing speed, in order to reduce import time from 20 minutes to about 10-12 minutes?

Hope to see experts's answers soon, thank you.
0
Why I'm always getting warning: Natalie_query() expects parameter 1 to be mysqli, null given in c:\xampp\htdocs\view\dokumen.php on line 57
0
I need help with my ASP.NET MVC application hosted on iis. The application loses connection to MYSQL database after sometime and requires me to restart mysql service then it continues to connect.
0
I have tried various approaches to logging in as the root to mysql deployed on a raspberry pi 3.  I keep getting a 1698 error.  I can login under sudo.  Thanks
0
Get expert help—faster!
LVL 11
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

i have a mysql database containing several tables in my Web host so  I can access it  with my App from there.
I wish transfer or copy this database to my computer and be able to connect to it  with my app.
I could make a backup sql file with phpmyadmin and put it on the desktop. How can I make this database  alive and access it..
I have phpmyadmin and also workbench ....
Please be specific and tell me how to do that
Thanks in advance
0
I have one table that contains 2 million rows. at every second there are 6000-row inserting and every second latest row fetching by every group means 6000 new row fetch. so when I try to fetch a particular range of data then the table will be a lock . its show me lock wait timeout. so, what can I do for that? please help me.
0
I have a problem as system DSN is not visible to 'domain users'. I know that such question has already been asked here and also to other web communities, I tried all solutions but still my db is not visible to all domain users.

I have created on Win7 machine a db with My SQL, it is my backend. As front end I use MS Access, linking tables to MySQL. I opted for such solution as most of end users are used to Access and they can create their own queries etc.

The problem is that in the frontend the users see the linked tables, they can even see the design view of each table, but they cannot open it.

I created the ODBC link with both "C:\Windows\system" or "C:\Windows\SysWOW64" but it didn't solve. The ODBC is created at system level.

Furthermore I have changed (allowed) permissions to HKEY_LOCAL_MACHINE/software/ODBC as well as to the HKEY_LOCAL_MACHINE/software/Wow6432node/ODBC

The error message: ODBC-connection to 'XXXX" failed. MS ACCESS can't opend the table in Datasheet view.

Thanks a lot for your help !
0
I know connecting to a MySQL Db is notoriously fiddly in Visual Studio. I did manage it though, and have been running a web app successfully for a couple of years, syncing SQL data across to MySQL.

I now have an issue however, which is preventing the app from running. It is a web job scheduled hourly in MS Azure, but it is now failing with the following error message:

[01/02/2018 23:16:54 > 9c069f: ERR ] Unhandled Exception: System.TypeLoadException: Inheritance security rules violated by type: 'MySql.Data.MySqlClient.MySqlProviderServices'. Derived types must either match the security accessibility of the base type or be less accessible.

I have read various MySQL guides and forums with people having similar issues, but still haven't managed to fix it. The latest thing I did was to uninstall all of the MySQL Nuget packages and reinstall them again. It could be there is an incompatibility between the entity versions of each of them, I guess, but I don't know how to work out which versions I should have.

Attached is a screenshot showing the errors I'm getting. It has now resulted in me not being able to open the .edmx file - database designer - in Visual Studio at all. I'm tempted to delete all related files, underneath the WPMySQLDev.edmx branch, but there are so many references and calls to tables in this database that I worry whether we can get them all back in place.

Can anyone suggest how I should go about getting this app back up and working again from …
0
For my site, I am having trouble make the user redirect to the proper page using header("location: ... ");. Instead, on the log in, it redirects to the form's action: login.php. How do I make it so that the user is redirected to the correct page and not the php file that the login form uses?

Below is the HTML code (the form):
<h2>Log In</h2>
      <form method="POST" action="login.php">
            <input type="number" placeholder="student id" required name="studentid"><br>
            <input type="password" placeholder="password" required name="password"><br>
            <button type="submit" name="submit">Go</button>
</form>

Below is the relevant sections of the PHP:
$uid = mysqli_real_escape_string($conn, $_POST['studentid']);
$pwd = mysqli_real_escape_string($conn, $_POST['password']);

$sql = "SELECT * FROM users WHERE studentid='$uid'";
$result = mysqli_query($conn, $sql);
$resultCheck = mysqli_num_rows($result);

//username check
if ($resultCheck < 1) {
      //redirect and exit
      } else {
            if ($row = mysqli_fetch_assoc($result)) {
                  //De-hashing the password
                  $hashedPwdCheck = password_verify($pwd,  $row['password']);
                        if ($hashedPwdCheck == false) {
                              //redirect and exit
                        } elseif ($hashedPwdCheck == true) {
                              //Log in the user here and get session variables
                              header("location: index.php?login=success");
                              exit();
                        }
                  }
            }
1
hi,

I'm looking to port some prototype database processes online. I'm developing the logic on MS Access but will need to move this to an online service probably mid 2018. I'm new to cloud services, I'd like to understand them better but don't want to do the coding. I notice the new "Gigs" service here, so thinking to setup some mini-tasks to see who's best suited to what, and get a better handle on costing.

Example task could be : to create a single database table (say 100 records) on mySQL using my bluehost account:
1. (xenium/dev) setup an account on bluehost for the developer
2. (xenium/dev) supply data+specs to developer / answer questions
3. (dev) create table and upload the data
4. (dev) document the steps so I can recreate if needed

Is this a good approach, if so how much should I post for such a task? I imagine step 3 is fairly trivial, but the rest may depend. Much of the work maybe educating me on how it all works.

Any other recommended approaches welcome.

Cheers
0
I've been snooping around and I found that some people's MySQL Server 5.7 directory had a data directory within their MySQL Server 5.7 directory along with bin, lib etc. but mine doesn't. I've tried reinstalling multiple ways and I have concluded that the data directory is not there.

Upon launching the MySQL server I get the ERROR:

failed to set datadir to C:\Program Files\MySQL\MySQL Server 5.7\data\

By the way, I am using MySQL Server 5.7 connected to the NetBeans IDE 8.2, so I can't launch my PHP code.
0
I'm working in MySQL after update trigger. when row is updated i need to make a query of changed values so that if that query is run table goes in previous state, for this i need to process each field of the table under some conditions. for this i was thinking to make a procedure to build query and pass that procedure all field's values and names . my tables contains upto 5o columns. therefore i want to know if it is possible to get these values in array form
0
is there any method to check whether user input a NULL value in field or it is default NULL set for field in mysql after update trigger
0
Get your Conversational Ransomware Defense e‑book
LVL 1
Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

$check_email="select * form users where user email='$email'";
            $run_email = mysqli_query($con,$check_email);
      
            $check = mysqli_num_rows($run_email);
             
               if($check==1){
      
             echo "<script>alert('Email phone already exit,please try another!')</script>";
             exit();
0
Hi EE.

Is there anyone know how to get the location of the device accessing my website at that time and save the coordinates to MySQL and also when retrieving data from the database only show results that are around the current searcher's location using php, html, MySQL.

What I want is that I want when someone is searching for something on my site the site will first get the current location of the user ad then search on the Mysql what the user is searching and then only display data that is around that particular location.

Thank you.
0
I have a report I would like to remove duplicates "Claim_Id".   I end up having to export the report and remove duplicates in excel. Problem is I am generating way to much data because of the duplicates, how do I add code to my report to remove these when the report is executed?

clm.internal_id AS "Claim ID"      

Thank you
0
I have a MySQL table with more than a 3 billion rows hosted on Google Cloud SQL.

I wish to understand how the total size on disk can be explained from the column data-types, number of rows and the indexes.

I was hoping that it would be something like

size_of_table_in_bytes = num_rows * [ Sum over i {bytes_for_datatype_of_column(i))}
                                    + Sum over j  {Bytes_for_index(j)} ]
But I end up with incorrect disk-size than how much my database size shows.

Using bytes per datatype on

https://dev.mysql.com/doc/refman/5.7/en/storage-requirements.html

and additional bytes in InnoDB header and indexes from

https://dev.mysql.com/doc/refman/5.7/en/innodb-physical-record.html#innodb-compact-row-format-characteristics

Here is my understanding of bytes occupied by header, each column and each index

TABLE `depth` (
Bytes| Column/Header/Index
    2| variable length header Ceil(num columns/8) = Ceil (10/8)
    5| Fixed Length Header
    3|`date` date DEFAULT NULL,
    7|`receive_time` datetime(3) DEFAULT NULL,
    8|`instrument_token` bigint(20) unsigned DEFAULT NULL,
    1|`level `tinyint(3) unsigned DEFAULT NULL,
    2|`bid_count` smallint(5) unsigned DEFAULT NULL,
    8|`bid_size` bigint(20) unsigned DEFAULT NULL,
    4|`bid_price` float DEFAULT NULL,
    4|`ask_price` float DEFAULT NULL,
    8|`ask_size` bigint(20) unsigned DEFAULT NULL,
    2|`ask_count` smallint(5) unsigned DEFAULT NULL,
    6|KEY `date_time_sym …
0
Hi

I currently use the version 2 of the MariaDB odbc connector for a DSN less connection using the following string

MyConnectStr = "ODBC;Driver={MariaDB ODBC 2.0 Driver};Server=server.domain.local;UID=" & UID & ";Password=" & pws & ";Database=db-live;Port=3306;Option=16"

I want to upgrade to version 3 of the connector as it will give me the SSL options but when i upgrade and alter my string it wont connect.

does anyone know if they have redesigned the method of connecting in the new version?

thanks
0
$sql="
      SELECT
s.survey_id AS 'Inspection ID',
s.license_number As 'License Number',
s.name_pos AS 'Name of POS',
s.address_pos AS 'Address of POS',
s.updated_at As 'Inspection Date',
s.updated_at As 'Inspection Date',
t.name As 'Town Name',
c.name As 'Districts Name',
s.gps_location As 'Location',
sum(a.option_value) As 'Final Scoring',
a.option_value As 'Remarks'
FROM  ".DB_PREFIX . "survey s
INNER JOIN ".DB_PREFIX."town t
on t.town_id=s.town_id
INNER JOIN ".DB_PREFIX."city c
on c.city_id=s.city_id
INNER JOIN ".DB_PREFIX."answer a
on a.survey_id=s.survey_id WHERE a.question_id=371";

i want sum of option_value WHERE option_id!=0  in join query and  a.option_value As 'Remarks' WHERE a.question_id=371";

from same table
0

MySQL Server

47K

Solutions

22K

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.