mysql

PHP & MySQL striplashes() question.

If magic_quotes_gpc is on will I still need to use striplashes() if no why? is so when and where? ...

SQLite & MySQL - Same Query - Different Resluts - Multiple Joins

I have 2 databases with the same data, but slightly different data types in some fields (eg SQLite DB has TEXT where MySQL DB has varchar(50)) I run the following query: SELECT * FROM audio a, audiocodec ac, fileproperties f, transportstream t, transportservice ts, video v, videocontent vct, videoFrameRate vf, ...

PHP MySQL input HTML tags

I have a PHP MySQL database which I will be storing all my information in. I have a text field on a HTML page that the user can add data to and then on submit a MySQL query inserts this information into a database. Pretty standard stuff. However, I am now in a position where I can attach a TinyMCE or FCKEditor onto my text field (now a ...

Generic PHP MySQL connection class

Are there any great, lightweight MySQL connection classes out there for PHP that anyone recommends? I have written my own, and I do think it is pretty good but this seems like the sort of thing that many programmers better than me must have perfected long ago. I'm interested in finding something that I can slot in generically and use a...

MySQL Left Join with conditional

It seems pretty simple i have a table 'question' which stores a list of all questions and a many to many table which sits between 'question' and 'user' called 'question_answer'. Is it possible to do one query to get back all questions within questions table and the ones a user has answered with the un answered questions being NULL value...

More than one mysql_fetch_array()

CODE1: while( $row1 = mysql_fetch_array($result2) && $row2 = mysql_fetch_array($result4) ) { $details[0] = $row1[0]; $details[1] = $row2[0]; var_dump($details[0]); var_dump($details[1]); } OUTPUT1: NULL string(1) "5" CODE2: while($row1 = mysql_fetch_array($result2)) { $details[0] = $row1[0]; var_dump($details[0]); } w...

Can FOREIGN KEY and CREATE VIEW be used together?

Hi, I would like to make a view, and in that view alter the tables to have foreign keys. From the MySQL manual can I see, that foreign keys only work on InnoDB, but my database is MyISAM. So my question is, is it possible to create a view, and then create foreign keys in that view? http:// dev.mysql.com/doc/refman/5.0/en/innodb-forei...

mysql : loop over tables and alter table add index

I have ~1000 tables that start with the same prefix : table_prefix_{SOME_ID} (i can take the ids from another table) what is the fast way to loop over all the tables in mysql and do : ALTER TABLE `table_prefix_{some_id}` ADD INDEX `fields` (`field`) ...

mysql updating cell content issue

I am trying to update a value in my database but am recieving the following error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''users' ('new_user') VALUES ('1') WHERE 'id'= 5' at line 1 I am trying to UPDATE the table 'users' in the column 'new_...

How we can add unicode Text in MySQL using JAVA

Hey Friends How we can add unicode Text in MySQL using JAVA and reading it using JAVA ...

PHP writing to MYSQL is variable equals 0

I am trying to write to my database if a variable is equal to 0. The problem is that it still writes to the database even when the variables equals 1. What is wrong?? echo $new_user; if ($new_user == 0) { //SENT NEW USER WELCOME MESSAGE $adminid = '9'; $welcomemessagetitle = 'Welcome to The site'; $welcomemessagecontent = 'He...

backup MySQL database with QT

I have a GUI and user can select back up start and end date. Is it possible with a sql query getting back up specific time distance. Thank a lot ...

Data transformation with SQL

I have a table in my database formatted like this: customer old_code new_code C1 A X C1 B Y C2 C Y C2 D Z So the pair of keys customer and old_code map to a new_code. This is great as a way of storing the data, looks ups are very fast, but for human consum...

Safely escaping a variable in a raw SQL query

Im just wondering, would the following be completely safe or would someone be able to get around it using hexadecimal characters, etc: $name = mysql_real_escape_string(htmlentities(stripslashes($_REQUEST['name']))); $query ="SELECT * FROM Games WHERE name LIKE '%{$name}%'"; Thanks. I know I can use PEAR and other libraries to make pr...

MySQL: InnoDB or MyISAM Engine ::: which is better for lot of selects?

I have a huge file (~26 MB) with around 200 columns & 30000 records. I want to import it into a database (InnoDB Engine). I wont't be updating or deleting records ever. ALthough I will be querying a lot of records from the table with high complexity in where clause. Which table engine should i prefer for faster query response? Will it re...

How to make Mysql .Net connector 6.3.3Beta to work in VS Web Express 2010?

I have VS Web Express 2010 installed. I have just installed Mysql .Net connector. I have taken version 6.3.3 as it was advised in [this thread][1]. However I have no option to add a connection to Mysql in VS 2010 Express database explorer. Have anybody such a problem? [1]: · http://stackoverflow.com/questions/901049/how-do-i-connec...

("" OR null) VS NOT(!"" AND NOT NULL) in where clause

Does anyone know if there is a performace differance between the following we parts of a where SQL string in mysql? WHERE ... AND (field = "" OR field IS NULL); and WHERE ... AND (NOT (field != "" AND field IS NOT NULL)); ...

cani i reuse the the memory space of deleted row in a database table

plz give answer ...

How do i remove the table attribute in mysql?

Hi, I have a table in mysql called advertisements, in which there is an entity called position , now while creating the table i have defined the position entity as unique so that i don't get the duplicated entry into the table, now i want to remove that Unique attribute from the table entity Position in the table advertisement. what is...

MySQL update field on insert if other field (not key) changed

I'm relatively confused about this... I've got a table like: +----------------+--------------------------------------------------+------+-----+-------------------+-----------------------------+ | Field | Type | Null | Key | Default | Extra | +--------...