mysql

Categorising a large mysql result with php while?

I'm using the following to grab my large result set from a mysql db: $discresult = 'SELECT t.id, t.subject, t.topicimage, t.topictype, c.user_id, c.disc_id FROM topics AS t LEFT JOIN collections AS c ON t.id=c.disc_id WHERE c.user_id='.$user_id; $userdiscs = $db->query($discresult) or error('Error.', __FILE__, __LINE__, $db->error()); ...

how to insert a converted array to mysql? (Php)

I have converted a json data to array but now i wanted to insert it into my database i keep getting Array here is the code for ($i=0; $i<=$checking; $i++) { $catid = $ids[$i]; $catname = $names[$i]; $catapps = $apps[$i]; $caturl = $iconurls[$i]; $query = "INSERT INTO cat VALUES ('".$catid."','".mysql_real_escape_...

Optimizing MySQL query with several JOINs

I'm upgrading a script to a new version with a hole new database layout. The upgrade starts fine but slowly starts taking more and more time for the same query. The query in question is the following: SELECT nuser.user_id, nfriend.user_id AS friend_user_id, f.time FROM oldtable_friends AS f JOIN oldtable_user AS u ON ( u.user = f.user )...

How to generate random data for testing database performance?

I have created a test table in MySQL and would like to insert 10 million rows with randomly generated data. How to do this random generation process? Is there any predefined method in MySQL or is there any quick query we can construct to do this job? Thank you for any help. ...

Ultra-grand super acts_as_tree rails query

Right now I'm dealing with an issue regarding an intense acts_as_tree MySQL query via rails. The model I am querying is Foo. A Foo can belong to any one City, State or Country. My goal is to query Foos based on their location. My locations table is set up like so: I have a table in my database called locations I use a combination of ac...

Running a background process on an ecommerce website

Hi, I have programmed in C/C++, but I have no experience in web programming. Someone asked me to help them build a e-commerce website selling a service. I started looking into using PHP/MySQL for building the site. My question is: given that HTTP is stateless, how do we get some background process to trigger so that it may, for instanc...

ConcurrencyFailureException

Hi, How can I cause ConcurrencyFailureException in my Spring DAO when it accesses Mysql(myISAM) And Oracle(10g) ? I want to make a real database exception (not the mock one) from my Java code. Thanks ...

Only one result out of ten showing in table

Hello, The code below returns the 10 most recent entries to a MySQL database. That's what I want, but I also want it to display the results in an HTML table. Right now, only the most recent result is in a table, a one-row table. The rest of the results are displayed in a jumble of text. How could I get all of the results in a 10-row...

How to load mysql data on option html form

I have this option form: <tr> <td><font size="3">Civil Status</td> <td>:</td> <td> <select name="cs" id="cs"> <option>Single</option> <option>Married</option> <option>Widowed</option> </select></td></td> What do I do in order to load it with mysql data, like this one: <td width="23"><font size="3">Sex...

NHibernate Insert Ignore

Hello, I need use Insert Ignore for my table, which have Unique index on several fields. How can i do it? Thank you ...

Trying to check if html text box is empty using php

I have this code to verify whether an html text box is empty or not. But I can't figure out what common with admission time and address, that they don't seem to work. The code is not reading them even if I have inputted a data on them: <html> <head> <title>Admission Information Sheet</title> <meta http-equiv="Content-Type" conte...

Need help with a MySQL query

My query needs to do this get user details get last login out of a table of logins that are logged get number of failed logins, but only from the last 3 logins of that user My problem seems to be in the subquery. I want the WHERE part of that to reference the user_id that was matched earlier in the outer query. Is that even possible?...

validation page error

hye guys.. i have a problem where i did'nt knw what the error i have validate page where its checks the group to identify the user if the group is admin, the adminpage will appear.. while if the group is user, the userpage will appear.. situation:when i insert the username and password, the validate page appear with the blank page...i do...

Merge tables by inserting null values for columns where no value can be derived from the merging tables?

I have two different tables and i decided to merge them into one table... the birth table has id, name, country, birthday_date, description, link the death table has id, name, country, death_date, description, link and i want to merge them into a single table with the structure id, name, country, bdate, ddate, desc...

best way to run a periodic query in mysql

Hi all, In my Rails application I have a separate process (BackgroundRb) to delete all transactions which are not successful and it must be run after every five minutes. But in BackgroundRb, it runs a database check after every second though my query executes periodically at the specified time(after 5 mins). So my question is what is th...

MySQL table creation GUI with good keyboard shortcuts? Windows or Web-based

This seems like a trivial thing, but one of the biggest slowdowns in my workflow has become logging in to phpmyadmin for creating and modifying tables- my biggest gripe is the complete lack of keyboard support. I just need a simple tool to generate (and run, ideally) create table and alter statements. Edit: after thinking on this a bit,...

Hierarchical Data in MySql

I have table with parent child relation I want an help on recursive query table structure roleId, roleName, parentId 1 Admin 0 2 Backup Admin 2 3 Office User 1 0 4 User 1 3 5 User 2 3 6 Office User 2 0 7 Off User 1 6 I am trying to make recursive ...

form echoes success without submittting anything to database. Is there something wrong with my flow control?

Here is the code. I really dont why it is not submitting my information. <?php //Includes mass includes containing all the files needed to execute the full script //Also shows homepage elements without customs include ("includes/mass.php"); //Grabbing data form POST array and storing in variables plus the date $username = ($_PO...

Make one field unique depending on another field

hello there.. I have the following MySQL table.. userid - foreign key date - primary key slot1 - 1st free slot slot2 - 2nd free slot slot3 - 3rd free slot slot4 - 4th free slot slot5 - 5th free slot slot6 - 6th free slot slot7 - 7th free slot slot8 - 8th free slot All the slots are for the same day, so the user can input di...

how to get value from the database

i want to get value from database..for exmaple,in the name field, it show the name that stored in the database. i want to show the value in the respective field.but it cannot retrieve the value..plz guys..help me <?php session_start(); $username = $_SESSION["username"]; $department = $_SESSION["department"]; ?> <html> <hea...