I have a PHP script that will generate a report using PHPExcel from data queried from a MySQL DB. Currently, it is linear in processing in that it gets the data back from MySQL, reads in the Excel template, writes the data to the template, then outputs it. I have optimized the code to the point that the data is only iterated over once, a...
I have a stored procedure:
delimiter //
create procedure userlogin(in eml varchar(50))
begin
select * from users
where email = eml;
end//
delimiter ;
And the php:
$db = new mysqli("localhost","root","","houseDB");
$eml = "[email protected]";
$sql = $db->query("CALL userlogin('$eml')");
$result = $sql->fetch_array();
The error...
Hi
I need to create a script which will run on Windows 2003 and Windows 2008 servers to query the locally installed MS SQL Server (2005 and/or 2008) and then write the results to a MYSQL DB on the Internet.
Any ideas how to create this? should I use vbscript? or a stored proc?
...
My table looks like this:
`MyDB`.`Details` (
`id` bigint(20) NOT NULL,
`run_id` int(11) NOT NULL,
`element_name` varchar(255) NOT NULL,
`value` text,
`line_order` int(11) default NULL,
`column_order` int(11) default NULL
);
I have the following SELECT statement in a stored procedure
SELECT
RULE
,TITLE
,SUM(IF(t.PASS...
Hi,
I am trying to find out the maximum value for an integer (signed or unsigned) from a MySQL database. Is there a way to pull back this information from the database itself?
Are there any built-in constants or functions I can use (either standard SQL or MySQL specific).
At http://dev.mysql.com/doc/refman/5.0/en/numeric-types.html it...
I need to run a PHP loop for a total of 100, 000 times (about 10, 000 each script-run), and each loop has about 5 MySQL UPDATES to it. When I run the loop 50 times, it takes 3 sec. When I run the loop 1000 times, it takes about 1300 sec. As you can see, MySQL is slowing down ALOT with more UPDATEs.
This is an example update:
mysql_quer...
I am trying to work out the hits per hour from a database. Data basically is stored as follows :
Table Name: Visitors
============================
VisitorIP TIMESTAMP
----------------------------
15.215.65.65 123456789
I want to display total hits per hour (within the last 6 hours ) including the hours that has no hits....
Basically, this is what I currently use in an included file:
$sites[0]['url'] = "http://example0.com";
$sites[1]['url'] = "http://example1.com";
$sites[2]['url'] = "http://example2.com";
$sites[3]['url'] = "http://example3.com";
$sites[4]['url'] = "http://example4.com";
$sites[5]['url'] = "http://example5.com";
...
I've downloaded the "dbd-mysql-0.4.4.zip" and linked it to my project. While I try to run a demo code from NetBeans the very first line
require "dbi"
gives me an error. Is there a different way to do it?
I also tried
jruby setup.rb config --with=dbi,dbd_mysql
from the command prompt and it gave me the following error:
config: unknow...
This is staight forward I believe:
I have a table with 30,000 rows. When I SELECT DISTINCT 'location' FROM myTable it returns 21,000 rows, about what I'd expect, but it only returns that one column.
What I want is to move those to a new table, but the whole row for each match.
My best guess is something like SELECT * from (SELECT DIS...
I have a table with these columns: win, los, id ...
I want to order the table by this index: win / ( win + los ) * 30 + win / SUM(win) * 70
and then to find the rank for two id's.
I'm not very good on mysql, so what I wrote is totally wrong. (It uses Perl + DBI + DBD::mysql):
$stmt=$con->prepare("SET @rk := 0");
$stmt=$con->prep...
just want to verify that database partition is implemented only at the database level, when we query a partitioned table, we still do our normal query, nothing special with our queries, the optimization is performed automatically when parsing the query, is that correct?
e.g. we have a table called 'address' with a column called 'country...
I'm have a problem with an invite system. The if statement seems to break. It shows the message "Fail" but the UPDATE statement still executes. Why do both the THEN and the ELSE excute?
$dbConn = new dbConn();
// Check if POST user_username and user_hash are matching and valid; both are hidden for fields
$sql = "SELECT user_username "
...
I have 2 files, one is used to view the data in the mysql database, and list it on a table:
if($_POST['general'] == 'ADDRESS'){
$result2 = mysql_query("SELECT * FROM student WHERE ADDRESS='$saddress'");
echo "<table border='1'>
<tr>
<th>IDNO</th>
<th>ADDRESS</th>
<th>LASTNAME</th>
<th>FIRSTNAME</th>
<th>VIEW</th>
</tr>";
while($row ...
Hey guys I have a query that selects data and organizes but not in the correct order. What I want to do is select all the comments for a user in that week and sort it by each topic, then sort the cluster by the latest timestamp of each comment in their respective cluster. My current query selects the right data, but in seemingly random o...
Hi all,
I have this problems. using html and php.
May I know how to do this. I have 2 drop down, eg A and B. Drop down B is depend to the drop down A. Example, A have these options which will be called from dbase(no prob with this, tq) (Jack, Carol), and B wil have options depend on A: if select Jack(T1, T2, T3), if select carol(T1,T2...
Hello everyone,
I have a table called pollData. It will always contain only 1 row. It has columns option1, option2, option3, option4, option5 each of type int. In the beginning, these columns have 0 as their value. How do I add 1 to any column, say option2? I mean do i retrieve the value of that column first, perform addition, and store...
Hi I have a simple database for storing friendship, with just two columns person_a, person_b , denoting that person_a and person_b are friends. From a big list like this what query should I run to get say get all friends of 'sam'. Thank you.
...
Hi,
I am trying to get do this:
<?php
$good_customer = 0;
$q = mysql_query("SELECT user FROM users WHERE activated = '1'"); // this gives me about 40k users
while($r = mysql_fetch_assoc($q)){
$money_spent = 0;
$user = $r['user'];
// Do queries on another 20 tables
for($i = 1; $i<=20 ; $i++){
$tbl_name = 'd...
Is it possible to Use cursor in triggers in MySQL? Is it recommended? as someone told me its helpfull to use cursor in triggers for auditing
I need this for auditing...
EDIT
is it helpful to use cursor in triggers for auditing? If Yes then How?
Please help ..
Thank You
...