Is there a lazy way I can quickly replace all instances of a word with an other, purely in MySQL?
UPDATE sports SET matchup = .....
for example replace Manchester United with Man Utd and Wolverhampton Wanderers with Wolves
...
If I try to execute two MySQL queries at once by delimitting them with a semicolon, it works fine in PHP MyAdmin, but the query doesn't work at all in PHP mysql_query(). Does anyone know why?
...
Hello everyone,
I am using a AJAX gallery called jCarousel, and I am having some difficulties about dynamicly loading my pictures from the data, I simply don’t know how to integrate PHP in the JavaScript code.
The static JavaScript code for loading the pictures is:
var mycarousel_itemList = [
{url: \"http://static.flickr.com/66/199...
I have two websites that post news information. I just got a request to make a single page for one of the sites that shows the mixed results from both sites. They are located on the same server and the tables are close to identical, but I am having problems figuring out how to combine the two queries. The postings need to be sorted by da...
My initial approach was:
$current = time(); // save this to column CURRENT_TIME with column type VARCHAR
//retrieve it like this
$retrieved = mysql_query(....) //assume query for getting the stored time value
$time = strtotime($retrieved);
I have come across the following approaches:
use gmstrftime to handle gmt
use INT instead of ...
OK, here is a simple abstraction of the problem:
2 variables(male_users and female_users) to store 2 groups of user i.e. male and female
1 way is to use two queries to select them :
select * from users where gender = 'male' and then store the result in male_users
select * from users where gender = 'female' and then store the result...
i want to know the n'th highest value from a column of a table
for eg:
2nd highest salary from tbl_salary or
4th highest salary from tbl_salary
i seen somewhere below query
select salary from tbl_salary t
where &n = (select count(salary)
from (select distinct salary from tbl_salary)
where t.salary<=salary);
if th...
The code here is still incomplete because I'm still going to ask you guys on what the proper format/syntax of using mysql escape string. Im still a beginner in php and I want to learn how to avoid sql injections. Is the code below correct?
$con = mysql_connect("localhost","root","mypwd");
if (!$con)
{
die('Could not connect: ' . ...
Which of the following 3 Queries will be faster? Why?
I use such queries with a lot of other joins a lot within my app. so is there any way I can benchmark their speed? If yes, can you please mention what it is/they are?
Query 1:
$q = "SELECT COUNT(books.id) FROM books
INNER JOIN books_type ON books.id = books_type.id
WHERE books_t...
hello all i hav a table named address which has id, title and parent_id fields. in title column the name of regions and districts are inserted. the regions have parent_id zero and parent_id of the districts are id of the regions. i want a query which display regions in one column and its respective districts in another column. hope u guy...
(PHP/MySQL) Let me preface by saying that this works, and that I'm wondering if there's a cleaner way. This seems a bit... brutish? And I'm not known for my efficient coding. :-/
TABLE (many-to-many)
scenid mapid
AA 01
AA 02
AA 04
BB 01
BB 04
CC 02
CC 03
CC 05
DD 01
DD ...
Hi all,
I have the following table.
mysql> select * from consumer9;
+------------+--------------+-------------------+
| Service_ID | Service_Type | consumer_feedback |
+------------+--------------+-------------------+
| 100 | Computing | -1 |
| 35 | Printer | 0 |
| 73 | Comp...
Hi all,
I didn't write any trigger for my works. Now i want to know how to write trigger . And where it write . Is it possible to write trigger as sql query in phpmyadmin ..
Please help me to write a simple trigger...
I tried like below
Create Trigger sales_bi_trg
BEFORE INSERT ON sales
FOR EACH ROW
BEGIN
DECLARE num_row INTEGER ;
D...
Hi!
I made a php/ajax/mysql/json script for my site, to show all the tags.
If i GET the page id it will show me all the tags of that page.
But! In my main page i'd like to show all tags, from all pages WITH a counter.
For example if i tagged 4 pages with
"ilovestackoverflow"
i'd like to see in my main page
"ilovestackoverflow (4)"
i ...
hi, I am trying to remotely access mySQL server. This is the code used by me.
Connection conn = null;
try
{
String url = "jdbc:mysql://172.18.227.237:3306/struts2";
Class.forName ("com.mysql.jdbc.Driver");
conn = DriverManager.getConnection (url,"root","admin");
System.out.println ("Database co...
I have these codes, used to update mysql database
...
I've some records in a DB where one of the VARCHAR fields may contain accented letters. If I do the following query using the CLI MySQL client I get 1 row returned, which is correct:
SELECT site_id, site_name FROM tbl_site WHERE site_name LIKE '%ém%'
However, using some PHP (PDO) to do the same query returns all the rows that contain ...
I'm trying to store different mutiple select field states in the db.
So one select list would be:
<option value="1">a1</option>
<option value="2">a2</option>
<option value="4">a3</option>
<option value="8">a4</option>
I want to try this without a second (normalized) table. So i came up with adding the option values and saving them in ...
How do I get to get the values of checkboxes from mysql database, for example if stat6 is
dependent, then when I try to fetch the corresponding record using a primary key. Then if the stat6 is checked when I first added the record. It must also be checked when I update. But its not the case. How do I fix this?
<td></td>
<input type='hid...
I have develop an application in MVC.
I have 4 tables in MYSQL database.
Topic(topicid,topic) with topicid as primary key
subtopic(subtopicid,subtopic)with subtopicid as primary key
question(questionid,question,answer) with question as primary key
Detail(Id,topicid,subtopicid,questionid,title); with Id as primary key
I have u...