I'm trying to create a nested comment system using PHP and MySQL. But I'm stuck
My Database structure is id, body, time, reply and depth.
A regular comment's reply field will be '0'. If it's replying to another it will correspond to the id of the comment it's replying to.
depth means how deep it is from the highest parent
So if this...
Say you have the following many-to-many table relation:
user
-----
id
first_name
last_name
user_prefs
----------------
id
preference_name
user2user_prefs
-------------
id
user_id
user_pref_id
But say you have the user preference of "homepage" and need somewhere to store the actual homepage url. Where would that go?
I can't put a va...
Hi,
This a bit looks complicated, i want to get the id column value of the processed query.
example:
$qu = mysql_query("INSERT INTO msgs (msg,stamp) VALUES('$v1','$v2')");
i want to get the ID of this query after storing the infos in database.
if it's impossible, is getting the last ID record and adding 1 will be safe and guaran...
I've got two models. One represents a piece of equipment, the other represents a possible attribute the equipment has. Semantically, this might look like:
Equipment: tractor, Attributes: wheels, towing
Equipment: lawnmower, Attributes: wheels, blades
Equipment: hedgetrimmer, Attributes: blades
I want to make queries like,
wheels = A...
For any two values a and b of such type,(a<b)there always exists a c satisfying:
a<c<b
...
So I'm using PHP+MySQL to deliver database contents in XML to a JavaScript.
$xml = "<?xml version='1.0' encoding='utf-8'?><confessions><pending>";
$pending = $m->MySqlHandler->Query("SELECT id, gender, age, confession, date_posted FROM confessions WHERE publish = 0");
foreach ($pending->Rows as $pr)
{
list($id, $gender, $age, $confe...
Hi guys - I have two tables here: One holds a list of subscriber emails:
(ID, email)
and the other holds a list of domains:
(ID, domain)
I want to figure out a sql statement that allows me to select * the email addresses which belong to the domains listed in the domain table assuming that all emails are of the form:
name@domain
...
Hi i have a text value of javascript and i want to store that values in the datbase of mysql
so
...
I have a little problem with fluentNhibernate and MySQL.
I would like to map my entity:
public class Topic
{
public Topic()
{
ParentTopic = null;
}
public virtual Guid Id { get; set; }
public virtual string Name { get; set; }
public virtual DateTime CreatedAt { get; private set; }
public virtual Gui...
I have two scenarios represented below, SCENARIO 1 works as well as SCENARIO 2 but are both those SCENARIOS achieving the Same Objective, Note in both Scenario's otherTbl is static
SCENARIO 1
CREATE TABLE `tbl`(
col1 VARCHAR(255),
PRIMARY KEY(col1)
) ENGINE='InnoDb';
Here is my set of queries that I run previously that make ...
I just wanna ask best practice
supposed I have three tables. posts, categories, post_Categories. One post can have one or many categories
Post
post_id post_title post_body
1 title 1 body1
2 title 2 body2
Categories
cat_id cat_name
1 C#
2 Java
3 PHP
posts_categories
pc_id pc_p...
Hello,
I have the following three tables in a MySQL database in order to give ratings to comments of users:
Users:
id name
-----------
1 Smith
2 Brown
Comments:
id user_id post_id comment
-----------------------------------
1 2 1 Test 1
2 1 1 Test 2
3 1 1 ...
Hi i got a mysql-select about three tables, where each tables have different fields. One may have the field "title", the other may not but have the field "location". Now i want to have a common output of these three tables, and each row is supposed to have a title. for tables, whoch have the field "title" in the output the title should c...
Our software currently runs on MySQL. The data of all tenants is stored in the same schema. Since we are using Ruby on Rails we can easily determine which data belongs to which tenant. However there are some companies of course who fear that their data might be compromised, so we are evaluating other solutions.
So far I have seen three ...
I have this table:
option_values table:
option_id (FK)
value_id (PK)
classified_id (FK)
value
example:
option_id (FK) value_id (PK) classified_id (FK) value
1 1 22 'Petrol'
2 2 22 'Manual'
3 ...
I've been grappling with this one for a couple of days now, but I've reached the limits of my admittedly limited mysql knowledge. I have two tables, groups and parties, using a lookup table groupparty with two columns groupid and partyid. Given a particular party, I simply want to pull out the groups associated with that party. Here i...
When developing using eclipse or NetBeans, do you use phpmyadmin to admin MySQL, or is there a plugin that makes things more integrated?
...
Given a table:
id | score | position
=====================
1 | 20 | 2
2 | 10 | 3
3 | 30 | 1
What query can I use to optimally set the position columns using the (not nullable) score column?
(I'm sure I've seen this before but I can't seem to get the correct keywords to find it!)
...
Hello
Is there a command in MySQL that returns the read-to-write ratio of queries so that I'm able to know on what MySQL spends time, and whether the load would lower significantly by splitting data over two servers.
Thank you.
...
$err = mysql_query("INSERT INTO tridy (id,NazevTridy,url) VALUES (
'$i',
'$tridy->find('div[class=rozvrhseznam]', 0)->find('a[href]', $i)->outertext',
'$tridy->find('div[class=rozvrhseznam]', 0)->find('a[href]', $i)->href')");
mysql_error($err); // line 97
Warning: mysql_error(): s...