MySQL is an open-source, relational database management system.
0
votes
0answers
1 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 ...
2
votes
0answers
20 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
36 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
56 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
53 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
65 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
39 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( * ) ...
1
vote
1answer
45 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
58 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
170 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
121 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
65 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
64 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
48 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
77 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
44 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
59 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
62 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
137 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
127 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
83 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
79 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
47 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
46 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
55 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
62 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
27 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(),
...
2
votes
2answers
131 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
159 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");
...
1
vote
2answers
85 views
Speed up insert query mysql to use with wordpress
want to insert about 10000 new rows to an existing table which contain 10000 rows already. I need to get the insert id for the query and to use that id in another function inside the loop as in the ...
1
vote
1answer
51 views
Is using a cookie to store search choices a good idea? [closed]
I have a page where a user enters a search term, this then forwards to another page and runs a query based on this cookies contents. I was just wondering if it is good practice to do it this way? I ...
2
votes
2answers
101 views
Database design improvement
I am doing a database design I want to create a database with information of employees, their jobs, salaries and projects
I want to keep information of the cost of a project (real value of project ...
0
votes
1answer
117 views
Need unique url but require non unique information from other columns
I am making a review system and I need to be able to only select the DISTINCT url from the database, but then pull the relevant page title and rating time. I have managed to get it working by using:
...
2
votes
3answers
93 views
Trying to Find a Loop to use for a specific MySQL query
I'm trying to see if there is a loop I can use in order to pull off this code a little more elegantly. I was previously using a foreach($row as $cell) with $row = mysqli_fetch_row($result) but because ...
1
vote
1answer
72 views
Is there a performance difference using AS keyword in SQL?
I'm working on a project in which the previous programmer seems to have loved using the AS keyword in the SELECT part of queries. I really don't like how it's written but if there is no performance ...
5
votes
1answer
119 views
Is there any problem in checking PHP PDO connection this manner?
Is there any problem in checking PHP PDO connection this manner?
Is this way reliable?
function pdo_mysql()
{
$mysql_string = "xxxxxxxxxxx";
$mysql_user = "xxxxxxxxxxx";
$mysql_pass = ...
5
votes
1answer
129 views
Please critique my newbie PHP code
I'm a complete PHP beginner and would like some feedback on this registration page I've created. Now, the one thing I know right off that bat that's wrong with it is that there's WAY too much ...
5
votes
1answer
225 views
PHP Login Authentication with BCrypt
So I have a php authentication script and everything works fine. But I'm very unsure about the way I programmed it (i hardcoded some stuff) and I was hoping stack could look through this and point out ...
1
vote
2answers
68 views
How can I ascertain and test SQL injection vunerabilities on this login code?
I know about the "little bobby tables" scenario and was just wondering if this code is vulnerable to such SQL injections.
I am fairly new to PHP and am curious about this.
My code for a login ...
2
votes
2answers
119 views
My database schema
I'm not sure if this would be okay to put here since it doesn't have code to look at, but this is my database I'm trying to create for an online firearm store. I'm new to database design and ...
4
votes
1answer
47 views
MySQL Java Connection with my application
the following is my code for the Java class connection to mysql server, i need to see if there is any suggestion to make it better.
this class not making the connection, it just control transactions, ...
4
votes
1answer
154 views
Please review my PDO Database wrapper
The subject is this small project - PHP/MySQL Database wrapper
The three main goals of this projects are:
Easy way to map database columns to object properties
Simple solution to insert or update ...
4
votes
1answer
134 views
How to optimize a pipline for storing item in mysql?
I am using scrapy framework for data scraping and dumping item in MySQL database.
Here is my pipeline that is inserting output to MySQL, but its taking so much time. Any suggestions on how to ...
4
votes
2answers
189 views
moving from->to: mysql->pdo, md5->pbkdf2, procedural->oop
I'm upgrading/rewriting our online client portal and wondering if my log in page code looks okay so far. during this rewriting/learning process I am upgrading a number of things: PHP 5.2 to 5.3.5, ...
5
votes
1answer
246 views
MySQL: Drop User if Exists
I wrote this MySQL stored procedure to emulate DROP USER IF EXISTS ( not available in MySQL ).
DROP PROCEDURE IF EXISTS DropUserIfExists;
DELIMITER $$
CREATE PROCEDURE DropUserIfExists(MyUserName ...
4
votes
1answer
69 views
Is this MySQL database structure acceptable or can it be improved?
Recently I've tried to teach myself basic things about MySQL databases, however I received some help on stackoverflow with creating a good database structure trying to avoid redundancy as much as ...
1
vote
1answer
116 views
Mysql left joins last row
I am making a query in mysql to import users in our marketing system and need for this a lot of data like for example :
Date of last order
Date of last cheque created
...
This are all left joins ...
2
votes
0answers
67 views
Am I taking the right path? [closed]
I have a dynamic page and a user can create or view posts. As of right now all of the posts show, I want to organize my posts by categories. But once the user goes to the page all of the posts will ...
3
votes
1answer
209 views
PHP Check user and delete if expired
Currenty coding a PHP script that will have a CRON to auto run it.
The point is that it checks the user in Mysql and if it has expired, it will delete it from the admin table and set status to ...