I'm trying to set up a table row that does not need a value (no error message if empty) but will insert a default value if empty, as in:
ALTER TABLE tablename ALTER rowname TINYINT UNSIGNED NOT NULL;
ALTER TABLE tablename ALTER rowname SET DEFAULT 0;
I set it up this way, but the value inserted is still NULL.
Is this even possible?
...
I'm hashing using sha256 and outputting it in binary, and storing it in Mysql's BINARY(32).
echo $testsha256 = hash( 'sha256', "aKyAmNsb", true );
However, when I retrieve this value from the database, it's Different
print_r(str_split($returnedpassword));
echo "<br>";
print_r(str_split($testsha256));
echo "<br>";
Array ( [0] ...
I'm looking for some advice on whether or not I should use a separate database to handle my sessions.
We are writing a web app for multiple users to login and check/update their account specific information. We didn't want to use the file storage method on the webserver for storing session information, so we decided to use a database...
We are planning to implement a system for logging a high frequency of market ticks into a DB for further analysis. To simply get a little what kind of storage performance we can get on the different DB solutions I created a little application for inserting a basic row of tick information. When running the same code on a couple of differe...
I have been dabbling in programming/scripting languages since I was a kid. I started off with HTML and CSS, then went on to PHP (which I got quite good at) and then to Python, Perl, and C(++). I've recently done a lot of work in PHP (along with MySQL).
After spending so much time learning these languages, I now want to do something with...
hey
in my members table i would like a summary of all different people in "locations" 1 - 7 of how many people are online and offline.
SELECT location, COUNT(*) FROM members GROUP BY location;
that returns:
1 10
2 5
3 4
4 12
5 6
6 3
7 19
I would like a COUNT for members with a status of 0 (offline) and a status of 1 ...
Hello,
Problem: I want to list n number of games from each genre (order not important)
The following MySQL query resides inside a ColdFusion function. It is meant to list all games under a platform (for example, list all PS3 games; list all Xbox 360 games; etc...). The variable for PlatformID is passed through the URL. I have 9 genres,...
How do I get my mysql database to return 0 if the neighborhood in the WHERE clause doesn't exist? So in the example below, Old Town is not in the database. I'd like the database to return 0 incidents instead of an empty result.
SELECT incidents,
neighborhoods
FROM `myTable`
WHERE neighborhoods ='Old Town'
I also tried
SEL...
This code runs on my local RoR/Windows 7 (64-bit):
sql = ActiveRecord::Base.connection()
last_pk = sql.insert("insert into manual (name) values ('hello new value')")
puts 'last_pk=', last_pk
but always displays "0."
For various reasons I can't use ActiveRecord in this situation.
(Note: The above code runs fine on my shared host.
A...
Well i am here writing some constraints for a db I am working on and i was wondering if I could do the following:
ALTER TABLE Course
ADD CONSTRAINT cs_level
CHECK (clevel in ('P','I','II','III'))
...instead of this:
ALTER TABLE Course
ADD CONSTRAINT cs_level
CHECK (clevel = 'P' OR clevel = 'I' OR clevel = 'II' OR clevel = 'III')
...
My team currently has a development web/database server and a live deployment web server and a live database server. We use SVN with the repository stored on the development server but the problem is our deployment process.
Currently when we need to deploy an update to the live application we simply use SFTP to transfer from the reposi...
I setup my rails project "tracks" using:
$ rails --database=mysql tracks # OK
$ cd tracks
$ vim config/database.yml # correct using mysql adapter, added password spec
$ rake db:create RAILS_ENV='development' # OK
$ rake db:migrate # OK
$ ruby script/generate scaffold user name:string password:string email:string url:string # OK
$ rake ...
I need to use group_concat to build a list of comma separated values but I need the values to be quoted. How do I do this?
This:
425,254,431,53,513,13,1,13
Should be converted to:
'425','254','431','53','513','13','1','13'
...
They will also search part of their name. Not only words with spaces.
If they type "Matt", I expect to retrieve "Matthew" too.
...
I am want to export database table to a file.
I am using the following code, but it gives the following error.
String filename="D:/backup.txt";
I already create
st.executeQuery("select * from tamil into outfile'"+filename+"' fields terminated by ','");
But the error is:
java.sql.SQLException: Can't
create...
I currently have a news website setup in PHP/MYSQL that's a bit old and I'm in the process of migrating it to a new django site that uses Postgresql 8.4 and Psycopg2.
Django's admin models contain a auth_user table and I suspect this is the table I will need to insert all my user rows into.
Q#1: I should just rely on this already made ...
I have an on-line dictionary.
All inputs are saved in table "id-word-unixtime"
Now I want to make statistics of how many words were searched in an day, and then make graph or table with that data.
What is a best way to archive this?
Should i make another table for dates or write php script?
I just need basic direction.
...
I'm trying to have a login form in php. But my current code doesnt work.
Here is the form:
<form name="form1" method="post" action="loginverify.php">
<td><font size="3">Username:</td>
<td></td>
<td><input type="text" name="uname" value="" maxlength="15"/><br/></td>
<td><font size="3">Password:</td>
<td></td>
<td><input type="text" name...
I have a method that basically returns the results of a mysql query.
public function getStuff() {
$this->sort = "myColumn ASC";
$query = ... ORDER BY $this->sort;
return $data;
}
I'd like to reuse that result, only with a different sort order, and it seems like I should be able to grab that data in another method, just by calling th...
Hi,
I have a DATE datatype mysql column in a table. I want to set the value of that column from my java code in the format YYYY-MM-DD
I used following code to test these formats..
Calendar c = Calendar.getInstance();
c.setTime(new Date());
String d = c.YEAR+ "-"+c.MONTH+"-"+c.DATE;
But I get some wierd output if i print out tha...