$db_user="root";
$db_host="localhost";
$db_password="root";
$db_name = "fayer";
$conn = mysqli_connect($db_host,$db_user,$db_password,$db_name) or die ("couldn't connect to server");
// perform query
$query = 'SELECT * FROM posts';
$result = mysqli_query($conn, $query) or die ("Couldn't execute query.");
// use returned data
while($row...
$query = "SELECT posts.*
FROM map, posts, tags
WHERE map.tag_id = tags.id
AND (tags.name IN ('mysql', 'database'))
AND map.post_id = posts.id
GROUP BY posts.id
HAVING COUNT( posts.id ) = 2";
I don't understand the last row. Can someone please explain it for me? What is the difference if I don't have it there?
...
i dont understand one thing. why do i have to use foreign key to link to a primary key in another table?
when i query i type like "where table1.foreignkeycolumn = table2.primarykeycolumn.
does this not work if i havent assigned a foreign key to primarykey?
...
When I'm trying to create a foreign key linked to a primary key in another table I get:
#1452 - Cannot add or update a child row: a foreign key constraint fails
(`fayer`.`#sql-225c_1d3`, CONSTRAINT `#sql-225c_1d3_ibfk_1` FOREIGN KEY (`country_id`)
REFERENCES `countries` (`id`) ON DELETE CASCADE)
I have checked that all tables are usin...
I want to add a transparent png into google maps instead of using the default icon. Where in my sample code would I change the default icon to a png named transparent.png?
Thanks!
function onLoad() {
map = new GMap(document.getElementById("div_map"));
map.addControl(new GSmallMapControl());
map.addControl(new GMapTy...
Suppose the target database is called "v3"
...
Hello,
I have a database (MDB, Access) and I connect it to my program using an OLE object,
now I have in the db a column filled with dates (ddmmyy),
I want to search and view (in Data grid view) all the fields that has a date before a Specific Date that I define .
the code of search that I used is :
SQLstr = "SELECT * FROM tb WHERE...
Hi, All
When I run following code:
public ActionResult Complete()
{
try
{
VeriTabanDataContext db = new VeriTabanDataContext();
db.Persons.InsertOnSubmit(_person);
db.SubmitChanges();
return View(_person);
}
catch (E...
I have around 100 computers and few workers on each of them. The already connect to a central database to query for job parameters.
Now I have to do job scheduling for them. One job for one worker takes few minutes, doesn't require network connection (except for dealing jobs and reporting) and can be done at any time in any order.
Cons...
Can anyone suggest resources that take a mathematical approach to relational databases? Essentially relational algebra I'd guess.
I have a mathematics background and now work a great deal with databases and would like to close the gap.
...
Hi there!
I'm designing database app with ZeosLib. On one form I have some Lookups that should refer to the same dataset. Is it safe to create one TDataSet descendant and then connect few TDataSources to it ?
...
Let's say I have 2 tables, Message and Product. Whenever a user post a new products or messages, users who subscribe to that particular user will have their feed updated.It is similar to Facebook feed.
The problem is how to combine the records from 2 different tables, Message and Product, to make a news feed, the feed has to be sorted b...
Assuming you're hewing closely to the conventions of a ZendApplication, where should you be setting up a database handler for application developers to access?
I know how to setup a ZendDb adapter. What I want to know is, in the context of the Zend Framework, how should developers be instantiating their DB handlers so they don't have t...
i am trying to create a many to many relationship between 2 tables. ive got 3 tables for that. it follows TOXY model.
table a: a.id (primary key)
table ab: ab.a_id (foreign key) ab.b_id (foreign key)
table b: b.id (primary key)
how should i insert the data so it will be all linked up?
like this? "INSERT INTO a ('name') VALUES ('my nam...
i have a database about several companies which include their name, price of share, %age change:
NAME PRICE % CHANGE
-------------------------------------------------
a 67 11
b 23 6
c 456 5.89
d 112 ...
Hi, I have a row in a MySQL table with "ö". The whole word is "företag".
How do I select that word in a sql query?
I've tried with fretag but it didn't work. The table is using utf8.
...
i want to use a WILDCARD for everything in the statement beneath:
"SELECT threads.*
FROM thread_tag_map, threads, tags
WHERE thread_tag_map.thread_id = threads.id
AND thread_tag_map.tag_id = tags.id
AND (tags.name IN ('WILDCARD'))";
What should I replace the WILDCARD with to be able to select every entry? I have tried...
Service provider frameworks generally there have two systems viz. OSS(Operational Support System) and BSS (Business Support System). Theses systems are separated by deployment constraint, in most of the cases one has one bss deployed per 'n' number of oss sites.
While designing any such framework is it advisable to have database separat...
hi. in SO you can search for tags without pressing enter.
i want to know:
are the tags retrieved from the database or from a XML file?
is ajax involved?
i am new at front end. if ajax is involved. how should i write the code?
i want it to access a php file which returns the data. but im not familiar with how it works practically.
...
I am trying to insert 10,000+ fields into my database? Is there a limit?
$sql = 'INSERT INTO `_'.$test.'` (`user`, `pass`) VALUES ' . preg_replace($test, $replace, $final_check) . ';';
mysql_query($sql) or die(mysql_error());
Every time I try to insert the data, it fails.
...