MySQL is an open-source, relational database management system.
1
vote
2answers
78 views
Assist cleaning up messy HTML/PHP code
I really hate messy code, but I seem to be rolling in it. I just want to see if anyone has some helpful advice on how to tidy this up.
<table>
<tbody>
<tr>
<th>Zona</th>
...
1
vote
2answers
55 views
MySQL GEAR, C# class for ASP.NET project
I've developed my own class in ASP.NET project to access MySQL and make queries, scalars and read the result from it.
I want you to review my class and tell me where did I make a mistake, thanks!
...
0
votes
2answers
51 views
JSON API in C++ with Node.native, RapidJSON, and MySQL
Hey folks, I was hoping I might get some feedback and ideas for improvement on this, particularly the WebRouter class. Any tips or suggestions would be great!
#include <native/native.h>
...
2
votes
1answer
39 views
Is there a more optimized way for this MySql Query
with below query i'm getting the results that i want but it's quite slow taking nearly 0.2 seconds (on an i5 machine). Is there a more optimized way to get the same results.
Basically this query ...
2
votes
1answer
65 views
Better way to have output code?
When a user is created, deleted and update the system will give feed back. e.g. User Deleted/Updated/Create success or unsuccessfully, but I'm sure there is a better way to do it than what I have done ...
2
votes
1answer
64 views
Clean PHP IF Statement
This script updates a mySQL data with golf scores and calculates how many strokes under the player is in real time and is working. Just looking for a better way to make it cleaner and compact. Any ...
5
votes
2answers
149 views
Strategy to create audit trails for a SQL database
I wish to create audit trails for specific tables and columns in my database, and document who made the change, when it was made, and what the change was.
To do so, I will create the following ...
1
vote
4answers
175 views
Making this code 'more' OOP
I have just started to try and learn 'OOP' but it appears I'm doing this wrong, according to the people on StackOverflow the code below is far from Object Orientated, but I'm finding it hard as I'm ...
1
vote
1answer
70 views
Inserting data into database by Python
I have to run a python script that enters data into MySQL database table.
My below query runs and inserts data into MySQL database. But I want to optimize it and I have 2 requests:
I want to use ...
1
vote
0answers
29 views
I coded a mysql to mongodb importer using php . Can anyone review it
I was having problem to import data from mysql to mongodb. So i wrote a simple script myself.Can anyone review it how that is. This is my first question here on Code review.Also its slightly ...
-1
votes
0answers
32 views
Why is this repeating the header over and over again [closed]
The following code repeats the header in every row and I'm not sure why.
<html>
<table>
<tr>
<th>field1</th>
<th>field2</th>
...
4
votes
1answer
57 views
Create a table from MySQL using PHP PDO
I am trying to simply present a table in HTML that is stored in a MySQL database. I would like to use Object Oriented PHP to access and fetch the data for the table. I have spent some time learning ...
2
votes
0answers
19 views
CONSTRAINT, FOREIGN KEY and CONSTRAINT FOREIGN KEY
Please check if my tables specs agree with business rules. And also please explain what differences between CONSTRAINT, FOREIGN KEY and CONSTRAINT FOREIGN KEY.
I got 4 mySQL tables: USER, NAME, ...
-3
votes
1answer
74 views
My Social Network built on PHP + MySQL. Ideas needed? [closed]
Can someone check out my social network I've built and tell me what they think?
I'm 13 and I built Zikzo.
2
votes
1answer
60 views
PHP ORM like system
I'm using PDO, but I want to create my own class for more convenient work with the database.
My main idea in example with comments:
<?php
/**
* User entity. I want to save it into database.
* ...
2
votes
2answers
138 views
Is this code safe from SQL injection?
I believe with everyone's help on StackOverflow I got my code safe guarded from SQL injection, trying to confirm that is correct, just in case I misinterpreted the help and advice I received.
...
1
vote
1answer
27 views
MySQL limit across multiple tables in multiple queries
I have a website that keeps track of 'changes' that users make. These changes come in all shapes and sizes and each shape and size has a different MySQL table to store them in. In total there are 8 ...
0
votes
2answers
63 views
php script to retrieve enum values from sql table
I have an sql table with multiple fields and 4 of them are enums. I wrote a script that runs thought the table and retrieve the enums and put them in a 2 dimension array.
Unfortunately this script is ...
1
vote
1answer
47 views
Keeping track of people's relationships in MySQL using a people relation table?
I am trying to track relationships among people. I came up with my own solution, but wondering if there might be another way or better way of doing this. To keep it simplified, I'll post just the bare ...
1
vote
1answer
53 views
SQL vs MongoDB (TCG collection managment)
I'm designing a web application to help some friends and I manage our card collection. A relational database makes sense to me, so that was my first instinct.
The basic schema would like something ...
0
votes
0answers
13 views
slow mysql query - 1200 rows in 5secs
can anyone help me speed up this query? at present it returns 1200 rows in 5 secs.
I notice it is looking at 240000 response records - think this is where issue may be
I created the following ...
4
votes
1answer
46 views
Thoughts on organizing code for multiple mysql queries in php scripts
I have a web application where I connect with a MySQL database using PDO and in some scripts there are a lot of queries one after the other which don't necessarily concern the same tables. i.e I will ...
3
votes
1answer
65 views
Converting from MySQLi to PDO account activation
I had been working on a project for some time, and then it went on the way back burner after my daughter was born. I'm back to it, and now I discover that I'm best off using PDO over MySQLi. So, I'm ...
1
vote
2answers
63 views
Looking For a More Efficient/Elegant Way To Write a MySQL Query
I'm querying a MySQL database and displaying the info in order of timestamp (DESC). Essentially, I'm grabbing the last record in the database, displaying it's date and year as the header of it's ...
0
votes
2answers
68 views
PHP PDO Custom class ple
i created a database class from a good tutorial and wanted to put it up here so it would get in some search results. it took me about 2 days to find it. also i added a few custom functions to it.. ...
2
votes
1answer
80 views
Could really use some feedback on this registration code in php
I was hoping someone could give me some feedback on my code. I am still new to php and I'm sure I have messed up somewhere. The code pasted is for a registration page where users will submit their ...
-1
votes
1answer
46 views
Optimisation for random generator code in PHP [closed]
I'm really confused about combining MySQL queries and please could you lend me a hand?
Please explain in simple English.
The code is:
$result1 = mysql_fetch_assoc(mysql_query("SELECT COUNT( * ) ...
2
votes
1answer
80 views
How secure is this PDO Portfolio Script?
I was wondering if someone could take some time to look over my portfolio script and see let me know if it's secure enough to be uploaded live and connected to my database. My previous mySQL script ...
0
votes
1answer
59 views
Cleaner more efficient way of multiple database queries
I have the code below I probably did not need to post the entirety of it but you can see in the code that I make multiple data base queries to generate each of the multiple tables. I am curious if ...
1
vote
1answer
369 views
Is this PHP class good enough for CRUD
I wrote this class to make it reusable in any project.
It uses PDO as the MySQL connection.
Beside not using Setters and Getters, is this code secure and good practice for CRUD ?
Thanks for further ...
0
votes
2answers
127 views
Create loop to shorten this code up
I am new to programming as you can probably tell from the code below I am curious if there is a way to create a loop so I don't have so many copy's of the same code with only different variable names. ...
2
votes
1answer
66 views
I've embedded several PHP/HTML/Javascript in one page. How can I improve on the efficiency/performance?
Just a quick preface, I'm not a web developer. I'm simply doing this as a favor for a friend. My goal is to be done with it as quickly as possible, but still not have the coding be horrendous. With ...
0
votes
1answer
91 views
Authentication system using AJAX
I'm building an authentication system using a combination of PHP, MySQL, jQuery, and AJAX. The way I'm doing it right now is I have a form that takes in a username and password. When the user clicks ...
-1
votes
1answer
83 views
JSON array data posts but table does not update - PHP - Mysql - PDO - AJAX [closed]
I have a php script that encodes my db table into an array. I echo the json_encode and it echos just fine. script :
<?php
$host="localhost"; // Host name
$username="root"; // Mysql username
...
1
vote
0answers
85 views
Is there a more efficient way to do this
I am curious if there is a faster better more efficient way to accomplish what I have in the code below:
<?php
session_start();
//require 'functions.php';
//require 'DB.php';
$employeeID = ...
1
vote
1answer
104 views
Database report in PHP
Just a small PHP exercise to write some simple reports, I thought I'd do it without a framework for fun and profit. I'm particularly concerned about the potential for SQL injection, since the user ...
0
votes
1answer
72 views
LEFT JOIN and COUNT with different number of rows
I have two tables, the first table contains numbers with unique ID's and a keyword and the second table contains numbers that are linked back to the first table by the unique ID (in the CAMPAIGN ...
1
vote
2answers
70 views
Prepared Statements Function
Hello, CR :)
I've finally finished my universal query preparation function. Sorry about my previous post, I wasn't aware of the rules before.
Anyway, here is a working function. Any suggestions to ...
2
votes
1answer
192 views
The perfect PHP login script
I posted this same question on StackOverflow but guys over there told me to post it here.
I have programming in PHP since past 2 years and yet haven't found a perfect script for logging the user in. ...
3
votes
2answers
139 views
Better way to return data via AJAX?
Let's say I have three files: a page that is used for searching data called search, a file that handles requests called controller, and a file that has functions which the controller calls based on ...
1
vote
1answer
103 views
Is there a better way to loop through records and call an api?
I have a CakePHP function here that gets info for a twitter screen_name from the twitter api and writes it to a mysql db. I'm just looking for feedback about other ways to accomplish this that might ...
0
votes
1answer
86 views
Are these tables concepted correctly?
I want to store image (details) in my database, and want for each image the possibility to have from 1 to N versions.
I want a single file (src) to be associated with a single version. There must not ...
0
votes
0answers
57 views
Building database from file C# Mysql
well as the question reads I am building a database with 3 tables. Now these tables are going to be used to store names in.
Table 1 will store First Names Table 2 will store Last Names Table 3 will ...
0
votes
2answers
48 views
Delete matching ID and insert new data
Delete all matching ID
Insert new data
function add_date($id,$date) {
mysql_query("DELETE FROM wp_opening_date WHERE Id='$id'");
$dates = explode(",",$date);
foreach ($dates as $date) {
...
-1
votes
1answer
63 views
Connects to database but cannot get table [closed]
I use this php code to connect to my databse and retrieve the table food. I am able to connect to the database but no retrieve the table. I get this as a result: Host information: site.ipagemysql.com ...
0
votes
0answers
90 views
Translation class with database back-end
From reading the faq, basically I would like if everyone could give me advice on all of the things enunciated there about my code (mainly design pattern usage and security):
Best practices and ...
1
vote
0answers
30 views
Help with Zend function optimization
I'm new Zendframework. Can you help to optimize this Model function, witch get from Db list of Manufactures with some conditions
private function Manufactures(
$Condition = array(),
...
3
votes
2answers
166 views
Improve multithreading with network IO and database queries
I'm writing a script that:
fetch a list of urls from a db (about 10000 urls)
download all the pages and insert them into the db
parse the code
if(some condition) do other inserts into the db
I ...
0
votes
2answers
59 views
How should I format my code to make it easier to read and understand in the future
I am using this query to generate a conversation stream between user 184 and 192-
SELECT events.event_time, messages . *
FROM events , messages
WHERE events.global_id=messages.global_ref_id ...
2
votes
2answers
162 views
Which is version is “better” and why? (my level: beginner)
I'm working on an exercise where I"m supposed to display all data contained in a table. Here's the solution I can up with:
<?php
$result = mysql_query("SELECT * FROM contacts ORDER BY id DESC");
...