Search Results

Search found 14874 results on 595 pages for 'mysql connector'.

Page 118/595 | < Previous Page | 114 115 116 117 118 119 120 121 122 123 124 125  | Next Page >

  • mysql IN parameter

    - by proyb2
    When the user check more than one (checkbox) option which are then combine into a string of "apple,orange,pear" SELECT id, pos, FROM $db WHERE dtime>='$now' AND jsub IN ('$arr[1]') ; When I pass the string to $arr[1], it won't work correctly, how do I split into array and get mysql IN function to process correctly?

    Read the article

  • MySQL Single Query Benchmarking Strategies

    - by Pepper
    Hello, I have a slow mySQL query in my application that I need to re-write. The problem is, it's only slow on my production server and only when it's not cached. The first time I run it, it will take 12 seconds, then anytime after that it'll be 500 milliseconds. Is there an easy way to test this query without it hitting the query cache so I can see the results of my refactoring? Thanks!

    Read the article

  • PHP & MySQL Undefined variable problem

    - by comma
    I keep getting the following error Undefined variable: id on line 91 can some one help me correct this problem? The error is on this line. $query2 = "INSERT INTO users_skills (skill_id, user_id, date_created) VALUES ('$id', '$user_id', NOW())"; MySQL database tables. CREATE TABLE tags ( id INT UNSIGNED NOT NULL AUTO_INCREMENT, skill VARCHAR(255) NOT NULL, experience VARCHAR(255) NOT NULL, years VARCHAR(255) NOT NULL, PRIMARY KEY (id) ); CREATE TABLE users_skills ( id INT UNSIGNED NOT NULL AUTO_INCREMENT, skill_id INT UNSIGNED NOT NULL, user_id INT UNSIGNED NOT NULL, date_created DATETIME UNSIGNED NOT NULL, PRIMARY KEY (id) ); Here is the PHP & MySQL code. if (isset($_POST['info_submitted'])) { $mysqli = mysqli_connect("localhost", "root", "", "sitename"); $dbc = mysqli_query($mysqli,"SELECT learned_skills.*, users_skills.* FROM learned_skills INNER JOIN users_skills ON learned_skills.id = users_skills.skill_id WHERE user_id='$user_id'"); if (!$dbc) { print mysqli_error($mysqli); return; } $user_id = '5'; $skill = $_POST['skill']; $experience = $_POST['experience']; $years = $_POST['years']; $mysqli = mysqli_connect("localhost", "root", "", "sitename"); $dbc = mysqli_query($mysqli,"SELECT learned_skills.*, users_skills.* FROM learned_skills INNER JOIN users_skills ON users_skills.skill_id = learned_skills.id WHERE users_skills.user_id='$user_id'"); if (mysqli_num_rows($dbc) == 0) { if (isset($_POST['skill']) && trim($_POST['skill'])!=='') { $mysqli = mysqli_connect("localhost", "root", "", "sitename"); $query1 = mysqli_query($mysqli,"INSERT INTO learned_skills (skill, experience, years) VALUES ('" . $skill . "', '" . $experience . "', '" . $years . "')"); if (mysqli_query($mysqli, $query1)) { print mysqli_error($mysqli); return; } $mysqli = mysqli_connect("localhost", "root", "", "sitename"); $dbc = mysqli_query($mysqli,"SELECT id FROM learned_skills WHERE id='" . $skill . "' AND experience='" . $experience . "' AND years='" . $years . "'"); if (!$dbc) { print mysqli_error($mysqli); } else { while($row = mysqli_fetch_array($dbc)){ $id = $row["id"]; } } $query2 = "INSERT INTO users_skills (skill_id, user_id, date_created) VALUES ('$id', '$user_id', NOW())"; } }

    Read the article

  • MySQL optimised code for 2 tables?

    - by David19801
    Hi, I have 2 tables, Table1: id,int1,int2,int3,int4,int5 Table2: integers (autoincrement),blobdata The query I want to use is given the id I want to get the blobdata from table2 associated with the 5 integers in table1. I've only ever used one table in mysql so have no idea how to do this properly. Is it possible? EDIT: id is username, integers in table2 is just integers. but have not built the tables yet, so can change if need to.

    Read the article

  • how to fetch data from multiple tables MySQL

    - by faisal
    hi all, I am looking some help in php+MySQL+jquery I have 2 tables table1 table 1 have 4 colume (id, title, desc, thumb_img) tabel2 table 2 have 3 colume(id, table1id, img) I just want to compare 2 table with the value of $_get['QS']; and show the records from both (title, desc, img) Looking forward for the help.:)

    Read the article

  • PHP, MySQL: Display only required parts of my website in sister website

    - by Devner
    Hi all, Now I have my website built on PHP & Mysql. Consider this like a forum. Now when a user posts a reply in my website 1 (ex. www.website1.com), I want to be able to show the starting thread and it's related replies in a sister website of mine. I want to do this in a way that it does not show the rest of the page & other page contents (like logo etc.). I don't think iframe would be a solution because an iframe would embed the whole page and the users visiting my sister website (totally different domain i.e. www.website2.com) would be able to see all the page contents, like logo etc. I want to avoid that. I want to make them see only limited information from website 1 and only the info. that I intend. I hope that makes sense. In a way, you could say that I am trying to replicate my 1 website, and show only a limited part of it. Users browsing 2nd website can post a reply in the 2nd website and it should automatically be posted & visible to the visitors of the website 1. Users of website 1 should not know that a user of website 2 has posted it. They would feel that some user from website 1 has posted it. Do I have to use 2 separate mysql DB or just 1? I think it would be problematic if I am trying to use different DB. I also feel I might have to face DB connectivity issues as I can connect to only 1 DB at a time. It's basically like users of website1.com should feel that they are replying to users of website1.com & users of website2.com should feel that they are replying to users of website2.com. (I need it this way to bridge the gap between them). At the same time I want to make the front end of the websites different so that they don't feel that they are replying to some other users outside the domain. These websites would be under my control and I will have access to the source code at any time. If I need to change the source code, these changes are welcome. Is this really possible? Thank you in advance.

    Read the article

  • connect to mysql server using realbasic

    - by Gbolahan
    Hello, tried connecting to mysql server in realbasic using the folowing code: dim db as MySQLCommunityServer db=New MySQLCommunityServer db.host="192.168.240.129" db.port=3306 db.databaseName="test" db.userName="test" db.Password="test" If db.Connect() then txt1.Text = "Connected" else txt1.Text = "Connection failed!"+ chr(13)+db.ErrorMessage end if and i get the following message connection failed! any suggestions.. Thanks

    Read the article

  • MySQL specifying exact order with WHERE `id` IN (...)

    - by Gray Fox
    Is there an easy way to order MySQL results respectively by WHERE id IN (...) clause? Example: SELECT * FROM articles WHERE articles.id IN (4, 2, 5, 9, 3) to return Article with id = 4 Article with id = 2 Article with id = 5 Article with id = 9 Article with id = 3 and also SELECT * FROM articles WHERE articles.id IN (4, 2, 5, 9, 3) LIMIT 2,2 to return Article with id = 5 Article with id = 9

    Read the article

  • MYSQL LIMIT not working as expected - Java

    - by Sirish
    I have this weird problem in java when trying to fetch records from MYSql database by using the limit function in the query. Not sure what went wrong or did wrong, this query is giving me a hard time. Issue - When I run this query through my java program it returns all the records and not limiting the records to 10 as given in the limit. The same query when ran in MYSql command line, it execute very well and fetches me only 10 recrods. Below is the java code and query. Any help or support is appreciated.! Java code - public UserVO getApplUserDetailsList(UserVO userVO) throws CAPDAOException { List<UserVO> returnList = null; String methodName = "getApplUserDetails()"; Session session = null; String queryString = null; Transaction transaction = null; PreparedStatement ps = null; ResultSet rs = null; if(userVO == null) { logger.writeToTivoliAlertLog(className, CAPConstants.ERROR, methodName, null, "userVO returned null. Busines validation error.!", null); throw new CAPDAOException("userVO returned null. Busines validation error.!",CAPException.BUSINESS_VALIDATION_ERROR_SECURITY); } try { returnList = new ArrayList<UserVO>(); System.out.println(""); String appusr = userVO.getAppUsrNm(); session = getSession(); transaction = session.beginTransaction(); if(userVO.getAppUsrRoleCd()!=null && !userVO.getAppUsrRoleCd().trim().equalsIgnoreCase(CAPConstants.DEFAULT_DROPDOWN_VALUE)){ queryString = "SELECT " + "APPL_USR_ID,APPL_USR_NM,APPL_USR_FRST_NM, " + "APPL_USR_LST_NM,ACCESS_ROLE_CD " + "FROM APPL_USR " + "WHERE " + "APPL_USR_NM LIKE ?"+ " AND APPL_USR_FRST_NM LIKE ?"+ " AND APPL_USR_LST_NM LIKE ?"+ " AND ACCESS_ROLE_CD = ?"+ " AND APPL_USR_ID != ?"; ps = session.connection().prepareStatement(queryString); ps.setString(1,userVO.getAppUsrNm()+CAPConstants.PERCENTILE_SYMBOL); ps.setString(2,userVO.getAppUsrFirstNm()+CAPConstants.PERCENTILE_SYMBOL); ps.setString(3,userVO.getAppUsrLastNm()+CAPConstants.PERCENTILE_SYMBOL); ps.setString(4,userVO.getAppUsrRoleCd()); ps.setInt(5, 1); } else { queryString = "SELECT " + "APPL_USR_ID,APPL_USR_NM,APPL_USR_FRST_NM, " + "APPL_USR_LST_NM,ACCESS_ROLE_CD " + "FROM APPL_USR " + "WHERE " + "APPL_USR_NM LIKE ?"+ " AND APPL_USR_FRST_NM LIKE ?"+ " AND APPL_USR_LST_NM LIKE ?"+ " AND APPL_USR_ID != ?"; ps = session.connection().prepareStatement(queryString); ps.setString(1,userVO.getAppUsrNm()+CAPConstants.PERCENTILE_SYMBOL); ps.setString(2,userVO.getAppUsrFirstNm()+CAPConstants.PERCENTILE_SYMBOL); ps.setString(3,userVO.getAppUsrLastNm()+CAPConstants.PERCENTILE_SYMBOL); ps.setInt(4, 1); } if(userVO.getQueryAction()!=null && userVO.getQueryAction().equals(CAPConstants.GET_DATA)) queryString += " ORDER BY APPL_USR_ID LIMIT " + userVO.getPAGE_MIN_LIMIT() + ", " + userVO.getPAGE_MAX_LIMIT(); else queryString += " ORDER BY APPL_USR_ID"; rs = ps.executeQuery(); if(userVO.getQueryAction()!=null && userVO.getQueryAction().equals(CAPConstants.GET_DATA)) { int tempCOunt = 0; while(rs!=null && rs.next()) { tempCOunt ++; UserVO returnVO = new UserVO(); returnVO.setAppUsrId(rs.getInt("APPL_USR_ID")); returnVO.setAppUsrNm(rs.getString("APPL_USR_NM")); returnVO.setAppUsrFirstNm(rs.getString("APPL_USR_FRST_NM")); returnVO.setAppUsrLastNm(rs.getString("APPL_USR_LST_NM")); if (rs.getString("ACCESS_ROLE_CD")!=null && rs.getString("ACCESS_ROLE_CD").trim().equalsIgnoreCase(CAPConstants.ADMINISTRATOR_ROLE_CD)) returnVO.setApplicationLevelRole("Administrator"); else if (rs.getString("ACCESS_ROLE_CD")!=null && rs.getString("ACCESS_ROLE_CD").trim().equalsIgnoreCase(CAPConstants.MAINTAINER_ROLE_CD)) returnVO.setApplicationLevelRole("Maintainer"); else if (rs.getString("ACCESS_ROLE_CD")!=null && rs.getString("ACCESS_ROLE_CD").trim().equalsIgnoreCase(CAPConstants.VIEWER_ROLE_CD)) returnVO.setApplicationLevelRole("Viewer"); else returnVO.setApplicationLevelRole("None"); returnList.add(returnVO); } System.out.println("Count >>>>>>>>>>>>>>>>>>> "+tempCOunt); userVO.setReturnListFromDB(returnList); } else { int rowcount = 0; if (rs.last()) { rowcount = rs.getRow(); rs.beforeFirst(); // not rs.first() because the rs.next() below will move on, missing the first element } userVO.setTotalRecordCount(rowcount); System.out.println("Total count of the records to be used for pagination >> "+rowcount); rowcount = 0; while(rs!=null && rs.next()) { rowcount ++; UserVO returnVO = new UserVO(); returnVO.setAppUsrId(rs.getInt("APPL_USR_ID")); returnVO.setAppUsrNm(rs.getString("APPL_USR_NM")); returnVO.setAppUsrFirstNm(rs.getString("APPL_USR_FRST_NM")); returnVO.setAppUsrLastNm(rs.getString("APPL_USR_LST_NM")); if (rs.getString("ACCESS_ROLE_CD")!=null && rs.getString("ACCESS_ROLE_CD").trim().equalsIgnoreCase(CAPConstants.ADMINISTRATOR_ROLE_CD)) returnVO.setApplicationLevelRole("Administrator"); else if (rs.getString("ACCESS_ROLE_CD")!=null && rs.getString("ACCESS_ROLE_CD").trim().equalsIgnoreCase(CAPConstants.MAINTAINER_ROLE_CD)) returnVO.setApplicationLevelRole("Maintainer"); else if (rs.getString("ACCESS_ROLE_CD")!=null && rs.getString("ACCESS_ROLE_CD").trim().equalsIgnoreCase(CAPConstants.VIEWER_ROLE_CD)) returnVO.setApplicationLevelRole("Viewer"); else returnVO.setApplicationLevelRole("None"); returnList.add(returnVO); System.out.println("Row count >>"+rowcount); if(rowcount == CAPConstants.PAGINATION_MAX_VALUE) break; } rowcount = 0; userVO.setReturnListFromDB(returnList); } System.out.println("returnList >>"+returnList); return userVO; } catch (Throwable e) { e.printStackTrace(); logger.writeToTivoliAlertLog(className, CAPConstants.ERROR, methodName, userVO.getAppUsrNm(), "Error occured while trying to fetch application user details. Printing stack trace to the log for analysis..", e); throw new CAPDAOException("Error occured while trying to fetch application user details.",CAPException.SPEXECUTION_ERROR_CODE); } finally{ closeTransactionAndSession(session,transaction); } } MYSQL Query - SELECT APPL_USR_ID,APPL_USR_NM,APPL_USR_FRST_NM, APPL_USR_LST_NM,ACCESS_ROLE_CD FROM APPL_USR WHERE APPL_USR_NM LIKE '%' AND APPL_USR_FRST_NM LIKE '%' AND APPL_USR_LST_NM LIKE '%' AND APPL_USR_ID != 1 ORDER BY APPL_USR_ID LIMIT 10, 10

    Read the article

  • mysql query timer for .net

    - by acidzombie24
    Is there something i can use to track how long my mysql queries take? perhaps log them if they take a certain amount of time? or track all queries but only hold the longest query time? using this with C# .NET with ASP.NET. I'd like to use this to occasionally check if my queries are getting slow.

    Read the article

  • Mysql change column details

    - by Ankur
    I am trying to redefine the number of varchars a column can have (in a MySQL db). I am doing alter table obj_details IMG_SRC IMG_SRC varchar(180); I want to change the number of characters that can be used in the column IMG_SRC to 180 (it is currently 100). But I get an error saying that I should check the syntax near IMG_SRC IMG_SRC varchar(180).

    Read the article

  • MySQL from Silverlight on Linux Server

    - by cam
    I'm trying to access a MySQL database through Silverlight, and I know you can't do it directly, but the only way I know of is to use a WCF service. This won't run on the server I have, is there any other way to access the database (through PHP maybe)?

    Read the article

  • Creating tables and inserting data (MySQL Dump) using PHP Doctrine 1.2

    - by Dimitry
    Hello. I got a script that create a new database, now I need to fill that database with tables and values (from a MySQL dump file). I'm using PHP - Doctrine 1.2. Here is how I create the database: $manager = Doctrine_Manager::getInstance(); $newConn = $manager->openConnection($customer->Config->db_connection_string); $newConn->createDatabase(); How I do this? Thanks!

    Read the article

  • Copying MYSQL backup to another server

    - by Yeti
    I'm new to SSH. How to copy a .gz file from one server to another using SSH? I'm using cron to backup mysql databases and want to also automate the process of copying the .gz files a different web host. Any information on the limit of file size that can be copied would also be great. The backup file size range from 100 MB to few GB.

    Read the article

  • Mysql - datetime and date-range comparsion

    - by Ockonal
    Hello guys, I have datetime-row in mysql database. I have to check time between now and that date using php. If the range is bigger then 1 month - do somtething. I tried something like this: $dateFromMysql = strtotime($rowData); $currentDate = date("m/d/y g:i A"); And then comparsion by hands. It's ugly.

    Read the article

  • Always-indexed MySQL indexing/searching replacements for InnoDB?

    - by Chad Johnson
    I am using InnoDB for a MySQL table, and obviously queries using LIKE and RLIKE/REGEXP can take a lot of time. I've tried Spinx, and it works great, except I have to re-index context at intervals. I can re-index every minute, but I am wondering if there is either 1) a setting in Sphinx to keep records always indexed or 2) other software besides Sphinx that will keep records always indexed. I want it where that immediately upon inserting or updating a record, the index is updated.

    Read the article

  • Permissions done on MySQL side or PHP side?

    - by Kerry
    When I am grabbing data from my table that require permissions, should all the permission be done there? Such as checking for an admin or if they can view the data (in MySQL)? Or should I grab it if they have a record at all, then check the specific actions (such as view, add, edit, delete) on the PHP side?

    Read the article

  • MySQL upload CSV file as new table

    - by Brian
    I frequently upload CSV files to a MySQL db. It is very convenient to use LOAD DATA LOCAL INFILE to upload the data, but I can't use this to create the table itself. As of now, the best method I have is to use PHP to get the field titles from the first row of the file and then put together a CREATE table query. Is there a more convenient way to do this?

    Read the article

  • Why would restarting MySQL make my site faster?

    - by beagleguy
    hey all, my site started dragging lately, the queries taking exceptionally longer than I would expect with properly tuned indexes. I just restarted the mysql server after 31 days uptime and every query is now substantially faster and the whole site renders 3-4 times faster. Would there be anything that jumps out at you as to why this may have been? Improper settings on my.cnf perhaps? Any ideas as to what I can start looking at to try and pinpoint why? thanks

    Read the article

  • MYSQL Order By Sum of Columns

    - by djs22
    Hi all, Any idea on how to order the results of a MYSQL query by the sum of two columns rather than by a single column? Select * FROM table ORDER BY (col1+col2) desc I know that won't work., but I hope it conveys what I want to do fairly well. Thanks!

    Read the article

< Previous Page | 114 115 116 117 118 119 120 121 122 123 124 125  | Next Page >