mysql

Remove all stopwords for a MATCH AGAINST query

Hi Guys, Does anybody know of a way to do an IN BOOLEAN MODE FULLTEXT query which does not reject stopwords? I want the query to return results for everything - 'a', 'the'... ...

Conditional columns in MySQL that need to do joins

I've researched related questions on the site but failed to find a solution. What I have is a user activity table in MySQL. It lists all kind of events of a user within a photo community site. Depending on the event that took place, I need to query certain data from other users. I'll explain it in a more practical way by using two examp...

How do I diagnose steps in a trigger on MySQL

I have two tables: source table result table I have an after update trigger on my source table which updates some records in result table. the problem is, my trigger is not updating result table and I would like to diagnose my trigger execution. I tried putting select statements to see variable values but selects are not allowed in ...

mysql - update two records at once

Using PHP's msqli is it possible to update two records with one query? First I do a SELECT to check that $pay_user has enough game currency in his account, if he does then I do the following... My update query is: "UPDATE account SET money= money - ".$money." WHERE User_id=".$pay_user "UPDATE account SET money= money + ".$money." WH...

from multi dimensional array to mysql

I have a multidimensional array called $data that is basically data extracted from a table into the array. This is how I get my array using JS_extractor: set_include_path(get_include_path() . PATH_SEPARATOR . './library/'); require_once 'JS/Extractor.php'; $extractor = new JS_Extractor(file_get_contents('temp.html')); $body = $ext...

How to convert from varbinary to char/varchar in mysql

Hi I have a field which is varbinary. It has already been populated. Now how do i convert varbinary to varchar so that I can use the data in the field for some other purpose. I use a MySQL version 5.10 ...

PHP/MySQL - How to display PHP generated text any where on a web page using PHP?

I want to display part of the script any where on the web page that generates the text to tell the user they submitted something. How can I fix my script in-order to do this? And what part of my code should be changed? Here is the part of the script that I want to display anywhere on a web page. if (count($tags) == 1){ echo $tags[0]...

How can you compare sets of numbers and get the most relevant results using MySQL and PHP?

Consider this: set A: 1 2 3 4 set B: 3 4 5 6 set C: 4 5 6 7 set D: 1 I want to compare D with the rest and get as a result a set of numbers as most relevant. The result should be in this order: 4 (as D has a common number with A and 4 is in A and also in B and C), 3 (as D has a common number with A and 3 is in A and B), 2 (...

Facebook like Notifications System

Hi, I am developing a face book like notification module in php/mysql where in the user is notified with the latest activities among his friends (Added Photo/Added Video/Commented etc....). What is the best approach to design this module in terms of database. Does it need to have a seperate table for each activity(say photos). Or a sing...

PHP and MySQL calendar issue

Hi folks! I'm writing trying to build a calendar right from scratch. I'm using the function written by David Walsh (see link) and it's great. He does a query for each day's cell. But, I'm afraid that when the script's gonna have to run 30 queries in each render, it's gonna be sloooow. So, I was trying to think in another logic, for ex...

Mysql syntax help

I have problems writing a SP in MySQL. From what I can read on the net the following should work, but it does not. I use Mysql v. 5.1.35 CREATE DEFINER=`My_Username`@`%` PROCEDURE `ChangePassword`(IN SPusername VARCHAR(100), IN SPoldPassword VARCHAR(100), IN SPnewPassword VARCHAR(100)) BEGIN IF EXISTS(SELECT Password_Hash ...

PHP & MySQL - PHP warnings help?

Okay first let me just say that my script works fine it just shows these warning when nothing is in the database. What I want is to make the warnings go away even when nothing is in the database. How can correct this problem? And what part of my code do I need to change? Here is the warnings. Warning: ksort() expects parameter 1 to b...

Help with a MySQL join

I have a Skills table which has 14 records in it. It is structured like this: | id | name | I then have a User_Skills table which I want to join to the skills table. Here's is structure: | User_id | Skill_id | Basically I want to be able to do a join which always results in 14 records and shows NULL in any fields the user isn't...

Repeating functions in a MySQL query

Based on my previous question I am running a query like so: SELECT DISTINCT DATE_FORMAT(STR_TO_DATE(`value`, '%d/%m/%Y'), '%M %Y') AS `avail` FROM table ORDER BY STR_TO_DATE(`value`, '%d/%m/%Y') Thevalue field is in the format dd/mm/yyyy and using STR_TO_DATE I convert it to yyyy-mm-dd. However I repeat that function call twice, so I ...

Detect when MySQL tables are in readlock state (from PHP)

Hello, I need to get a PHP app to detect when it's MySQL database is in readlock, and throw an error message. Easy, but is there any MySQL command we can run to check current lock state, rather than just having the system get stuck, as the query is queued for the unlock? Cheers, Johnathon Edit: The database is being put in readlock b...

Linux Mysql Memory requirements

I have: 32 bit - Red Hat Enterprise Linux Server release 5.1 (Tikanga) Mysql 5 10G RAM What are the memory allocation limits with respect to mysql? Maximum memory usage possible. Any supporting documents from redhat site? ...

How can I get back my privilege to create a new database in MySQL?

I log in PhpMyadmin with the root user,there is a red message No Privileges under create new database, How can I get back my privilege to create a new database? ...

Fine tuning this mysql search-function in PHP...

I have a classifieds website, where users can search for items. The search should be in all fields with the name 'description' and 'headline'. I am currently using 'like' syntax (SELECT * FROM db WHERE description LIKE '%string%' OR headline LIKE '%string%') Problem is, if I have records with headlines like BMW it is enough to just typ...

Mysql fulltext short questions

If I want to search a mysql field for whole words only, and not use the LIKE syntax, I would use FULLTEXT. But I don't know how it works really... I have noticed in PHPMyAdmin that I can set the indexes of fields to 'fulltext'... Is this what I am supposed to do? And then use the 'match' syntax to search the words agains the 'search st...

Hiding parts of a web page from non-members using PHP and MySQL?

I'm trying to hide the following code listed below from members that are not logged in how can I do this? And what parts of my code do I need to change or add to it? Here is the code I want only logged in members to see. <div id="r"> <h2>some thing</h2> <form method="post" action="index.php"> <fieldset> <input type="text" siz...