What is the best way to store user relationships, e.g. friendships, that must be bidirectional (you're my friend, thus I'm your friend) in a rel. database, e.g. MYSql?
I can think of two ways:
Everytime a user friends another user, I'd add two rows to a database, row A consisting of the user id of the innitiating user followed by the...
I have been using MySQL for years, mainly on smaller projects until the last year or so. I'm not sure if it's the nature of the language or my lack of real tutorials that gives me the feeling of being unsure if what I'm writing is the proper way for optimization purposes and scaling purposes.
While self-taught in PHP I'm very sure of my...
Hello,
Q: Is there a way to direct MYSQLDUMP to export VIEW's with data (and not just the CREATE SQL)? I want to use the resulting SQL to create a new table.
Thanks!
Jon
...
I have a simple query that does
select *
from t
limit 1;
on a remote mysql server.
I use squirrel(mysql client) to run it, it shows:
Query 1 of 1 elapsed time (seconds) - Total: 22.047, SQL query: 1.047, Building output: 21
why does building output take such a long time? what does this process do? when running from mysq...
I'm building a small chat application to add to an existing framework. There will only be 20-50 users MAX at any one time. I was wondering if I could get away with updating a cache file containing (semi) live chat data for whichever users happen to be chatting just by performing timed queries and regular AJAX refreshes for new data as ...
I'm creating a db schema that involves users that can be friends, and I was wondering what the best way to model the ability for these friends to have friendships. Should it be its own table that simply has two columns that each represent a user? Thanks!
...
Hi, I have a mysql table that I need to only contain 20 newest records before adding additional records.
New rows are added daily so I would like it first delete any records that are greater than the 20 allowed starting with the earliest.
The table contains an auto increment "id" column so I can easily determine which is the earliest re...
I get this error: 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 'order (total, addy, cc) VALUES ('798' , '123 sadf' , '12124123')' at line 1
$total = addslashes(($_SESSION['total']));
$addy = addslashes(($_POST['addy']));
$cc = addslashes(($_POST['...
I'm using MySQL with PHP. I want to measure how much memory and other resources MySQL is using when I run a particular query
...
Hi,
It is probably pretty simple but I cannot figure it out: Say I have tables A and B both with the same columns. I need to do SELECT * FROM A,B without having results merged into one row.
I.e. when each table has 2 rows, I need the result to have 4 rows.
EDIT: I know about JOIN but dont know how to join the tables without predicate. I ...
I need to find the category id in the products table below. However the cms_ecom_categories.id is wrapped with the & character like &12&. Is there some kind of wild card i could use to wrap around? like %cms_ecom_categories.id% ?
$sql = "SELECT * FROM cms_ecom_products, cms_ecom_categories
WHERE cms_ecom_products.pCategories...
when this stored procedure executes without this parameter, stored procedure should use the default value and if this parameter is assigned to a value, stored procedure should execute by assigned value.
...
Hello folks,
I'm developing in LAMP (Linux+Apache+MySQL+PHP) since I remember myself. But one question was bugging me for years now. I hope you can help me to find an answer and point me into the right direction. Here is my challenge:
Say, we are creating a community website, where we allow our users to register. The MySQL table where ...
I have a windows program which generates PGP forms which will be filled in later.
Those PHP forms will populate a database. It looks very much like MySql, but I can't be certain, so let's call it ODBC.
And, yes, it does have to be a windows program.
There will also be PHP forms which query the database - examine which tables and field...
EDIT: I've re-written this question, as I got no answer and I'm currently trying to narrow the problem.
I'm trying to create a mysql UDF function checking if a file exists on the server side. This function calls "open/close". It doesn't work even when the file are readeable.
I put the code for this function below:
#include <mysql.h>
#...
I am coding a classifieds ad web app.
What is the optimal way to structure the database for this?
Because of the high repeatability, would it be faster (in terms of searching/indexing) to have a separate table in the database for each city?
Or would it be okay to just have one table for every city (it would have a lot of rows..).
Th...
Is it possible to make all PHP errors be written to MySQL instead of to the standard error_log file. I guess this would be possible if i wrote my own error handler from scratch but i have a lot of legacy code in place and ideally i would just make 1 global change and that would be it. Can this be done?
...
hi guys,
I'm using php + mysql with a full text index.
I have the following contents in the field I want to search:
"Hello: it's a test!"
"Hello i am also a test!"
When I search for "hello:", it finds both rows.
But It should only find the first row - at least until I search for "hello%".
The colon seems not tot be treated as a "norm...
I currently have a bad designed Access database and I'm building a new database using MySQL. In this Access database I have one table, while in MySQL i have three tables to manage the same data thing.
The ERR model is simple. It's an n:m relationship, between the tables "Company" and "Category". Since its an n:m I've got another table c...
Hi,
I've a database who contain some datas in that form:
icon(name, size, tag)
(myicon.png, 16, 'twitter')
(myicon.png, 32, 'twitter')
(myicon.png, 128, 'twitter')
(myicon.png, 256, 'twitter')
(anothericon.png, 32, 'facebook')
(anothericon.png, 128, 'facebook')
(anothericon.png, 256, 'facebook')
So as you see it, the name field is no...