mysql

One to many too much data returned - MySQL

I have 2 related MySQL tables in a one to many relationship. Customers: cust_id, cust_name, cust_notes Orders: order_id, cust_id, order_comments So, if I do a standard join to get all customers and their orders via PHP, I return something like: Jack Black, jack's notes, comments about jack's 1st order Jack Black, jack's notes, comm...

Create Duplicate Records on SELECT for Calendar Date Range

Hey all, I've built a pretty shnazzy calendar system but there is one tweak that I need to make so that I'm completely happy with it. My calendar has three tables: calevents - The calendared event. caldates - The occurrences and date-range of each occurrence for each event. calcats - The categories that can be applied to an event. ...

best way to display image in php

Hi, I am storing images in mysql Db directly. what is the best way to display the image in good quality (thumbnail and original size images) using php. ...

Search tamil fonts in mysql and php

Hi, How to search tamil fonts and retrieve data from mysql and show the result using php? ...

How do I get the current time zone of MySQL ?

Anyone knows if there is such a function in MySQL? UPDATE This doesn't output any valid info: mysql> SELECT @@global.time_zone, @@session.time_zone; +--------------------+---------------------+ | @@global.time_zone | @@session.time_zone | +--------------------+---------------------+ | SYSTEM | SYSTEM | +------...

How to rearrange Mysql columns?

I need to move the position of existing columns (for better visibility). How can this be done without affecting the data? ...

Join query in MySQL cursor

We can declare a cursor like this DECLARE cur1 CURSOR FOR SELECT id,data FROM test.t1; Can we use a join query instead of a simple query? ...

How to fetch a random record from SQLite database?

I am working on PHP. I was working with MySQL before. Here is the code I used - $offset_result = mysqli_query($con, " SELECT FLOOR(RAND() * COUNT(*)) AS `offset` FROM students "); $offset_row = mysqli_fetch_object( $offset_result ); $offset = $offset_row->offset; $result = mysqli_query($con, " SELECT name FROM students LIMIT $offse...

PHP & MySQLi timeout

Whenever I try to create a mysqli object, as in; $mysqli = new mysqli(host, user, pass, database); ...the page just loads for around a minute, then stops, showing all the content of the page up until that line. info() says that MySQLi (and MySQL if that matters) are enabled, and I can access the MySQL CLI. I'm also working on a local...

problem in using while loop in php&mysql

hey guys im using a while loop to show my latest forum topics and count some fields I'm trying to do it in one query and here is my code : SELECT t.*,p.*, SUM(t.topic_approved='1') AS Amount_Of_Topics, SUM(t.topic_views) AS Amount_Of_Topic_Views, SUM(t.topic_replies) AS Amount_Of_Topic_Replies, SUM(p.p...

MySQL on Windows-7 (64-bit) on 0.0.0.0:3306 rather than 127.0.0.1:3306

I've just installed the latest production release of MySQL (64-bit) on my Windows 7 box. It was a straight vanilla install, using all defaults; but phpmyadmin can't see it at all. MySQL is configured as a service to start automatically, and I know it's running because the MySQL GUI tools work correctly. The actual error message that I'm...

Tomcat, Hibernate and the java.io.EOFException

Hi, My Java application, which uses Hibernate and it's hosted by Tomcat 6.0, gets the following exception after a long time of inactivity when it tries to access the DB: com.mysql.jdbc.CommunicationsException: Communications link failure due to underlying exception: ** BEGIN NESTED EXCEPTION ** java.io.EOFException STACKTRACE: ja...

Unable to convert MySQL date/time value to System.DateTime

Hello I am using ibatis and C#. i get a result from a select query that has CreatedDate as one of the field. The Datatype of CreatedDate in Mysql is Date. I assign the result set of the select query to a Ilist< DeliveryClass>. Here the DeliveryClass CreatedDate as DateTime. When i run the application, i get Unable to convert MySQL da...

How to find the differences between the values of a specific column based on a key?

I've two tables as purchase_details and invoice_details and i want to store the inventory/stock of each product from the data of these two tables. structure of purchase_details. 'pid', 'int(10)' 'product_id', 'int(10)' 'quantity', 'float(8,2)' 'amount', 'float(12,2)' 'expiry_date', 'date' structure of invoice_details. 'invoice_id...

Making a module based social networking cms

What does it take to create a social networking cms like phpfox or socialengine . I am interested in using php / mysql . However , I want it to be modular , like above examples . Like I can enable disable videos from backend . Most important , it should have ability to allow others to extend it , like facebook applications . Shou...

sql select with exact outcome

Asking a simple question, just want everyone have fun to solve it. I got 2 tables. 1. Student 2. Course Student +----+--------+ | id | name | +----+--------+ | 1 | User1 | | 2 | User2 | +----+--------+ Course +----+------------+------------+ | id | student_id | course_name| +----+------------+------------+ | 1 | 1 | ...

php and mysql primary key question

Hi All, I have one simple table. the primary key column name is id. I have almost 200 records and some how i deleted some of the records. Now the id column has following entries 1 2 4 5 6 8 9 Can any body tell me what query can I write that return me all the missing rows? For example 3,7 rows in above example. Or any php funtion that ...

PHP classes, parse syntax errors when using 'var' to declare variables

I am a C# guy trying to translate some of my OOP understanding over to php. I'm trying to make my first class object, and are hitting a few hitches. Here is the beginning of the class: <?php require("Database/UserDB.php"); class User { private var $uid; private var $username; private var $password; private var $realname; ...

Changing CCK content-types details results in numerous DB calls for the menu system

Every time I make a change in the details of a content-type it takes too long. I though it had to do with the fact that I had too many content-types and fields (~500), but when I load the devel module to see the queries that take that long I see: Executed 32212 queries in 12267.57 milliseconds. Queries taking longer than 5 ms and que...

Javascript timezone solution needed(taking into account the actual difference in UTC timestamps)

I have unix timestamps from time zone X which is not known, the current timestamp(now()) in TZ X is known 1275143019, how to approach a javascript function so that it can generate the datetime in the users current TZ in the format 2010-05-29 15:32:35 ? UPDATE I'm not a unix timestamp expert,if unix timestamp is always the same in dif...