Hi, as title said, how to do or what are the practices to do a system, that if the user refer to a friends (up to 10), he will get rewards per person in php and mysql? Do I need to do in cookies or database? What are the required columns if using database? How to send multiple emails?
...
i am writing code to insert data into mysql on same page from where i retrive data by post method . it working fine but when i refresh page it will insert again.
my question is that how to stop reexcuting the insert query on refreshing page
...
Hey guys. This is a follow-on from this question:
After getting the right data and making some tweaks based on requests from business, I've now got this mini-beast on my hands. This query should return the total number of new jobseeker registrations and the number of new uploaded CV's:
SELECT COUNT(j.jobseeker_id) as new_registrations,...
I am looking for a piece of software to allow me easily create the database mode for an existing MySQL database
...
I have a simple table with two columns (well two columns of interest, plus just an ID)... I have an ajax search which is just looking for keywords... which are then sent to my real search... the ajax search doesn't care what they are, but they need to be distinct...
How can I merge the two columns together:
City, Country
Krakow, Polan...
I'm having trouble with the sql below. Basically I have rows that contains strings according to the format: 129&c=cars. I only want the digits part, e.g. 129. The sql query is:
$result = mysql_query("SELECT * FROM " . $db_table . " WHERE id LIKE '" . $id . "%'");
Why doesn't % work? I can't use %...% because it catches too much.
...
I'm trying to optimize a redmine database before it gets too much of a pain; the Changes (basically a log of all the SVN Changes) is at 137000 rows (ish) and the table is set to the b asic default settings. No key packing etc.
The table is as follows
ID int[11] Auto Inc (PK)
changeset_id int[11]
action varchar[1]
path varchar[255]
fro...
I am using a MySQL database with myPHPadmin as the frontend (I am not sure I have remote/client access yet). I have a script that queries the database and would like to see how long each query takes? What is the easiest way to do this? Could I install another PHP app on the server?
Thanks!
...
I two tables within a MySql 5.1.34 database. When using SubSonic to generate the DAL, the foreign-key relationship doesn't get scripted, ie; I have no Parent.ChildCollection object. Looking inside the generated DAL Parent class shows the following;
//no foreign key tables defined (0)
I have tried SubSonic 2.1 and 2.2, and various MySq...
My sql statement is not working with Zend, its complaining about the Count(*) field... what am I doing wrong?
// get open/closed
$stmt = $db->query('SELECT status, count(*) as total FROM reported_issues WHERE date_reported >= '.$today.' AND status IN (0,1) GROUP BY status');
while ($row = $stmt->fetch())
{
switch ($row['status'])
...
i have to run multiple SQL statement in a batch
if i store those sql in a file
and can i run that file for those sqls
thanks
J
...
How can I check the SQL syntax in a .sql file?
...
I am using a code generator called SmartCode Studio to generate the database layer for a ASP.NET application. The generated code uses NHibernate to talk to the database.
This has worked well in the past when we used SQL Server. SmartCode retrieves the SQL data types from the database and determines the correct corresponding .NET data ty...
Hello,
I am using FCKEditor with CakePHP and when I save data sent from the editor I want to run the htmlspecialchars() and mysql_real_escape_string() functions on the data to clean it before I store it in my database. The problem is I am not really sure where to do this within the CakePHP framework. I tried in the controller like thi...
I am trying to match strings like '[sometext<someothertext>]' (i.e., left square bracket, text, left angle bracket, text, right angle bracket, right square bracket) within a column in mySQL. Originally I used the following query (notice that since regex queries are escaped twice in mySQL, you must use two backslashes where you would norm...
I was wondering if it's faster to process data in MySQL or a server language like PHP or Python. I'm sure native functions like ORDER will be faster in MySQL due to indexing, caching, etc, but actually calculating the rank (including ties returning multiple entries as having the same rank):
Sample SQL
SELECT TORCH_ID,
distance AS t...
I've heard lots of people saying that the IN keyword in most relational databases is slow. How true is this? An example query would be this, off the top of my head:
SELECT * FROM someTable WHERE someColumn IN (value1, value2, value3)
I've heard that is much slower than doing this:
SELECT * FROM someTable WHERE
someColumn = value1 O...
I am trying to count the number of days of the current week that do not have an event associated with them, but I don't know how to do it.
For example, I count the number of events happening this week with this query:
SELECT COUNT(e.event_id) FROM cali_events e
LEFT JOIN cali_dates d
ON e.event_id = d.event_id
WHERE YEARWEEK(d.date) = ...
Hi all,
I am a fairly new MySQL developer and am starting on a project that I could do with a bit of initial advice on...
I am creating a database that will primarily be holding a certain number of items (between 1-5k) and around 40 boolean variables associated with each one. Users will then be inputting their choice of these 40 value...
Hey -- I'm hoping to sort the items returned in the following query by the order they're entered into the IN() function.
INPUT:
SELECT id, name FROM mytable WHERE name IN ('B', 'A', 'D', 'E', 'C');
OUTPUT:
| id | name |
^--------^---------^
| 5 | B |
| 6 | B |
| 1 | D |
| 15 | E |
| ...