mysql

How do I return a message if $_GET is null or does not match any database entries?

I am working on designing an IT Asset database. Here I am working on a page used to view details on a specific asset determined by an asset id. Here I grab $id from $_GET["id"]; When $id is null, the page does not load. When $id does not match any entry within the database, the page loads but no asset table is printed. In both thes...

Hibernate constraint ConstraintViolationException. Is there an easy way to ignore duplicate entries?

Basically I've got the below schema and I'm inserting records if they don't exists. However when it comes to inserting a duplicate it throws and error as I would expect. My question is whether there is an easy way to make Hibernate to just ignore inserts which would in effect insert duplicates? CREATE TABLE IF NOT EXISTS `method` ( `...

Mysql Left Join Null Result

I have this query SELECT articles.*, users.username AS `user` FROM `articles` LEFT JOIN `users` ON articles.user_id = users.id ORDER BY articles.timestamp Basically it returns the list of articles and the username that the article is associated to. Now if there is no entry in the users table for a particular user id, the...

Problem in importing database in MySQL

I have a .sql file with some database backups inside. Now I want to restore them back to MySQL. How can I this using command line of MySqL please? I found this: mysql -u username -p -h localhost database_name < dumpfile.sql but I don't know what username should be, what database_name should be and how I could browse to a .sql file ...

Why can I query with an int but not a string here? PHP MySQL Datatypes

I am working on an Asset Database problem. I receive $id from $_GET["id"]; I then query the database and display the results. This works if my id is an integer like "93650" but if it has other characters like "wci1001", it displays this MySQL error: Unknown column 'text' in 'where clause' All fields in tables are of type: VARCHAR(50...

Developing Jquery, jquery ui, php, mysql, ftp, via Dreamweaver?

I'm trying to find a good environment to building and maintain an existing website. Would Adobe's Dreamweaver be a good purchase as far as coding in PHP, html, jquery, with a mysql database? ...

How would I UPDATE these table entries with SQL and PHP?

I am working on an Asset Database problem. I enter assets into a database. Every object is an asset and has variables within the asset table. An object is also a type of asset. In this example the type is server. Here is the Query to retrieve all necessary data: SELECT asset.id ,asset.company ,asset.location ,asset.purchaseDate ,...

how to synchronize database table and directory with php

hello, I have a directory with files and a database table with what should be the same files. I would like to be able to synchronize the database table with the directory. What would be the most efficient way to do this? or would I realistically only be able to do this in a brute manner? Here's my approach: 1. retrieve all of the files...

MAgento top-nav bar

Hi Everyone, I am working with the free redtheme to make a website. This is my first week into magento and designing any website. I have installed and started having a look at magento admin interface. I am not sure how to get top navigational bar working. Which files needs to be changed to get a top nav bar. While googling and reading a...

Make CMD sensitive to use with MySQL?

I have a cleanup scrip in a bat file and i wanted to do the below but the problem is i get a mysql error saying unknown database and showing it as testdb. I guess i can change my code testdb but i would like to know. How do i have windows cmd use case sensitivity so i can execute queries properly instead of always in lower case? mysql....

mysql query help, take total sum from a table, and based on discount value on another table calculate the gross_total

hi I have a table called invoices: `si_invoices` ( `id` int(10) , `biller_id` int(10) , `customer_id` int(10) , `type_id` int(10) , `inv_tax_id` int(10) , `date` date , `unreg_customer` tinyint(1) , `discount` decimal(10,2) , `discount_type` tinyint(1) ) each invoice has items that are stored in invoice_items tabl...

How do I query in cakephp, if the date in the field 'created' of model 'listings' is more than 2 weeks ago?

I have a model 'listing' with a field 'created' which is in a datetime format. I need to list in a view all listings that were created over 2 weeks ago. An extra thing if possible is to somehow mark them as expired. This is in cakePhp 1.27 ...

Mysql limit function doesn't seem to work for me...

Here is my query, select t1.dSyllabus_id,t1.dBatch,t1.dFilePathName, t2.dDegreeName,t3.dDepartmentAbbr from tbl_syllabus as t1 join tbl_degree_master as t2, tbl_department_master as t3 where t2.dDegree_id=t1.dDegree_id and t3.dDepartment_id=t1.dDepartment_id and t1.dCollege_id='1' and t1.dIsDelete='0' and i get applying limit , ...

Query for find Nth maximum value in Mysql

How do I write a query to find the Nth maximum value in MySQL? ...

Php getting too many connections error from MySQL

Hello everyone, I am using MySQL and PHP with 2 application servers and 1 database server. With the increase of the number of users (around 1000 by now), I'm getting the following error : SQLSTATE[08004] [1040] Too many connections The parameter "max_connections" is set to "1000" in my.cnf and "mysql.max_persistent" is set to -1 in ph...

Searching 2 fields at the same time

I have a table of first and last names firstname lastname --------- --------- Joe Robertson Sally Robert Jim Green Sandra Jordan I'm trying to search this table based on an input that consists of the full name. For example: input: Joe Robert I thought about using SELECT * FROM tablename WHERE ...

Accessing MySQL database from iphone

Hi i am trying to connect my iphone aap directly to the MySQL database. I did a lot of reading, and i found that by using MCPkit we can access the database. Now i also found that the mcpkit is not supported in iphone, while it runs in simulater. Can somebody tell me whats the deal with this. I know the other alternative is web services, ...

Finding mySQL duplicates, then merging data

I have a mySQL database with a tad under 2 million rows. The database is non-interactive, so efficiency isn't key. The (simplified) structure I have is: `id` int(11) NOT NULL auto_increment `category` varchar(64) NOT NULL `productListing` varchar(256) NOT NULL Now the problem I would like to solve is, I want to find duplicates on...

Mysql,issues with into outfile, an easy solution or a better way to do it?

Hello everyone, at the moment I'm writing a simple script in ksh who should take some strings from a DB and list them on the shell. This is how it should work: Query the DB for all the datas Export them to a text file Using awk to show the different columns The problem is that two fields of the table I'm querying contain sentences. S...

how to implement single sign on for asp.net,mysql websites

Hi, I am using mysql database for my asp.net website.I need to implement to single sign on for multiple instances of my website.Currently to check if a user has logged in I am using a user control which checks for a "loggedin" cookie with single instance of the website.Now I need to extend the logic to achieve single signon for multiple...