So I've got some images stored in a MySQL database as BLOB's (I know it's better to just store the directory and do it that way, but this is what I need to do for now) and I need to display them on a webpage. Now, I know how to make a script and give it an image header and pull the img src from there, but I have a lot of images from diff...
Given the following tables:
Topic
id, last_updated_child_id
Response
id, topic_id, updated_at
How do I update the Topic table so the last_updated_child_id is equal to the latest response id (based on date).
So for example given:
Topic
id last_updated_child_id
-- -----------------------
1 null
2 null
3 null
Respon...
Is it possible to assign php array in MySQL IN() function? for example,
$numbers = array('8001254656','8886953265','88864357445','80021536245');
$sql = mysql_query("SELECT * FROM `number_table` WHERE `number` IN ($numbers)");
Any Ideas?
Thanks,
...
We have a large number of data in many categories with many properties, e.g.
category 1: Book
properties: BookID, BookName, BookType, BookAuthor, BookPrice
category 2: Fruit
properties: FruitID, FruitName, FruitShape, FruitColor, FruitPrice
We have many categories like book and fruit. Obviously we can create many tables for them (M...
Hello, I am trying to fix this pagination script. It seems when I click on the pagination links [1][2][3][4]or[5] , it doesn't work. It just shows the first page and when clicking on the next numbers nothing happens. I hoping someone can see something in the script that I can not see.
The main page looks like this (pagination.php):
<?p...
Maybe i have the wrong context but...
Is there a corelib site for mysql like http://corelib.rubyonrails.org/ for ruby on rails RoR?
Would be nice to have 1 stop shop. thx.
...
What are the possible disadvantages / pitfalls of using linux system user 'mysql' to work with mysql server instead of creating a separate use?
...
The mysql table has a DATETIME field. I want to INSERT a new row into this field using the cell data from the Excel worksheet. But I cannot use the datetime formatted cell value in a INSERT INTO query. How can I implement this?
...
I have a Windows Application in C#. This application interacts with a remote mySQL database. Should I create a PHP web service to do these (insert/add/delete/update) or use mySQL connector for c#? I'm not sure which way is better.
Thanks!
...
I have the following MySQL table structure:
num field company phone website
1 Gas abcd 123456789 abcd.com
2 Water efgh 987654321 efgh.com
3 Water ijkl 321654987 ijkl.com
4 Heat mnop 987654321 mnop.com
5 Gas qrst 123789654 qrst.com
...
Is it possible with PHP (maybe using some mixture of GROUP_BY and ...
Hi,
I used the php script in
http://sourceforge.net/projects/dmoz2mysql/files/
to download , extract , clean , parse and insert dmoz data into mysql table. i encounter no problem while processing structure.rdf . But while parsing content.rdf , there is an abrupt pause after inserting 3200000 rows.. and nothing happens after that - ...
Hi,
i am using a query inside php as
$query = 'SELECT * from #__chronoforms_UploadAuthor where text_6 like "%'.$_GET['title'].'%" and text_7 like "%'.$_GET['author'].'%" limit 0,1';
where i am trying to insert a php variable instead of 1 in the limit..
$query = 'SELECT * from #__chronoforms_UploadAuthor where text_6 like "%'.$...
I have a table with 3 fields:
ID (not unique, not primary key)
timestamp
marker
I want to get the last entry for every distinct ID, but when I doSELECT ID, max(timestamp) from table GROUP BY IDthe marker field is wrong.
I have another table with the following fields:
ID (unique, primary key)
lat
lng
I would like to perform the s...
I was using XAMPP for my local machine but as I wanted to run applications like mysql work bench and some test frameworks I decided to switch to LAMP self install. I'm using ubuntu and followed the instructions at: https://help.ubuntu.com/community/ApacheMySQLPHP
But the problem is LAMP is consuming too much of my memory (RAM) I've allo...
$query = "SELECT field1, field2 FROM table WHERE id IN (1, 2, 3, 4, 5)"
$result = mysql_query($query);
$array = mysql_fetch_assoc($result);
If there is no id#3, then $array['field1'][3] returns next result (if any).
But I need it to return 0 in that case.
So that $array should contain 5 elements, even if not all were in database.
I...
SELECT * FROM ...LIMIT 5, 10
But what if I want the total rows? I don't want to make another query without the limit. I just want this one query to return the total rows if I didn't put the LIMIT in there.
...
I have an input file I want to load into a MySQL database, but spread throughout the file are comment lines, which start with !. For example,
!dataset_value_type = count
The other lines that I want to read into the table are normal, without the leading !.
What is the import command to ignore lines that start with !? I just see comma...
Hey guys
I've been stuck with this simple Sql query for last 3 hours and my mind is drawing blank.
I have a User table that captures name user_id etc
Then I have a friends table that captures who is friend of whom and their status
User
user_id
name
Friend
friend_id
user_id
user_friend_id
status (accepeted,pending etc)
What I want ...
cursor.execute("SELECT SQL_CALC_FOUND_ROWS user_id FROM...limit 5")
rows = cursor.fetchall()
...
total_rows = cursor.execute("SELECT FOUND_ROWS()") #this doesn't work for some reason.
Edit: I tried SELECT FOUND_ROWS() FROM my_table...and the numbers are funky.
...
Hi all,
I want to get the data everyday within one year backward but I have to use 365 queries for each day like:
for ($i = 0; $i<365; $i++){
$end_day = ...; // the end time of each day
$start_day = ...; // the start time of each day
$query = select count(*)....where created < $end_day AND created > $start_day
}
I think t...