mysql

Problem with login script

Hello, I'm trying to make a login script but I'm stick with a problem: <?php session_start(); if (isset($_POST['username'])) { $username = mysql_real_escape_string($_POST['username']); $password = mysql_real_escape_string($_POST['password']); $query = mysql_query("select id from users where username = '$username' a...

mysql stored-procedure: out parameter

Hello, I am learnig how to use mysql procedures (google book) and one example goes as: DELIMITER $$ DROP PROCEDURE IF EXISTS my_sqrt$$ CREATE PROCEDURE my_sqrt(input_number INT, OUT out_number FLOAT) BEGIN SET out_number=SQRT(input_number); END$$ DELIMITER ; Which compiles fine... (I am using mySQL Query Browser in ubuntu). But,...

How good is Rails and PostgreSQL support?

I am thinking of working on a Rails application that uses PostgreSQL. I have some questions before I am comfortable using Rails: Is PostgreSQL support in Rails less superior than, say, MySQL. Would it feel any different if using PostgreSQL? Are there any cases where using PostgreSQL fail to work? Thanks. ...

Approch for designing Database for Mobile Applications?

Possible Duplicate: Standard Database Schema for eBook Application ? Hi Friends.. I need to design a design a database for e-Book Application (e-Book DataStore), it will used for holding all information or contents about e-Books,This database will be used to Mobie applications, i.e., when a user seach for anybook, it access the...

GROUP BY ID range?

Given a data set like this; +-----+---------------------+--------+ | id | date | result | +-----+---------------------+--------+ | 121 | 2009-07-11 13:23:24 | -1 | | 122 | 2009-07-11 13:23:24 | -1 | | 123 | 2009-07-11 13:23:24 | -1 | | 124 | 2009-07-11 13:23:24 | -1 | | 125 | 2009-07-11 13:23:24 | ...

Why does this MySQL statement throw a syntax error?

SQL statement: INSERT INTO order (`ORDER_ID`,`SALE_CODE`,`CREATED_AT`,`UPDATED_AT`) VALUES ('2646253286','HPHS20','2009-07-11 12:07:40','2009-07-11 12:07:40') 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 'order (`ORDER_ID`,`SALE_CODE`,`CRE...

select x posts, regardless of number of inner joined category rows

A table with blog posts that are in one or more categories. Now I want to select 10 posts and having the categories for each of the posts. That means inner joining each post on the post-to-category table etc. Problem: limit 10 gives only 10 rows (eg one post with 10 categories). I want to have 10 different posts with all categories for ...

MySQL Query Performance on Calendar Database

Hello all. I am creating a calendar webapp and I'm kinda stuck between a performance vs storage issue in the creation and subsequent queries of my events table. The concept is "how to make a table with repeating events (daily/weekly)?" Here is my current solution: CREATE TABLE `events` ( `eventid` int(10) NOT NULL AUTO_INCREMENT, ...

MySQL database of english words??

I'm looking for a list of English dictionary words for a password application I'm working on. Ideally the list can be easily inserted to a mysql database. Any suggestions? ...

Mysql performance on 6 million row table

One day I suspect I'll have to learn hadoop and transfer all this data to a non-structured database, but I'm surprised to find the performance degrade so significantly in such a short period of time. I have a mysql table with just under 6 million rows. I am doing a very simple query on this table, and believe I have all the correct in...

How can I get around this foreign key constraint having to have a unique name?

I'm not sure why these have to be unique, but from reading the MySQL forums it appears that they do. However, I think it has something more to do with the INDEX name. I have two tables that have foreign key constraints referencing the same primary key on a third table. If it helps, I'm using MySQL workbench to design the schema. I usua...

Speed up this code - PHP/SQL - Short Code but takes incredibly long at the moment

Right, this code goes through a rather large multidimensional array (has about 28,000 rows and 16 parts). Order of events: Check if the data exists in the database if it exists - Update it with the new data if it doesn't exist - Insert it Simple. But right now to go through this it has taken over 30min i think and Still going. $c...

General Error

SQL ERROR [ mysqli ] Can't find file: './tq/phpbb3_config.frm' (errno: 13) [1017] SQL SELECT config_name, config_value, is_dynamic FROM phpbb3_config BACKTRACE FILE: includes/db/mysqli.php LINE: 143 CALL: dbal->sql_error() FILE: includes/cache.php LINE: 51 CALL: dbal_mysqli->sql_query() FILE: common.php LINE: 212 CALL: cache->obta...

Is storing image paths in a database necessary?

First, I noticed there are many questions regarding this, lots marked as duplicate. I eventually came to this one. And the accepted answer for that question although partially solves my question, it doesn't answer all of it. My question is, a user uploads an image. I store the path in the database and the image file in the file system...

MySQL column definition

Is there a way, using MySQL 5.0, to define a column in a table that is to be calculated whenever a select is executed on that particular row? For example say I have two tables, A and B: A: ID COMPUTED_FIELD = SUM(SELECT B.SOME_VALUE FROM B WHERE B.A_ID = ID) B: ID A_ID SOME_VALUE In the example, when I run a select...

Help with Pagination

How would I do to bold the page I'm on and make it unclickable? In the link at the bottom? If I'm on page 3 for example: 1 2 3 4 This script: // how many rows to show per page $max = 15; $page = $_GET['page']; // if $page is empty, set page number to 1 if (empty($page)) $page = 1; $limit = ($page - 1) * $max; $sql = mysql_query("...

Does CakePHP handle FKs on the code level or should I be adding FKs to my db too?

Will I suffer consequences later if I add FKs with ON DELETE CASCADE and such? If not, what naming convention should I be using for FKs within MySQL for CakePHP? ...

MySql driver not installed error for Zend application

I am trying to get my ZEND application up on my apache server running on UNIX. Initially my host didnot give PDO support ,and i got it enabled by requesting them with a mail.But now I am getting an error saying The mysql driver is not currently installed The stack trace is like: An error occurred Application error Exception informatio...

Drupal MySql database design question

I was just looking at the MySql database created by drupal after I installed it. All the tables are in MyISAM. With a complex software like drupal, wouldn't it make more sense to use foreign keys and hence InnoDB tables to enforce referential integrity? Without foreign keys all the constraint checking will happen at the PHP end. ...

SQL Injection in Java/MySQL - multiple queries

Hi everyone, I've got a web application with an SQL injection as part of an INSERT statement, it looks like this: INSERT INTO table1 VALUES ('str1', 1, 'INJECTION HERE') I can insert the regular multiple-query injections such as ');truncate table1;-- but due to the fact that Java+MySQL is used it does not allow stacking multiple queri...