Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 8 years ago.
Improve this question
i have created a testimonial table in database .i have inserted three testimonials. I want to show one testimonial per day.is there any good tutorial for doing this ?
CREATE TABLE customer_testimonials
( testimonial_id integer unsigned NOT NULL auto_increment PRIMARY KEY,
testimonial_text varchar(50) NOT NULL
);
You can achive this by a scheduled task. Write a (php, bash, ??) script to get max id of testimonials, generate a random number smaller than max id and writes this to the file, then run this script once for 24 hours. In your web page, always read this file to take testimonial id and query your table to get this testimonial. With this approach, you will be able to show one testimonial per day.
If you are using linux you can schedule this task by crontab.
http://adminschoice.com/crontab-quick-reference
http://php.net/manual/en/book.mysql.php
http://php.net/manual/en/function.rand.php
http://php.net/manual/en/function.fwrite.php
.
.
.
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 2 years ago.
Improve this question
I'm trying to run a query that returns the maximum number in the ballNumber field when the value in the inningsNo field is 1. I just can't get it to work. Can anyone tell me what I should enter into the Criteria box?
Thanks
Rob,
To do this, you will need to do the following:
Click on the "Totals" button on the Query ribbon (a new row will appear in the Query grid labelled "Total");
Change the "Group By" Total value to "Where" in the InningsNo column (the tick in the "Show" will also disappear);
Change the "Group By" Total value to "Max" in the ballNumber column.
Regards
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
I want to store user defined variables in sql select statement and use that variable in sub query like the following:
select user_id, #user_gender:=user_gender
where user_id in (select user_id from post where post_gender=#user_gender);
So what I want to do here is I want to store the user_gender value into a variable and use it in a subquery. I know what I am tryinig to do here can be achieved by joins, but what I am posting this example, because I want to know how to actually store value from a row into a user defined variable.
Also, I am having hard time finding good resources that explains how to use user defined variables. Any recommendations?
Use following query :
SELECT user_id FROM post , ( SELECT #user_gender:='MALE' ) AS var WHERE post_gender=#user_gender;
check link for reference
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I am making a tablature website and I wonder which is the best way to store tabs in the database.
Here is an example:
------------------------------------------------------------0------------------------------
-------------1-0---------------------1-0-----------0-1-1-1-----3-1-0-----------------------
0-0-0-2-2-2------2-0-----0-0-0-2-2-2-----2-0---0-2-------------------2-------2-0---0-------
-----------------------------------------------------------------------4-2-0-----4---------
-------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------
If it was me, and it is exactly that way, (I. E. 1-2-3) I'd go for the following:
Create table tabs (
Songid varchar(36) -- uuid or name, fk to the song
String int,
Position int
)
Depending on the server side language, you could theoretically retrieve and display them, separated by the dashes.
It'd be a bit tricky to get right, but what you would want, is to have a while loop or cursor display the number, or dash if there is no number at the given position, for the given string.
Does that make sense? I can try and elaborate, but it would depend on the language the web server was using.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
Hey Everyone my system is selling kits for each kit it compose of different products all of them are downloaded files. my problem is where would i place the products of each kit.
Sample KIT1 compose of game1, game2, game3, game4
PRODUCT TABLE
PRODUCTID: 1 SKU: NAME:Kit100
where would I Place game1, game2, game3, game4
According to what you just said,
You want a KIT table
You want a PRODUCT table
And to link them together, you need a KIT_ITEM or KIT_PRODUCT table to itemize the individual items/products within each Kit.
To be honest I'd name the top-level entity the customer buys (you called it a Kit) as a Product, and I'd name the parts as Components.
Products in normal business English, are individually purchasable.
You could also make a KIT_PRODUCT which is made up of 0..* "component" Products.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I really need help to make a decision.
I'm working on a real estate online directory.
People can add their property in several categories like apartment, land, shop ... and each category has its features that some of them are shared between categories like City but some others are unique or shared between 2 or 3 categories like "number of rooms".
So i have three solution :
keep shared features in one table and put others in an other table in meta_key - meta_value format like tagging system.(seem reasonable)
Put all features in one table.(dirty)
Put each category in separate table (this is worst idea).
The site will serve too many searches. but most of them are based on shared features.
which solution looks better?
Why wouldn't you just create a table of the properties and then tie them together in a table like so:
Categoryid | PropertyID
Also making both columns a composite unique identifier will prevent from duplicate occuring with the table. This allows you to create unlimited properties and assign them to any category.