Hello everyone,
I have a mysql table called pollOfTheWeek. It has a column "pollDate" of type date. I have two questions regarding this :
1. I declared the column while creating the table as [pollDate date] What I wanted is that this column be set automatically, when the user doesnt enter any value for this column. How do i declare the ...
Right now i'm on testing something in a database. It's a wordpress database. i have to write and delete and do other operation on it. As you know it, it has indexing mechanism that will always make every new post inherit the next highest possible ID.
Please consider that this database is a copying of used database. it has been written b...
This may be a bit of a php n00b question but i've managed to get it working this far and I'm a little bit stuck. I'm pulling 12 images with descriptions out of a database. I want to insert them into a client rotator that has 3 sets of 4. They will be contained in divs called clientrotate1, clientrotate2, and clientrotate3 respective...
currently i have a database of music that i have db'd in mysql, now i am writing a php frontend for it, and it will list out everything in a table, it works, but if i search "the beatles" it gives me 453 results(correct) however if i just search "beatles" it results in 0 rows, how would i go about making it able to search for something l...
Hi,
I am try to add id from one table to another table to give a relationship to the tables. I am doing this on a number of tables on insert of data from a form. Example: person owns and item so item has item and person ids to link the two, however in some cases I have optional tables so sometimes the ids of those tables will be added ...
I have mysql database structure like below:
CREATE TABLE test (
id int(11) NOT NULL auto_increment,
title text NULL,
tags text NULL,
PRIMARY KEY (id)
);
data on field tags is stored as a comma separated text like html,php,mysql,website,html etc...
now I need create an array that contains around 50 randomly selected tags...
Hi,
I'm developing an app that is vaguely similar to twitter, in that it allows users to follow one another. I wanted to do this using google app engine, for its scalability promises, but it's proving kind of difficult to get running for a few different reasons.
If I were doing this using mysql, I'd have a _users table, and a _followe...
What is wrong in this code?
$sql = "SELECT * FROM blogs WHERE blog_id = $'blog_id'";
$result = mysql_query($sql);
$rows = mysql_fetch_array($result);
$content = $rows['blog_content'];
echo $content;
The error is : Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\Program Files\xampp\htdocs\jo...
Hello
keyword = house
SELECT * FROM products WHERE description LIKE '%house%'
This query also returns records having keyword, for example, courthouse, but I want to look for house only. How do I search anywhere in the description for "house" only?
Thanks.
UPDATE
just for more clarification ..
actually house, can be at
- the...
Hi
I have an array that I would like to sort using a date field from a MySQL database.
Here is a sample of the array which is named news in my class:
[48] => Array
(
[id] => 14
[type] => 3
[updated] => 2010-04-17 13:54:42
)
[49] => Array
(
[id] => 15
[type] => 3
[updated] =...
I have a classified_id variable which matches one document in a MySql table.
I am currently fetching the information about that one record like this:
SELECT * FROM table WHERE table.classified_id = $classified_id
I wonder if there is a faster approach, for example like this:
SELECT 1 FROM table WHERE table.classified_id = $cla...
I am trying to create a composite key that mimicks the set of PrimaryKeys in the built in MySQL.DB table.
The Db primary key is as follows:
Field | Type | Null |
----------------------------------
Host | char(60) | No |
Db | char(64) | No |
User | char(16) | No |
This is my DataBasePrivilege.hbm.xml fil...
Hi,
I have an SQL table like this : sales(product,timestamp)
I want to display a chart using Open Flash Chart but i don't know how to get the total sales per hour within the last 12 hours. ( the timestamp column is the sale date )
By example i will end up with an array like this : array(12,5,8,6,10,35,7,23,4,5,2,16) every number is the ...
As the title says Im trying to do a simple insert, but nothing actually is inserted into the table. I try to print out errors, but nothing is reported.
My users table has many more fields than these 4, but they should all default.
$query = 'INSERT INTO users (username, password, level, name) VALUES (?, ?, ?, ?)';
if($stmt = $db -> prep...
I've made a simple guestbook mysql/php page. An entry is displayed if the approve column has a value of 1. For the adminstrator, I want to display either "message approved" or "not approved". Here's my code:
while ($row = mysql_fetch_array ($r)) {
print "<p>Guest:" .$row['name']. "</p>
<p>Date:" .$row['date']. "</p>
...
Hi there,
So basically what I'm working with is a database full of phone numbers.
if I get one of those users from that phone database and they sign up to my website I want to automatically associate the number from the database that is already present, how would I go about linking those 2 tables together once a user signs up?
-Aaron
...
SELECT AVG(`col5`)
FROM `table1`
WHERE `id` NOT IN (
SELECT `id` FROM `table2`
WHERE `col4` = 5
)
group by `col2` having sum(`col3`) > 0
UNION
SELECT MAX(`col5`)
FROM `table1`
WHERE `id` NOT IN (
SELECT `id` FROM `table2`
WHERE `col4` = 5
)
group by `col2` having sum...
I have an array being returned from the database that looks like so:
$data = array(201 => array('description' => blah, 'hours' => 0),
222 => array('description' => feh, 'hours' => 0);
In the next bit of code, I'm using a foreach and checking the for the key in another table. If the next query returns data, I want to upd...
Hi there:
If I have a MySQL database with several tables on a live server, now I would like to migrate this database to another server. Of course, the migration I mean here involves some database tables, for example: add some new columns to several tables, add some new tables etc..
Now, the only method I can think of is to use some...
hi,
I'm trying to design a db to store the timetable for 300 different bus routes,
Each route has a different number of stops and different times for Monday-Friday, Saturday and Sunday.
I've represented the bus departure times for each route as follows,
I'm not sure if i should have null values in the table, does this look ok?
route...