mysql

php-mysql error while inserting into table

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 '' at line 1 ...

MySQL index building performance

I tried to build an index over a two columns of a 30,000,000 entry database. I canceled the process after ~60hr as it didn't seem to work. For some reason MySQL takes only 22 mb ram instead of using the RAM fully. Is index building an operation that needs no Ram or is there some way to tell MySQL to use more RAM to be faster? ...

Import MySQL database into a MS SQL Server

I have a .sql file from a MySQL dump containing tables definitions and the data to be inserted in this tables. How can I convert this database represented in the dump file into a MS SQL server database? ...

How to use java to connect to local Mysql?

Is it need install anything? And if need , I want to get a full step to follow. And a simple connection coding. Thank you ...

mySQL removes first digit

Hi guys, I am inputting data into a mySQL database via a PHP script, but for some reason when I check the database, all of the phone numbers have their first digit removed, like so, 0123456789 shows up as 123456789 in the database, but if I change the data type from INT to TEXT, it shows correctly, I am very hesitant to keep it as TEXT t...

MySQL UpdateXML with automatic node inserting?

I am writing an application that supports custom fields. Currently I store all custom fields in a XML formated text field ( e.g. '<root><field1>val1</field1><field2>val2</field2></root>' in cust_field) I am able to to use updateXML(cust_field, '/root/field1', '<field1>new value</field1') to update those values, however if I use updateXM...

Is there a MySql implementation of OAuths SimpleOAuthDataStore?

Hi, I've recently been using OAuth to secure resources on my server. The distribtion comes with SimpleOAuthDataStore.php. However I was wondering if anyone knows of a MySql implementation of this (in PHP)? Thanks Rich ...

Insert / Select with different Values Possible in MYSQL?

I need to insert values in to the db. INSERT INTO tblname(f1,f2,f3) SELECT f1,f2,f3 FROM othertbl This would insert exactly the values f1,f2,f3 from othertbl. What i want to do is Inserting a different value for f2. How can i do that in MYSQL. I hope i could explain my problem clear. ...

How to get available values for SET field?

Hello, Is there any way to get available values for SET field in table? Thank you. ...

Inserting Cells Into A Table ?

How do i go about inserting a cell into a table? For example, i retrieve data from a database using MySql and PHP, how do i then go about inserting a cell into an already scripted table? In my case, how would i insert a cell into a row 150 pixels from the start of the row? example: ___________________________________________ | <--15...

For databases, does choosing the correct data type affect performance?

And if so, why? I mean, is a tinyint faster to search than int? If so, what are the practical differences in performance? ...

How to simplify the following tables and optimize?

Hi Now i have a table with the following fields id country hdate religions season description link rate and i store the data within this table , my sample data will be 1 Afghanistan 2008-01-19 Islamic Winter Ashura ashura 2 2 Afghanistan 2008-03-20 Islamic Winter Mouloud (Birth of the Prophet) mouloud 4 ...

How do I insert data from a Python dictionary to MySQL?

I manipulated some data from MySQL and the resulting dictionary "data" (print data) displays something like this : {'1': ['1', 'K', abc, 'xyz', None, None, None, datetime.date(2009, 6, 18)], '2': ['2', 'K', efg, 'xyz', None, None, None, None], '3': ['3', 'K', ijk, 'xyz', None, None, None, datetime.date(2010, 2, 5, 16, 31, 2)]} How d...

Mysql BETWEEN cluase being ignored. No syntax error.

im trying to show items booked between two separate date columns (start and end dates). i want to search between the dates but the query seems to ignore any dates that land between the selected dates. SELECT bookings.booking_id, bookings.booking_id, bookings.booked_from, bookings.booked_from, bookings.booked_till, item_set_computer.item...

How should I go about creating a point system for users like SO and yahoo answers?(PHP)

I am creating a voting system for a Q&A site project in which if a user asks a question, he/she losses -5 points; answer a question +5, vote a question +1, etc. (kind of like SO and yahoo answers) -->To create the basic arithmetic, I have a "users_points" table that relates the user_id and their total points. +---+---------+ | 1 | 100...

Custom model fields for a CMS

I've very fond of mapping my models using an ORM like Doctrine. For an upcoming project, I need to allow the user to add custom fields to my models. I was wondering the best way to go about doing this? In the past I have done this by creating a database table 'custom fields' which looks like this: field_id->pk field_model->ida field_t...

where should I do the calculating stuff,PHP or Mysql?

I've been doing a lot of calculating stuff nowadays. Usually I prefer to do these calculations in PHP rather than MySQL though I know PHP is not good at this. I thought MySQL may be worse. But I found some performance problem: some pages were loaded so slowly that 30 seconds' time limit is not enough for them! So I wonder where is the b...

How to SUM() from an offset through the end of the table?

If SELECT SUM(amount) FROM transactions ORDER BY order LIMIT 0, 50 sums the amount field for the first 50 records in a table, how do a sum all records after the first 50? In other words, I'd like to do something like SELECT SUM(amount) from transactions ORDER BY order LIMIT 50, *, but that doesn't work. ...

fetch_all or fetch_assoc MySQLi statement

Hi, is it possible to use the fetch_all(), fetch_assoc() etc. from the the MySQLi_Result class with a prepared statement from the MySQLi_STMT class? I've done it using the query() method in the Mysqli class (and by escaping trough mysqli_real_escape_string()), but not using statements with binding parameters. I'm considering using PDO ...

Non Working Relationship

Hello everyone, I got a problem with cake's model architecture. I got a Users-Model and a Metas-Model. Here are the model codes: Users: <?php class User extends AppModel { var $name = 'User'; var $validate = array( 'username' => array('notempty'), 'email' => array('email'), 'password' => array('notempty') ); var $dis...