mysql

count data in current month in MySQL

dear all. i have a lot of data in my database. after that i have some MySQL code for counting data. i want to make them can count monthly. how to make this code can count just in current month? its mean if now september, it was just counting on this month. and the data from the other month is ignored. whats MySQL code to make it so th...

SQL posts top tags

I am using a MySQL database and looking to capture the top tags from my blog. The table looks like this: ++++++ post_tags ++++++ + id INT(10) + + post_id INT(10) + + tag_id INT(10) + +++++++++++++++++++++++ ++++++++ tags +++++++++ + id VARCHAR(10) + + title VARCHAR(50) + + uri VARCHAR(75) + +++++++++++++++...

Looping with while and foreach in PHP

I cannot seem to get foreach to work. Maybe I do not understand it correctly. Here is my code: $statement = "SELECT * FROM categories ORDER BY name ASC"; $query = mysql_query($statement) ... ... $cals = array("sports","general","other","clubs"); foreach ($cals as $value) { /* echo "<h3>".$value."</h3>"; */ echo "<table width='100...

MySQL duplicates -- how to specify when two records actually AREN'T duplicates?

I have an interesting problem, and my logic isn't up to the task. We have a table with that sometimes develops duplicate records (for process reasons, and this is unavoidable). Take the following example: id FirstName LastName PhoneNumber email -- --------- -------- ------------ -------------- 1 John Doe 123-555-...

How to turn rows into columns?

I have a database where I store keywords grouped into projects and data related to each keyword, then I display datagrids foreach project with one row per keyword and several columns all retrieved from the same table "data". I have 4 tables, keywords, projects, group_keywords and data. "keywords" only stores the keyword, "projects" the p...

How to change Server.Transfer code to PHP redirect code with member_id

Hi, I have a code in VB that looks like this: 'Server.Transfer(txtUser.Text + "_page.aspx") which is taking a forms authenticated user to their page. For example if John logs in, it will take him to john_page.aspx. How will I be able to integrate this in a PHP login script? I'm trying something like: header("location: $member . _pag...

MySQL timestamp to .NET timestamp

Hi all, I am using DBLinq to access a MySQL DB from C# .NET 3.5 I have created the dbml file for the Visual Studio 2010 ORM, and it loads fine - however when I compile the source I am met with errors regarding the conversion of MySQL timestamp to .NET DateTime. Now this kind of makes sense, because they are 2 'different' types (Though...

Avoiding duplicating SQL code?

Hi, I know many ways to avoid duplicating PHP code (in my case PHP). However, I am developing a rather big application that does some calculations on the database with the data it finds, and I have noticed the need to use the same code (parts of SQL) in other places. I don't like the idea of copying and pasting the same thing over and ...

how to import data from excel to mysql database quickly ?

Possible Duplicate: Importing excel data in mysql database Dear friends, I have about 5000 rows of excel data with 15 fields that must go in mysql database, what is a quick solution for this ? ...

Data warehouse design forum like meeting site

I finished my meeting site design and now I should create database. But I am not sure which method to use.I am using Apache, PHP and MySQL. I have users, each user has input and output mail box and each user has a friends list. This is the basic scenario. And here I have three questions. For in box and out box should I create a new tab...

MySQL COUNT in two tables same time.

Hello! My question is not so hard, i just really can't find the answer anywhere. I've got 3 tables. webshops, webshop_category and webshop_item. My query is: SELECT webshops.id, webshops.name, webshops.tax, webshops.contact_name, webshops.contact_email, webshops.contact_phone, webshops.contact_address, COUNT(webshop_category.id), CO...

Find queries from Process ID (MySQL 5.1.x)

I have a sleeping MySQL process and it crashed my MySQL. I cannot find it through SLOW LOG. I know its process ID. How can I retrieve query behind this process ID? Thank you, ...

output data as excel file

hello i am trying to open a file for export as excel. i can see the data in firebug but there is no option to offer the file to the user. what am i missing here? i have included my code that handles the query etc and would welcome your comments. many thanks header("Content-Type: application/force-download"); header("Content-Type: appli...

Problem connecting to Remote MySQL with C#

i'm using Visual Studio 2010 and when i bind a DataGridView with my remote mysql db it works fine. but when i take the connection string from the wizard and try to use it with code i get: "provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server" this is the connection string i try (i tried many variants):...

Display similar results from mySQL

How can I create a query that will return similar words if an exact match is not found? For example if the query is trying to match "mstke" and if the word is not found in the database then results should contain similar words like "mistake", "misstep", "take" and "mist". I tried %LIKE%, but it displays the exact match of words. ...

How can I drop all tables in my database ?

How can I drop all tables in my database ? 1) In one MYSQL command 2) Without destroying and creating the database ? Thanks ...

PHP function problem?

I'm using a function I think that is what you call it, to display my comments and their replies but for some reason I can only display the parent comments and not their replies. can someone help me fix this problem? Here is my Output NOW. PARENT COMMENT 1 PARENT COMMENT 2 PARENT COMMENT 3 Here is my DESIRED output. PARENT COMMENT 1 ...

Need to display image from mysql database to fpdf

A have image save in mysql database as bolb and I wish to display it out in fpdf using php. I'm having problem doing this as I am very new to fpdf. I really need help. Thank you. ...

Can anyone help me with a MySQL stored procedure

I have never done one before and am trying to work through an online guide but I can't seem to find a good example of one with parameters. CREATE PROCEDURE `calcdistance` ( IN ulat varchar, IN ulon varchar, IN clat varchar, IN clon varchar) BEGIN Select DEGREES(ACOS(SIN(RADIANS(ulat)) * SIN(RADIANS(clat)) + CO...

PHP (MySQL) error : "Warning: mysql_num_rows() expects parameter 1 to be resource"

if (!empty($_POST)){ $email_to=$_POST['email_to']; $email_to=mysql_real_escape_string($_POST['email_to']); $sql = "UPDATE `cosmos`.`members` SET `conf` = '2' WHERE `members`.`email` = '$email_to';"; $result=mysql_query($sql) or trigger_error(mysql_error().$sql); $count=mysql_affected_rows($result); ...