Sponsored Content
Full Discussion: Check data in mysql
Top Forums Shell Programming and Scripting Check data in mysql Post 302900077 by ust3 on Sunday 4th of May 2014 07:29:50 AM
Old 05-04-2014
Check data in mysql

Hi, I just would like to write a perl script , this perl script do the following .

Check the parameter $data in a mysql database ( with user ID and password ) , if the $data is exist then return true , if not then return false , would advise how to write this script ? thanks

---------- Post updated 05-04-14 at 06:29 AM ---------- Previous update was 05-03-14 at 09:01 PM ----------

I have the below perl script to connect the mysql db , would advise how to change it to check if the parameter $data is exist in mysql database or not , then return true or false ? thanks
Code:
use DBI
use strict;
my $driver = "mysql"; 
my $database = "TESTDB";
my $dsn = "DBI:$driver:database=$database";
my $userid = "testuser";
my $password = "test123";
my $dbh = DBI->connect($dsn, $userid, $password ) or die $DBI::errstr;


Last edited by Franklin52; 05-04-2014 at 10:39 AM.. Reason: Please use code tags
 

6 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Help Inserting data in mysql table

Cant understand the error #!/bin/bash temp="" A="" D=$(date +"%Y-%m-%d") H=$(date +"%R") temp=$(wget -q -O - website | grep -o "Temperature:]**" | grep \-E -o "+") mysql -D "weather_wise" -e "INSERT INTO weather (Date, Hour, Degrees) VALUES ($D,$H, $temp)"; my data types for... (11 Replies)
Discussion started by: vadharah
11 Replies

2. Shell Programming and Scripting

sh and MySQL LOAD DATA

I have a csv file in a folder that is roughly 500,000 rows long. Rather than using PHP, I would like to use SH to run a MYSQL LOAD DATA command to load the data in, as I think it would be much faster and would not cause any memory problems associated with PHP. But the problem is, I am not... (18 Replies)
Discussion started by: worchyld
18 Replies

3. Infrastructure Monitoring

moving rrd data to mysql

All I currently run an application called OpenNMS. This is a free enterprise grade NMS. Its current framework uses RRDs to collect performance/node level data such as cpu load via snmp. all data is stored in these RRDs. I was wondering if anyone out there has had a chance or a need to move the... (2 Replies)
Discussion started by: pupp
2 Replies

4. Shell Programming and Scripting

Need help with extracting data to MySQL format

Hi guys, I'm doing a project now and extracting tables from a webpage to MySQL table format. I dumped the webpage with lynx and it is like this id Spec 524543 Developed especially for seniors Spec No Java Spec Yes Java MIDP Spec ... (4 Replies)
Discussion started by: Johanni
4 Replies

5. Programming

Need help on Insert data to mySQL database

Hi guys, I would like to seek help on inserting data whenever the switch is on or off to my sensor mySQL database in phpMyAdmin from my control.php. I'm using Raspberry PI as my hardware and follow a few tutorials to create my own Web Control Interface, it works perfectly without insert method.... (1 Reply)
Discussion started by: aoiregion
1 Replies

6. Shell Programming and Scripting

Send Data to MySQL Table Columns

I have two scripts, each script reads an individual data file and copies specific lines of data and sends to MySQL table. Only difference is, each script sends data to a separate column on the same DB. I want to use one script to populate DB table and have data look horizontal, with no overlapping.... (3 Replies)
Discussion started by: SysAdminRialto
3 Replies
DataSource(3)						User Contributed Perl Documentation					     DataSource(3)

NAME
DBIx::DataSource - Database-independant create and drop functions SYNOPSIS
use DBIx::DataSource qw( create_database drop_database ); create_database( $data_source, $username, $password ) or warn $DBIx::DataSource::errstr; drop_database( $data_source, $username, $password ) or warn $DBIx::DataSource::errstr; DESCRIPTION
This module implements create_database and drop_database functions for databases. It aims to provide a common interface to database cre- ation and deletion regardless of the actual database being used. Currently supported databases are MySQL and PostgreSQL. Assistance adding support for other databases is welcomed and relatively simple - see DBIx::DataSource::Driver. FUNCTIONS
create_database DATA_SOURCE USERNAME PASSWORD Create the database specified by the given DBI data source. drop_database DATA_SOURCE Drop the database specified by the given DBI data source. AUTHOR
Ivan Kohler <ivan-dbix-datasource@420.am> COPYRIGHT
Copyright (c) 2000 Ivan Kohler Copyright (c) 2000 Mail Abuse Prevention System LLC All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. BUGS
If DBI data sources were objects, these functions would be methods. SEE ALSO
DBIx::DataSource::Driver, DBIx::DataSource::mysql, DBIx::DataSource::Pg, DBI perl v5.8.0 2000-09-25 DataSource(3)
All times are GMT -4. The time now is 10:22 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy