This is one of those 'oh my god' moments.
The previous programmer in our company has left behind a badly-coded application using PHP and MySQL.
One example is that he has stored options for each customer as a comma separated value in MySQL. The entire application is NOT OOP based and so there are repeated references and queries in almo...
Almost in all stages of my application, the database inserts / updates / deletions are done by the application code (in my case, PHP).
However, in some situations, I am using MySQL triggers to do some calculations and changes to the tables.
Is this a recommended approach? Or is there any best practice rule that only the application sho...
Hi,
I am implementing a tag cloud system based on this recommendation. (However, I am not using foreign keys)
I am allowing up to 25 tags. My question is, how can I handle editing on the items? I have this item adding/editing page:
Title:
Description:
Tags: (example data) computer, book, web, design
If someone edits an item details, ...
Not sure whether to post this in Apache, PHP or MySQL but I'm having an issue with the path as I am feeding into a mysqldump command. There is a space in my path and that is what is causing me grief. I know it needs to be quoted but no matter how I try and quote it, I either get PHP errors or mysql errors telling me that the path cannot ...
I'd like to use mysqldump to back up my database and have written a script to do this by dropping into a shell and issuing a mysqldump statement. Is there a way to get the same dump but without using a shell? Isn't there a way I can use straight SQL to do this?
...
Hello all,
I couldn't decide if this question fitted here or superuser. I guess it can be moved if not appropriate.
I am developing a new piece of software with somebody else and we are half way now. However, the changes we now make are getting messy as we do not know what changes have been made. So I wanted to know what you guys use t...
This is driving me nuts! I am getting the classic "Can't connect to local MySQL server through socket '/var/run/mysql4d/mysql4d.sock' (13)".
Everything I've dug up so far tells me my setup should be OK (eg, defining the sockets in php.ini and my.cnf, etc). Worse... phpmyadmin works with the same un/pw I am using in my own php. So o...
Hello guys, hope you all had a happy new year.
So, my question is, what's the best way to make a log of actions. Let me explain it with a example, suppose we have these entities:
User
Friend (User is a friend of another User, many to many relationship)
Message (An user can message another user)
Group (An user can be in various group...
Hi -
I'm working on a web-based application using mySQL, and I've used it in the past. I've never seen a mySQL error other then something during the development process -- ie. poorly formed selects -- but once its 'working' what kind of errors are there?
I've never seen an insert or select fail - can they? If the syntax is correct, why...
I have existing websites with PHP/MySQL framework. They are very busy and chat, events, vs (interval) ajax implementations added to server load as well. Now websites are going bigger so I need to change to long polling/comet but apache is not very well with these and most of the comet servers are done in Java. Like cometd, www.stream-hub...
I'm using MySQL, latest version. By default I get *latin1_swedish_ci* which doesn't sound really correct.
...
Hello,
I've got a website where people can create a table of an unknown length containing two columns, word_1 and word_2, and store this table in a database. It is of course very simple to insert these values into the database by just iterating through the rows.
Now someone decides to update some of the values and he goes to the edit-p...
What are specific features from Postgres that are not available in MySQL?
Are there some queries that you wouldn't be able to do as easily? Or are the differences mostly in how you store your data?
...
Hi,
I have a table which records users's scores at a game (a user may submit 5,10,20,as many scores as he wants).
I need to show the 20 top scores of a game, but per user. (as a user may have submitted eg 4 scores which are the top according to other users's scores)
The query i have written is:
SELECT DISTINCT
`table_highscores`.`us...
When I make a query from the mysql console and it has accents or any character that needs to be utf-8 encoded, it gets mugged
INSERT INTO users (userName) VALUES ("José Alarcón");
SELECT userName FROM users;
José Alarcón
SET NAMES utF8 changes nothing --default-character-set=utf8 as parameter changes nothing
Keep in mind than this i...
I've done a lot of searching on this, so please forgive me if I've missed it, but this seems to be pretty unique.
I've got a table in a form that I need rows (and fields) to be dynamically added, and then I need jQuery to manipulate some of those fields, and then they must be passed off to PHP to be dumped into a MySQL database.
I've g...
I am trying to create a news page for a website I am working on. I decided that I want to use correct MySQL queries (meaning COUNT(id) and joins instead of more than one query or num_rows.) I'm using a PDO wrapper, that should function fine, and this still fails when run directly through the MySQL CLI application.
Basically, I have 3 ta...
So I made a table with columns "from" and "to".
While writing to the table is fine because I am inserting one value into each column (and not referencing the columns by name), but whenever I want to retrieve data (SELECT), I want to retrieve... say, only the "from" column.
Except as you guessed, it interprets "from" as an SQL command i...
A table contains the string "Hello world!"
Thinking of * as the ordinary wildcard character, how can I write a REGEXP that will evalute to true for 'W*rld!' but false for 'H*rld!' since H is part of another word. 'W*rld' should evalute to false as well because of the trailing '!'
...
$result=mysql_query("SELECT * FROM users WHERE pass='".sha1($_POST['mainloginpass'])."'");
if(mysql_num_rows($result)==1){
it says that "mysql_num_rows() expects parameter 1 to be resource, boolean given"
...