MySQL is an open-source, relational database management system. If your PHP code uses MySQLi, use the MySQLi tag instead.
6
votes
1answer
33 views
3
votes
2answers
324 views
Importing MySQL Database to a .txt File
We just finished working on a Database project in Java Netbeans. We added the feature Import which will import the database record of one user to a text file.
...
-2
votes
0answers
16 views
Code apear on the page [closed]
Hello i have made a php page and it was working and then the codes started to apear at the page like this
...
3
votes
1answer
41 views
Matchmaking system - sorting musicians by skills, genres, and location
I'm making a matchmaking system using PHP and MySQL which allows users to search through a list of musicians so that they can find people with the right skills and interests who are near them. It ...
1
vote
1answer
41 views
PHP PDO / MySQL helper/wrapper functions
Further to my previous post for a user login script I've been learning PDO in order to migrate from mysql_* functions. As before with mysql_*, I wanted to wrap the PDO code into wrapper functions, so ...
-1
votes
2answers
31 views
MySQL query in nested loop to get scores and averages for students
I am trying to get the scores and average for all assignments for records in a MYSQL database. The code below works but seems to take quite a bit of time to run because of the nested while loop. Any ...
0
votes
1answer
76 views
Combine Mysql limit query
Is it possible to combine these queries into one query? I am trying to see and average all scores but also count and average just the last three based on the same grouping.
This is the main query:
...
3
votes
1answer
17 views
Virtual Airline Dispatch Generator
This Code is old and I am trying to figure out how to improve it. I am considering running the distance function in MySQL, but it is a ***** to figure out for me due to my experience with arithmetic ...
6
votes
5answers
327 views
Database abstraction in Java
I am working on a project in Java which includes a lot of database related tasks. For instance, I would have to insert, update, retrieve data so many times within the application. To use code ...
6
votes
2answers
71 views
Database access concept
I've got a small tomcat web application that's used to receive customer data from an iPad app. After receiving those information they will be saved on a local MySQL database and then sent to an SAP ...
1
vote
1answer
75 views
4
votes
2answers
396 views
Voting system for a website
I am currently adding a voting system to my website. Below is my voting class. I feel that it could be simplified and that there is repeated code regarding the functions, although to the best of my ...
1
vote
2answers
58 views
SQL Data Fetcher for CMS
I am creating a CMS for a website, so I've added most of the functions that will fetch data from the database to a separate class. The code doesn't seem to have any bugs(Since I've tested it) but I ...
5
votes
1answer
117 views
Efficient Pandas to MySQL “UPDATE… WHERE”
I have a pandas DataFrame and a (MySQL) database with the same columns. The database is not managed by me.
I want to update the values in the database in an "UPDATE... WHERE" style, updating only ...
3
votes
0answers
47 views
Custom session handler
I'm new to PDO and haven't been coding in a while. Is the following custom session handler industry-acceptable?
...
3
votes
1answer
41 views
Join - order by vote-sum and check if user has voted
I have a vote and a comment table. Now I want to display all comments and order them by votes-sum. Sum because some votes can have a higher value than others.
Therefore I want to display if the user ...
3
votes
3answers
159 views
Cron PHP script to pull newly added clients from remote db, add their information to local db
I wrote a PHP script and was wondering if it was well written or if it could be improved upon to read or run more efficiently, any help or critique would be greatly appreciated.
The file will be ...
3
votes
2answers
55 views
Small library for logging to MySQL
I've thrown together a utility for my programs to log to a database, but the code looks like a mess and I don't know how to clean it up. This library is going to be used from all of my other programs ...
6
votes
1answer
34 views
Implementing EXCEPT functionality for social networking exercise
I am taking Stanford's Introduction to Databases Self-Paced online course. I have gone through the videos in the SQL mini-course, and I am having trouble completing the exercises.
The following is ...
2
votes
1answer
29 views
Simplify SQL query that utilizes GROUP BY and HAVING BY and uses aggregation
I am taking Stanford's Introduction to Databases Self-Paced online course. I have gone through the videos in the SQL mini-course, and I am having trouble completing the exercises.
The following is ...
3
votes
2answers
100 views
Is my login system secure?
I am recently making a CMS and I need a secure login system, so this is my code. How is it?
First: the HTMLcode for signup and login:
...
3
votes
1answer
39 views
Query about advertiser calls times out
I'm a bit of a rookie MySQL coder and I've been tasked with building a query that will join and filter several very large tables (one with ~210 million rows, one with 10 million, one with 2.5 million, ...
5
votes
3answers
59 views
Performing database interactions
I wrote this CRUD class in PHP that has methods to do database interactions, but I want to know if it is good/secure/elegant?
It works fine and all and it hasn't ever given me any troubles, but I'm ...
3
votes
2answers
98 views
Finding max rating for a movie
I am taking Stanford's Introduction to Databases Self-Paced online course. I have gone through the videos in the SQL mini-course, and I am having trouble completing the exercises.
The following is ...
0
votes
2answers
58 views
3
votes
2answers
79 views
Displaying a random poem from a database
I'm new to web development, and I'm constantly torn between good code and bad code. I was wondering if you could help me improve my following code and see if I'm doing it right in terms of how I use ...
2
votes
1answer
42 views
SMS relay --> MySQL database
The main purpose of my program is to extract GPS information from text messages sent to several GSM modems send from various GPS tracking devices. The main flow of my program loops in three steps:
...
2
votes
1answer
69 views
Open source Pastebin tool made in JSP and servlet
I'm a student and still studying. I just made my own Pastebin tool to generate source code. I've also contributed this project as an open source. You could see this project from here.
If you wish to ...
5
votes
2answers
73 views
Optimise web panel users statistics query
Details
Can anyone instruct me on a more optimised way of querying this statistics of registered users? I currently lack the knowledge to create a better query. Right now it works fine, but I want ...
1
vote
1answer
53 views
Magento MySQL search based on phone number
I'm building a search for Magento. Magento API doesn't provide an easy way to look up a customer using a phone number so I created a custom solution. My MySQL/PHP OOP skills are limited. Did I miss ...
2
votes
1answer
38 views
SQL query to order by the difference between FIRST and BEST scores
Can anyone help me optimise this query? I have the following table:
...
2
votes
1answer
85 views
Uploading images via MySQL in Blob
Is it safe to upload images via MySQL in Blob? I've constructed my code like the following:
...
1
vote
0answers
33 views
Selecting all posts with a certain tag
The task is to select all posts tagged with a certain tag, along with other tags the post may have, given as text rather than ID.
Table posts
...
1
vote
1answer
44 views
Handling errors when using PDO to connect to a database instead of MySQLi
What would be the preferred method for handling errors when using the PDO to connect to a MySQL database? I was using mysqli_error($this->pdo), but I heard this ...
2
votes
4answers
67 views
Selecting three stylesheets in a specific order
I'm somewhat new to SQL (only had to use it in Database classes). I have a simple table of stylesheets, from which I want to select specific ones in a specific order (e.g. reset, then layout, then ...
3
votes
0answers
61 views
Instagram-like news feed display
I am writing an application that shows a news feed, much like Instagram. For this, I have a function in the model to select the feeds as shown in the code. For some reason, this runs quite slow and I ...
2
votes
0answers
71 views
Programming with PHP & jQuery
I'm programming a system and I want to know if this is the correct way or if there are a better way to do it.
Container:
I have more fields but I only added one to show you the container.
...
1
vote
2answers
88 views
Class for multithreaded insert into database
Here I have class that supposed to take dictionaries of product objects and their articles (kind of unique identifier) from queue and insert or update them in database table.
Received dictionary ...
1
vote
3answers
84 views
Looping to update article codes on one server based on queries on another server
I've read somewhere on Stack Overflow that doing queries in a loop is very inefficient. It will hammer your SQL server and make your script very slow.
Sample code:
...
3
votes
1answer
75 views
Inserting data into database
I started learning PHP and MySQL, was using MySQL_ functions. Then I learned they are deprecated, had to choose between PDO and MySQL. I chose MySQL and started using it.
As I learn OOP PHP, I ...
5
votes
1answer
42 views
Slow query joining orders and products
The end result I am trying to achieve is an array containing the total ordered qty for each product. I have been successful but the query takes about 20 minutes to run and I'm wondering if there is ...
4
votes
1answer
168 views
Fetching objects and adding a calculated field in Doctrine 2
I'm making a section that shows a list of blogs and how many comments it has without loading any comment data. My Blog entity is as follows:
...
5
votes
2answers
124 views
Inserting values of Date type into a MySQL database
I have got a JTable implementing a TableModel interface. There are ID (primary key, ...
2
votes
1answer
23 views
4
votes
2answers
304 views
My method of escaping MySQL strings in C++
This is how I'm currently escaping MySQL strings in C++:
...
2
votes
3answers
87 views
A class which represents an SQL table
I'm representing DB tables as classes (in this case PHP classes). This has the goal of modeling every section of the web page, where you will get inputs from the user.
My actual base design is:
One ...
1
vote
2answers
134 views
PDO class extend
I am moving in to OOP PHP and having some problems extending my database class to my objects. I am still new to the variable scoping in OOP PHP, so if it a tiny syntax error I apologize. If my ...
5
votes
1answer
62 views
TrackDAO: what can be improved?
In this specific situation there is a table with trackdata and a form to add rows. For the sake of clarity I won't include the view-related code here. The added rows are added to a LinkedList when ...
3
votes
1answer
62 views
JOIN and sprintf rather than two queries and echo
It works fine, however it's a little messy. I understand it would be better for performance to use JOIN and have been advised before to use sprintf. However, it's ...
1
vote
1answer
41 views
Web Service implementation on the client
I will be creating a web service as part of a group project for university, which will be developed using Java within the Eclipse IDE.
Having no prior experience using web services, I managed to ...