mysql

assign mysql values into multidimensional array

Hi, I am trying to display a multidimensional array into html table using php nd mysql. The array structure is like below Array ( [az] => Array ( [0] => Array ( [work] => dsdsds [time] => 2:47---2:55 [total] => 8 ) ...

How to create a view/table in my context in mysql ?

Hello, I want to create a view/table in mysql. I have two tables now: create table teacher( id int(10) not null auto_increment, name varchar(50), primary key(id) ); create table student( id int(10) not null auto_increment, name varchar(50), teacher_id int(10), primary key(id), foreign key(teacher_id) references teacher(id) on del...

Conditional where clause in Mysql

How to use Conditional where clause in Mysql? Select * from table where SubId='1' and null Is it right? I want to display records with subId=1 and rows with subId null Any suggestion... ...

Specifying which record to return from a GROUP BY clause

EDIT TO CLARIFY I am probably misunderstanding the use of GROUP BY so I'll just rephrase my question without making assumptions on how to solve the problem: I have a list of term_ids and a table containing objects (which have an object_id PK and term_id as FK among other fields), I need to extract the object with the highest object_id ...

how to avoid & and % in search

Hi i am getting query output as all Records when i put & and % sign in my search string I am using oracle and mysql as a database How i will avoid this , this is dynamically generated query snipit using java WHERE 0 = 0 AND (LOWER (business_keywords) LIKE '%&%'); and WHERE 0 = 0 AND (LOWER (business_keywords) LIKE '%%%'); thank...

How to PASS your own mysql connection to Zend_DB?

I have my own mysql_connect ...etc until i wanted to use ZEND framework in particular with Zend_DB .How do I pass my connection to be used as an adapter to ZEND? $myconn = mysql_connect('...blab',blah etc...) eg. Zend_DB_table::setAdapter($myconn); ...

mysql where condition

Hi, I'm interested in where condition; if I write: Select * from table_name where insert_date > '2010-01-03' and text like '%friend%'; is it different from: Select * from table_name where text like '%friend%' and insert_date > '2010-01-03'; I mean if the table is very big, has a lot of rows and if mysql takes records complia...

What's the proper column type to save urls in MySQL?

I've been using varchar(300),but I've also noticed longer urls. ...

Conditional join in Mysql select statement

I have two tables tbl_studentapplicationdetails and tbl_studentqualification... My second table contains studentId and qualificationId... Now i want to join two tables to get list of students with their qualification... NOTE: Some students may have two or three qualification.... And my query is select distinct t1.dStudent_id,t1.dStuF...

MySQL query outputs odd rows only

I have the following PHP method that returns a JSON string from a MySQL query: $sys_words_ref_join_query = mysql_query(" SELECT user_words.*, sys_words.* FROM user_words, sys_words WHERE user_words.sys_words_ref = sys_words.sys_words_ref & user_words.user_info_ref = '1' LIMIT 0, 7 "); $json_array = array(); while($words_obj = my...

running mysqlbinlog on other server

When I "playback" the statments from binary, the Load data statment fails for obvious reason. LOAD DATA LOCAL INFILE '/tmp/SQL_MB-80-2' REPLACE INTO TABLE some_table How do I make sure that the data is consistent even if I run the extract of the binary files onto a different server? ...

Having an issue with Nullable MySQL columns in SubSonic 3.0 templates

Looking at this line in the Settings.ttinclude string CheckNullable(Column col){ string result=""; if(col.IsNullable && col.SysType !="byte[]" && col.SysType !="string") result="?"; return result; } It describes how it determines if the column is nullable based on requirements and returns either "" or "?" to the ge...

utf8_general_ci convertion

my script is using utf8_general_ci and im trying to transfer to another script that also uses utf8_general_ci the problem is my script store everything as is, like "áéíóú" and the new script as "áéà óú", so im having characters problems like "ru��es" how can i convert that? ...

Help needed in changing these all Queries to dept oriented.

I am getting my deptid like this $deptid=$_SESSION['deptid']; public function setSkillMatrix($data) { //return print_r($data,true); //$ot=""; $deptid=$_SESSION['deptid']; if(!$data || !is_array($data)|| !sizeof($data)){throw new Exception("No data sent.".(is_object($data)?"y":"n"));} //throw...

how to use the key word 'references' in mysql ?

hi, how is 'references' keyword use while "creating" a table ? let's say I want to create two tables name them as person and hobby and i want the hobby table to reference the id of person table so how is that ? person table - id - name hobby - id - person_id - hobby_name ...

Convert from Oracle VARCHAR2 to MySQL TEXT

How to do correct conversion of data from Oracle VARCHAR2 type to MySQL TEXT type? I want insert it into mysql table in field with TEXT type through DBLink. ...

unix time in mysql

when they say "we will use unix time", does that mean i should create a column like this ? date DATE or date TIME or date DATETIME ? ...

Programatically backing up (and emailing) a full MySQL database via PHP

I need to take a backup of a MySQL database daily, and preferably have it email itself to an email address of my choosing. Is it possible to do this? What is the SQL to generate a backup file? How can I add this file as an "attachment" to the email which is sent? Thanks for the help, I really need to make these backups! I do know how...

Undefined mysql functions using mySql5 + php5 + apache2 installed by macports under mac os x

I've installed mySql5 using macports and did manage to run the mysql server. but from some reason all mySql related functions like mysql_connect return an error message saying "a call to undefined function...." under php5. Here is partial mysqlnd section taken from the phpinfo report: mysqlnd enabled Version mysqlnd 5.0.5-dev - 081106...

date change in sql

hi I have a date which is 2009-06-02 00:00:00.000 and i want to only group by month .. how can change it ?! ...