mysql

How can I add a search feature to a website that returns images?

Hello, I need to add a search feature to a website. Not being adept at PERL or PHP, I was thinking of adding a remotely hosted search CGI (like freefind or fusionbot). Alternately, I might end up trying to convert the HTML site to a Wordpress site (as I think I may be able to add a search function relatively easily once that is achiev...

PHP-MySQL query -- Please explain

Ran across this, but I cannot quite grasp it, especially beginning with the LIMIT phrase. Thanks for any help. $sql = sprintf ("SELECT * FROM $tbl_name WHERE title LIKE '%s' OR description LIKE '%s' LIMIT $start, $limit", mysql_real_escape_string('%'....

Formatting String into MYSQL time

Ok, So i have a script that reads in a csv file and in there is a time that is formatted in the traditional HH:MM am/pm. I need to convert that into the mysql standard time format (HH:MM:SS). This is what i have so far and it works $schedule[$row]["TIME"] = date("H:i:s", strtotime($data[4])) the problem is, if the input is formatted...

mysql query for counting records

I have records in mysql table like a a a b b and I want output like: a 3 b 2 Is there any mysql query that I achieve that ...

How to save PHP HTTP_USER_AGENT to MySQL field

I have a simple feedback form PHP script that I would like to enhance by adding the $_SERVER[HTTP_USER_AGENT] data to the row in the database that I'm saving. I keep getting parse errors when I try a simple insert, passing '$_SERVER[HTTP_USER_AGENT]' as a typical string. Should I bundle it in some way, so that the characters used in tha...

How to conditionally create index with MySQL?

What I want to do is something like follows: CREATE INDEX i_table_column ON table(column) IF NOT EXISTS INDEX ON table(column) Is it possible to write the above statement in MySQL? ...

MySQL database with ASP .NET

Hello, I want to use MySql database with ASP .NET application using DBLINQ. I am following the link - http://www.primaryobjects.com/CMS/Article100.aspx But, I am not able to connect MySQL file with ASP .NET application. What are exact steps to attach MySql file with .NET application? Thank you ...

how do I delay or control queries??

I planning to release an Api for public. what I am looking into is since it is free I need to control the usage. there are couple of options in my mind. one is delay number of queries per second. second one is fix queries to certain number per day. but second option seems to do more work on scripting which I am planning to avoid now. so...

Strip out digits/numeric chars from a mysql string column

I have columns in a mysql table that stores names of people as combinations of strings and incremented digits for uniqueness, so I have names stored as so : Patrick, Patrick1, Patrick2, ..... Patrick10, David, David2, .... David5 How do I retrieve just the alpha name itself, without the digits? Say I want to group by the distinct name...

SQL views. do i need to use it to increase performance?

i mostly need to know - views and their purpose ? - do they increase performance of an application ? - in what kind of cicumstance will I need to use views? ...

should I use myql enum or tinyint for fields having values 1 and 0?

Hello, I use tinyint (1) for fields which contain either 1 or 0, for xample, is_active. I can use enum ('1','0') instead but not sure which cases I should use enum or tinyint. Any comments/suggetion? Thanks Js ...

Send data to database when click on a link without page refresh

Is there a way to send data to database when click on a link without page refresh? I use php/mysql... ...

perl CGI radio_group: populate values from DB query

Im trying to dynmically generate a table that has a radio button per row whose value is set to the ID field of a SQL table. Im not sure how I can reference this value using CGI radio_group. In my research radio_group uses an associate array, however if I convert the SQL query to an associative array the values wont match up since there ...

how to "one column of table minus 1"?

i have a TABLE named FLY,i have a column in it named FLY_NUM.im trying to decrease the value of this column in a mysql query(in PHP). something like this : mysql_query("UPDATE fly SET `fly_Num` = `fly_Num` -1 WHERE fly_ID ='1' "); this is wrong!everytime this query run,FLY_NUM column set to zero.how can i do such a thing? ...

Any freeware or open source tool to populate database with some dummy values

I have somewhere around 30 tables used in my web application. I need to populate those tables with some dummy values during development. Later once the application is ready we will have the real data. Are there any tools to populate database tables in MySQL with dummy values? ...

MySQL syntax explanation

Hi, Really simple question what is the difference between DESCRIBE and EXPLAIN when using it in a MySQL query ? They both look as though they product the same results. ...

SQL Query to fetch all product categories and whether the product is in it

I have three tables. Product, product categories and product category links. The links table is there as a product can be in more than one category. What I am trying to achieve is a list of ALL the categories with an additional field which states whether for that specific product id, if the product is in that category. SELECT *, l.prod...

Monitor usage of a certain database field

Hi guys, I have a nasty problem. I want to get rid of a certain database field, but I'm not sure in which bits of code it's called. Is there a way to find out where this field is used/called from (except for text searching the code; this is fairly useless seeing as how the field is named 'email')? Cheers ...

pgSQL date field Conparison?

Hi all, I have a pgsql database , i want to compare two fields with there timestamp values. basic query select t1.valu1, t1.value2 from table1 as t1 where t1.valu1 == t1.valu2 With TimeStamp comparison select t1.valu1, t1.value2 from table1 as t1 where EXTRACT(EPOCH FROM TIMESTAMP WITH TIME ZONE t1.valu1 ) == EXTRACT(EPOCH FROM...

MySQL - ordering alphabetically except for one entry?

Hi, I have to sort a list of categories using MySQL as I am using a CMS that only allows this. Is there a way to sort alphabetically but to return one entry ("Other") at the end of the list? ...