$test = sprintf("SELECT * FROM `table` WHERE `text` LIKE '%%s%'", mysql_real_escape_string('test'));
echo $test;
output:
SELECT * FROM `table` WHERE `text` LIKE '%s
but it should output:
SELECT * FROM `table` WHERE `text` LIKE '%test%'
...
Does anyone know any way to have the Entity Framework working with mysql connector 6.3/6.4 no install version? I can add the dll-s to my project, but I can't add the connection to the Entity framework because it doesn't see mysql.
...
I've got a table
CREATE TABLE `tbl_users` (
`user_id` int(11) NOT NULL auto_increment,
`user_username` tinytext NOT NULL,
`user_password` tinytext NOT NULL,
`user_email` tinytext NOT NULL,
`user_enabled` tinyint(4) NOT NULL default '1',
`user_verified` tinyint(4) NOT NULL default '0',
`user_verified_date` datetime NOT NUL...
Hello,
I currently use the script below to back-up a website but it could be improved dramatically! Please could you suggest any improvements, or perhaps alternative solutions?
Currently, I only delete items after a massive amount has been reached - and this is not good. Does anyone know how I can delete items that are a month old, o...
I have a problem where a RENAME statement clashes with a CREATE TABLE statement to cause deadlock.
I have a CREATE TABLE statement of the form
CREATE TABLE `ProductTitles`
(
PRIMARY KEY (`ProductId`),
INDEX ( `Title`, `ProductScore` )
)
SELECT p.ProductId, p.Title, ps.ProductScore
FROM Products p
JOIN ProductScores ps USING...
If for any reason MySql server goes down,
What are the ways I could still show my page to user? Probably having a backup DB server would help?
If I've multiple DB servers and one goes down, I can fetch data from another temporary server? How to detect that main server is down? Who would select alternate server? role of reverse proxy s...
I am new to Maatkit. Trying to use mk-profile-compact to compare the output of mk-query-profiler.
Looking at the documentation I tried doing
mk-profile-compact /path/to/profiler_result.txt
The profiler_result.txt contains the output of mk-query-profiler.
I got the following:
`Use of uninitialized value in concatenation (.) or st...
Can someone help me with a SQL Query that will display all users that have made a post every day for the last 7 days?
My questions table is tblQA and my users are userID and questionID for the post. I want to run a query that helps me know how many active users are using the database every day.
Thanks so much!
...
Hi,
I have a table I use for high scores of an iPhone game.
As of now the query is disabled so gamers are not able to see scores :-(
Table has the following fields:
Type Collation Attributes Null Default Extra Action
id int(11) No auto_increment
date date No ...
I would like to create a Rake task that:
checks a column in a table row
and if its value is false, sends an email with the row information,
and then change the value from false to true.
Does anyone know the best way to approach this?
...
Is there an easy way to do both these queries in one:
$name = 'somename';
$id = mysql_result(mysql_query('SELECT id FROM table WHERE name = $name'));
$next_id = mysql_result(mysql_query('SELECT id FROM table WHERE id > $id ORDER BY id ASC LIMIT 1, 1'));
Thanks
...
How to write a query suitable for generating an age pyramid like this:
I have a table with a DATE field containing their birthday and a BOOL field containing the gender (male = 0, female = 1). Either field can be NULL.
I can't seem to work out how to handle the birthdays and put them into groups of 10 years.
EDIT:
Ideally the X axis...
This is my webpage:
http://www.autoweek62.uni.cc/carprice.php
Here is the source code for it:
<?php
$dbname = "autoweek_auto1";
$loginname = "autoweek_root";
$loginpass = "PASSWORD (not my real one)";
$dbhost = "localhost";
echo('<html><body bgcolor="#FFFFFF">');
echo('<font face="arial" size="+4"><cen...
Trying to insert values with Unicode Chars into a MySQL-database using Delphi 2010 and TADOConnection with no luck.
Connection with ODBC
Provider=MSDASQL.1;Persist Security Info=False;Data Source=mysrc;Initial Catalog=mydb
The SQL command:
INSERT INTO myTable (aCol) VALUES('Russian: русский язык')
Tried inserting it directly with...
Hi,
When I want setting numerical value +1 in mysql table, I use e.g.:
UPDATE table SET number=number+1 WHEN ...
How can I set date + one year?
Thanks
...
I'm trying to add a full text search to a system. The query I want to write needs to involve multiple lookups followed by the search (if that's even possible).
I've got a table of teachers and a table of subjects.
teacherProfile
teacherId [int] - primary key
subjectOneId [int]
subjectTwoId [int]
subjectThreeId [int]
teacherBiography [t...
I'm working on my first secure shopping site. We're not storing credit card data, so that's not a problem. However, we do have a transaction key and API login key for our payment gateway (authorize.net) that I'd prefer to keep in a database, rather than hard-coding into my php. I don't know that we need tremendous security, but I would r...
Hi,
I am programming a Hotel Reservation module. Now I have to connect an existing application to get the available rooms on a given range of dates. Please help me in this.
I am here posting the DB schema of the existing app (where the rooms and bookings info were stored).
rooms:
id
room_type
room_count
people
hotel_id
bookings:
i...
I'm trying to remove relationships from a pivot table with ORM's remove method. This is for an edit method that updates the categories associated with a product. I can successfully add multiple relationships, but I need to remove those relationships prior to adding them again.
Here's how I add them
foreach ($categories as $a...
Following on from http://stackoverflow.com/questions/3865384/mysql-multiple-id-lookups
So I'm looking at other ways around the fulltextsearch limitation on views.
I updated the provided query...
SELECT t.teacherId, s1.subjectName AS name1, s2.subjectName AS name2, s3.subjectName AS name3
FROM teacherProfile t
LEFT JOIN
sub...