I'm using MySQL and I have the following table:
| clicks | int |
| period | date |
I want to be able to generate reports like this, where periods are done in the last 4 weeks:
| period | clicks |
| 1/7 - 7/5 | 1000 |
| 25/6 - 31/7 | .... |
| 18/6 - 24/6 | .... |
| 12/6 - 18/6 | .... |
or in the last 3 months:
...
Hello,
I want to loop the update statement, but it only loops once.
Here is the code I am using:
do {
mysql_select_db($database_ll, $ll);
$query_query= "update table set ex='$71[1]' where field='val'";
$query = mysql_query($query_query, $ll) or die(mysql_error());
$row_domain_all = mysql_fetch_assoc($query);
} while (...
This could be very basic type of question for you! But for me it is very important.
1) How these(orkut, facebook or other) website store the images in server?
Options:
a) Keeping all the images in database by converting into bytecode/binary.
b) Making a new folder for each user and saving photographs according to their library name.
c) ...
Is it allowed to reference external field from nested select?
E.g.
SELECT
FROM ext1
LEFT JOIN (SELECT * FROM int2 WHERE int2.id = ext1.some_id ) as x ON 1=1
in this case, this is referencing ext1.some_id in nested select.
I am getting errors in this case that field ext1.some_id is unknow.
Is it possible? Is there some other way?
UP...
Hi all!
I have a very strange problem when retrieving data with php from a mysql table. Basically, two php files with the EXACT same content are given data with different encodings and i dunno why.
Here's the code:
$dbhost = 'localhost';
$dbuser = 'myuser';
$dbpass = 'mypass';
$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Er...
I've created some code that will return a random row, (well, all the rows in a random order)
But i'm assuming its VERY uneffiecent and is gonna be a problem in a big database...
Anyone know of a better way?
Here is my current code:
$count3 = 1;
$count4 = 1;
//Civilian stuff...
$query = ("SELECT * FROM `*Table Name*` ORDER BY `Id` ASC"...
Hi
I need to know how to get the first n words from text stored in my DB in PHP?
for example if there is some text in my DB like this one :
"word1 word2 word3 word4 text one test four five"
How I can get the first 4 or five words from this text?
Thnks in Advance.
...
hi
I have the following simplified tables:
CREATE TABLE recipe(id int, name varchar(25));
CREATE TABLE ingredient(name varchar(25));
CREATE TABLE uses_ingredient(recipe_id int, name varchar(25));
I want to make a query that returns all id's of recipes that contain both Chicken and Cream.
I have tried
SELECT recipe_id FROM uses_...
I am using cakephp 1.2 and I have an array that appears to have a value change even though that variable is not being manipulated. Below is the code to that is causing me trouble.
PLEASE NOTE - UPDATE Changing the variable name makes no difference to the outcome.
function findCountByString($string, $myArr=array()) {
$main_conditions['...
Hi All,
I have a large production database at the moment (7GB+), much of the data I require to test my development branches needs to be up to date.
I would like to create a local DB so I can implement a CI server and have the development DB separate to the production DB, however with a DB of this size how do I ensure it's always in syn...
Hi people, i'm having a problem trying to print some data of a table. I'm new at this php mysql stuff but i think my code is right. Here it is:
<html>
<body>
<h1>Lista de usuários</h1>
<?php
$host="localhost"; // Host name
$username="root"; // Mysql username
$password=""; // Mysql password
$db_name="sabs"; // Database name
$tbl_name="do...
@WebMethod(operationName = "SearchOR")
public SearchOR getSearchOR (@WebParam(name = "comp")
String comp, @WebParam(name = "name")
String name) {
//TODO write your implementation code here:
SearchOR ack = null;
try{
String simpleProc = "{ call getuser_info_or(?,?)}";
CallableStatement cs = con.pr...
(MYSQL n00b)
I have 3 tables:
id = int(10), photo_id = bigint(20)
PHOTO records limited to 3 million
PHOTO:
+-------+-----------------+
| id | photo_num |
+-------+-----------------+
| 1 | 123456789123 |
| 2 | 987654321987 |
| 3 | 5432167894321 |
+-------+-----------------+
COLOR:
+-------+------...
Hi,
I have a problem with my php/mysql script. It should only output the while loop once but I am getting unlimited loops and an endless page.
$query = mysql_query("SELECT * FROM users WHERE username ='".base64_encode($_SESSION['username'])."' LIMIT 1");
$result = mysql_fetch_array($query);
if(empty($result)){
echo "No user......
(Q1)Hi I'm using textbox in my project and I can't receive the values that are typed
<textarea rows="5" cols="60"> Type your suggestion </textarea>
<br>
<input type="submit" name="sugestao" value="Submit" />
Sorry I don't know how to 'kill' html code, that's why < is missing.
All I'm getting in the column of the database from this t...
Hi,
I will be developing an application for a club where they will have visitors use biometric systems(finger print) or magnetic cards to mark their attendance.
This application is planned as a web app, made using PHP/MySQL/Javascript. It does a lot of other things as well.
What I wanted to find out is how is the interface between Bi...
i have customised oscommerce to pull in a csv file of products, delete anything thats not with an image/proper description/proper title gets removed.
The import runs on a cron job basis pulling information from a supplier, it hasnt run since yesterday but a product has disappeared-
Anyone who has used oscommerce will know that, product...
Hi, I'm creating locally a big database using MySQL and PHPmyAdmin. I'm constantly adding a lot of info to the database. I have right now more than 10MB of data and I want to export the database to the server but I have a 10MB file size limit in the Import section of PHPmyAdmin of my web host.
So, first question is how I can split the d...
Please give me the query for inserting images in a MySQL database. I am new to stackoverflow, so please ignore me if my question is not up to mark.
...
SP_A is a stored procedure that calls SP_B, then does a SELECT, and then UPDATES the same records/column that SP_B just UPDATED. SP_A has a TRANSACTION around the SELECT and UPDATE statements followed by a COMMIT.
Now, everything works perfectly when I call SP_A from a MySQL command prompt. However, when I call it from C#, it times ou...