Im trying to select random datasets with DataMapper, but seems like there is no such function support.
For example, i have set of data:
+-------------------+
| ID | Name | Value |
+-------------------+
| 1 | T1 | 123 |
| 2 | T2 | 456 |
| 3 | T3 | 789 |
| 4 | T4 | 101 |
| ----------------- |
| N | Tn | value |
...
I'm inserting data from a file that has 18 columns, the table that I would like to insert it into has 20 columns. 2 of those columns already contain data. How do I go about inserting the file into the table without overwriting the existing data.
below is a example of the code. note $line .= ',,' is appending two columns because the upda...
Hi,
I have a separate table for every day's data which is basically webstats type : keywords, visits, duration, IP, sale, etc (maybe 100 bytes total per record)
Each table will have around a couple of million records.
What I need to do is have a web admin so that the user/admin can view reports for different date periods AND sorted by c...
Hi.
I have an existing mysql replication set up (Windows 2008 to Ubuntu 9.04) and created several new tables in the master database. These are not showing up in the slave database.
Do new tables automatically get copied to the slave DB, or do I need to set up replication again?
Thanks!
...
Hi,
I have a query that when I test it with "echo", works well:
$url = "http://search.twitter.com/search.json?q=&ands=&phrase=&ors=&nots=RT%2C+%40&tag=andyasks&lang=all&from=amcafee&to=&ref=&near=&within=15&units=mi&since=&until=&rpp=50";
$contents = file_get_contents($url);
$...
Hi everyone,
I have a somewhat complicated assortment of tables for which I need to do some SQL query construction/optimization. Currently a lot of the logic being used to obtain the results we need is being done at the app layer, which is resulting in terrible performance due to full table traversals, etc. SQL is not my strong suit, ...
This has got to be a simple question, just brain-dumbing right now...
I've got one table, called 'foo'. It's got two columns, 'id' and 'username'.
The id is unique, but some of the usernames reference the same user; just one has a prefix on the username of 'xx_'.
ex:
ID USERNAME
1 bob
2 sam
3 xx_bob
How can I...
I have a link that says remove I have hidden the like by
< div id="remove_$id" style="display:none">< /div>
and then i want to be able to roll over a < tr id="$id" > and then remove comes up only for that id and when you roll off it the remove will be hidden I cant get the jquery code right for it to work
Can some one help me please
...
Can anyone recommend a good wrapper class or extension to PHP's mysqli extension that allows the equivalent of
mysql->fetch_assoc()
for a prepared statement. That is ideally it condenses down into a single statement the tedious complexity of the init/prepare/bind/fetch-loop.
...
Hi
I have a table full of domain names. I'd like to do a search that returns some kind of relevancy results on it. My problem, is that if I do a search for "cool" I want it to return "cooldomain.com", which a fulltext search, unless I'm doing it wrong, will not.
Are there any fulltext options I'm unaware of that will accomplish this? I...
I'm developing a system to allow users to vote on different subjects using a Yes / No / Maybe question set.
Each question will be weighted as 2 (Yes) / 0 (No)/ 1 (Maybe) NOTE(The users will be voting multiple times, potentially huge amounts)
My plan is to store the answers in a mysql db.
Do I store each vote separately? (ID/Vote/)
...
Now for some reason i can't get this code to work
When i move the mouse over < tr id='$id'> i want the #remove_$id to be showing and then hidden when the mouse is moved off
jQuery Code:
$(function() {
var id = this.id;
$("tr").hover(function() {
$("#remove_" + id).show();
}, function() {
$("#remove_" + id).hide();
});
});
PH...
I'm converting an MSSQL DB to MySQL DB and I have a stored procedure that is using a cast function to convert from a datetime datatype to a varchar datatype. Whether or not this matters in php/mysql since php isn't strongly typed (and I dont know if it would matter or not) I really want to keep the SP a close to the orginal as possible s...
This is coming from converting MSSQL to MySql. The following is code I'm trying to get to work:
CREATE TEMPORARY TABLE PageIndex (
IndexId int AUTO_INCREMENT NOT NULL PRIMARY KEY,
ItemId VARCHAR(64)
);
INSERT INTO PageIndex (ItemId)
SELECT Paths.PathId
FROM Paths,
((SELECT Paths.PathId
FROM AllUsers, Paths
...
i tried the solution of Ngu Soon Hui and it works. how about the mysqldump. i tried using the same solution.
$cmd = $mySQLDir1.' -h '.$mydbserver.' --user='.$username.' --password='.$password.' > "'.$file2.'"';
exec('"'.$cmd.'"',$out ,$retval);
where
$mysqlDire1 = $mySQLDir1='"C:\\Web\\WebServer\\mysql\\bin\\mysqldump.exe"';
$file2 =...
Using the update command, I want to change the type_name for a specific entry in the database, but it is changing the type_name for all the entries with the same type_id.
I need it to only change that individual entry's type_name, and not the type_name that is associated with all the entries with the same type_id.
I have an update quer...
EDIT: After feedback from my original post, I've change the text to clarify my problem.
I have the following query (pseudo code):
$conn = mysql_connect('localhost', 'mysql_user', 'mysql_password');
mysql_query("SET NAMES 'utf8'; COLLATE='utf8_danish_ci';");
mysql_query("SELECT id FROM myTable WHERE name = 'Fióre`s måløye'", $conn);
...
Hi All,
I need a help in how to store datetime along with timezone. i am using Mysql 5.1.
i want to do something like -
create table tb1
(
c1 datetime with time zone
);
...
I would like to get all IDs from children in a tree with MySQL only.
I have a table like this:
ID parent_id name
1 0 cat1
2 1 subcat1
3 2 sub-subcat1
4 2 sub-subcat2
5 0 cat2
Now I'm trying to get all child IDs for cat1 (2,3,4) recursively. Is there any way how to achieve that?
Thanks for...
sometimes i get an error like "table is marked as corrupt and shld be repaired". that DB (tables) is using MyISAM. recently that keeps happening. what could be the causes? most recently i am executing a batch insert
INSERT INTO table (..., ..., ...) VALUES (...), (...), (...) ...
and it just hung. or took very long to complete it seem...