Hi All,
I am currently in a debate with a coworker about the best practices concerning the database design of a PHP web application we're creating. The application is designed for businesses, and each company that signs up will have multiple users using the application.
My design methodology is to create a new database for every compa...
I have two different queries in my php page for the same table, the first one is executed if I have two different values for two columns, but in some case, i can use only the first value, can I do it with the same query or should I use two different queries?
// query 1
"INSERT INTO my_table (column_1, column_2) VALUES ('$value_1', '$val...
I have never encountered an error like this before. I was using prepared statements when it stared and have tried everything to correct the problem including stripping the form down to it's bare components.
The following code, when executed, is creating a duplicate row.
$sql = "INSERT INTO inventory
VALUES ('','$stocknum','$y...
Hi,
I have a very specific query that is acting up and I could use any help at all with debugging it.
There are 4 tables involved in this query.
Transaction_Type
Transaction_ID (primary)
Transaction_amount
Transaction_Type
Transaction
Transaction_ID (primary)
Timestamp
Purchase
Transaction_ID
Item_ID
Item
Item_ID
Client_ID
Lets...
How can I check files that I already processed in a script so I don't process those again? and/or
What is wrong with the way I am doing this now?
Hello,
I am running tshark with the ring buffer option to dump to files after 5MB or 1 hour. I wrote a python script to read these files in XML and dump into a database, this works fine.
My ...
I have a series of related tables.
Transaction_Type
Transaction_ID (primary)
Transaction_amount
Transaction_Type
Transaction
Transaction_ID (primary)
Timestamp
Purchase
Transaction_ID
Item_ID
Purchase_ID (primary)
Item
Item_ID
Client_ID
I need to select transaction_type rows based on a time stamp and client_id
My query is as foll...
Can I search for 1 AND 2 AND 3 without getting a false match because 11,22,33 are in the field?
A field that has the string = "11,22,33" should then not return any results.
...
Hi all,
MY PLATFORM:
PHP & mySQL
MY SITUATION:
I came across a situation where I need to store a value for user selection in one of my columns of a table. Now my options would be to:
Either declare the Column as char(1) and store the value as 'y' or 'n'
Or declare the Column as inyint(1) and store the value as 1 or 0
This column so...
Apologies if this is a silly question, could use an opinion:
I've got a messages table in MySQL which records messages between users. Apart from the typical ids and message types (all integer types) I need to save the actual message text as either VARCHAR or TEXT. I'm setting a front-end limit of 3000 characters which means the messages...
Mysql question:
I've got a table A with a column full of sentences.
I've got another table B with two columns: words and abbreviations.
I want to look through table A's column sentences and if a word from table B's word column matches then replace it with abbreviation.
Hope that is clear.
Case doesn't matter, I can deal with that. ...
I have an int field in my product table called product_stat which is incremented everytime a product is looked at. I also have a date field called product_date_added.
In order to figure out the average visits per day a product gets, you need to calculate how many days the product has existed by using the current date and the date the p...
I am working on a relatively big system with:
low level C++/C codes dealing with multimedia data(video/audio)
a lightweight database, preferably MySQL but I am open to other better alternatives
RESTful web service as the front end
All the requests will be handled by RESTful interface, low level C++/C codes dealing with the real hard...
I want to know how my system behaves under a high load. To do so I would like to artificially reduce the amount of memory available to MySQL. How should I do this?
...
I have a table with the following. The names are not unique.
userid, name
1, dave
2, john
3, mike
4, mike
5, dave
I want to return the unique name with the highest userid.
ie.
2, john
4, mike
5, dave
What is the query to do so?
...
Hey SO
PHPmyAdmin keeps rejecting this mySQL im pretty sure its right and don't actually need it to run, its uni work and just have to hand in, it looks right to me.
the actual error I get is
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '...
Hello guys,
Recently, I've been thinking if it's worth to have 1 table with perhaps a lot of NULL columns or if it's better to have more tables with no NULLs. I've heard that NULL isn't stored on InnoDB, so I was wondering if there is any downside or problem with having a bunch of rows with a lot of NULLs. I have always heard that commo...
Hello Everybody,
The code in the sequence is working fine, but looking to improve the MySQL code to a more efficient format.
The first case is about a function that received a parameter and returns the customerID from MySQL db:
def clean_table(self,customerName):
getCustomerIDMySQL="""SELECT customerID
FROM customer
WHERE ...
I'm writing a test framework in which I need to capture a MySQL database state (table structure, contents etc.).
I need this to implement a check that the state was not changed after certain operations. (Autoincrement values may be allowed to change, but I think I'll be able to handle this.)
The dump should preferably be in a human-re...
I am facing a weird situation. When I am trying to connect to MySql database using a "mysql" connection, it works.
mysql connection string -> mysql_connect($HOST, $USER, $PASSWORD, $DB);
But the connection fails immediately fails when I use either "mysqli" or "PDO"
mysqli connection string -> mysqli_connect($HOST, $USER, $PASSWORD, ...
I want a simple way to see what commands are being sent to MySQL. I have several MySQL projects that sometimes have a few messy layers of code. I want something like SQL Server Profiler without all of the bells and whistles. I just need to see the SQL traffic. Not analyze which queries are executed most often.
I found MySQL Proxy an...