Programming :: MySQL And PHP - Table Column With Multiple Values?

Dec 1, 2008

I am writing a script to mine data from my game server logs which are going to mysql. My first question is syslog-ng is sticking $msg into one colum it self, $msg tends to be a long string here are a few examples:

cn name team frag death flags role host.
0 Maik CLA 2 0 0 normal *.70.233.118.
1 lizardncd RVSF -1 3 0 normal
[*.22.247.40] lizardncd fragged Maik.

And they are not always in the same format, How could I parse this data to do something useful, like creating a user stats page with frag counts and flag counts. Should I create a script that runs in a cronjob that parses this data to a new table maybe once a day. Even then the $msg string value is random and I am thinking in terms of awk.

Second. I would like to keep track of what ip's are using what nicknames. Kinda in the sense of and ip associated to a array of names that have been used on that ip address so I can keep track of users. How would this work logically with a mysql db, could a column allow multiple values, then loadable into an array, which then can add, remove, and store to mysql.

View 1 Replies


ADVERTISEMENT

Programming :: How To Sort Two MySQL Table On Date Or Time Column

Jul 27, 2011

I have two different table in a database in mysql that has no share key with each other and I want to sort them with each other on their date time column I mean when I sort it row X of table A that is older that row Y of table B comes earlier.

View 3 Replies View Related

Programming :: Importing MYSQL Table From Text File Wo Column Delimiters?

Jun 13, 2011

I am trying to import a data file from old DOS application into MYSQL table The file is clear text file with fixed-width columns, without column delimiters

Example file :
Code:
4444333666666
2222666555555
iiiiwwwcccccc

[Code]...

View 3 Replies View Related

Programming :: Awk Multiple Column Into Single Column?

Jul 15, 2010

I have a multicolumn datas, like

a1 b1 ... f1
a2 b2 ... f2
. . ... .

[code]...

I would like to make a file with all these data in one column, like

a1
a2
.
.

[code]....

Can it be done with awk or some other command? Also, is it possible then do add another column in front of this one with numbers of the lines (for every previous column), like

1 a1
2 a2
. .
. .

[code].....

View 14 Replies View Related

Programming :: Shell Script To Table RAW Device Values?

Mar 30, 2011

I'm working on a script to table the outputs of various commands that depend on each other. The commands are these:

Code:

[root@kybsdc2 ~]# raw -q /dev/raw/raw1
[root@kybsdc2 ~]# sginfo -a /dev/dm-5 | grep Serial
[root@kybsdc2 ~]# multipath -ll

which give these outputs:

Code:

#/dev/raw/raw1:bound to major 253, minor 5
#Serial Number 'P3e8hZWrsSeX'
#netapp (360a9800050336538685a577273536558) dm-5 NETAPP,LUN
[size=1.0G][features=1 queue_if_no_path][hwhandler=0][rw]

[code]....

Also the RAW13 device has completely wrong output due to 1 occurring more times throughout the sequence causing more information to be displayed then needed. The last point is if I could somehow remove the '' in the serial number outputs and the = sign from the device sizes. I guess I will have to either put a whole lot of logical IF or CASE statements in but somehow I need to streamline and make this code dynamic!

View 8 Replies View Related

Programming :: Insert Values Into A MySql Database?

Feb 9, 2010

I want to insert values into a MySql database. The following line works fine:1

Code:
mysql_query(connection, "INSERT INTO main (NumofShows , Title) VALUES('12', 'Home')");
but if the data to be inserted is from a string... like....
Code:
string NewTitle = "Monaco";
string NumofShows = "2";

How do i edit my sql statements so variables can be inserted into the Values ( ) , and it will be able to read the variables and then store it into the database.

View 4 Replies View Related

Programming :: Parsing And Storing Multiple Values Using 'awk'?

Jan 24, 2011

I have a variable in which the data is stored as below:

variable_test=0m0.001s 0m0.001s 0m0.001s 0m0.001s 0m0.001s 0m0.001s .....an so on.

There are lots of values in format like "3m1.057s" are stored in variable_test separated with an space between two such values. For exapmple, value is "3m1.057s" I need to save different parts of a value in three separate array variables such as the

var_hour=3
var_min=1
var_sec= 057

tell if this can be done using "awk". A "WHILE" loop might be used to separate and store theses values I guess?

View 1 Replies View Related

Programming :: PHP Ignores One MySQL Table But Not Others?

Sep 23, 2010

I have just run into a baffling error. I have a database set up in MySQL with six tables. My PHP based website performs queries of all kinds on these tables (SELECT, INSERT, UPDATE, DELETE). On my most recently setup table, the "Orders" table, I am able to perform queries from the server, as well as from my PHP MySQL Admin interface, but all activity from my webpage states that the Orders table does not exist. All other tables are running fine. I have tried rewriting the query script, checked for case sensitivity problems, even cut and pasted other working scripts in place, changing the table and field names as needed. No success. What could cause a single table to not show up like this?

View 2 Replies View Related

Programming :: C: Testing Multiple Consecutive Array Values Concurrently.?

Nov 22, 2010

Basically, I am provided with a file "temp.dat" with 30 high temperatures (integers) in it. The program is supposed to read them in and compute/print the average. Then it is supposed to print the temperature of each day and, in addition, display a + by each day that is over the average, but only if it is above the average high for three or more consecutive days. This is the part I am stuck on. I'd appreciate any tips that would point me in the right directionFull disclosure: This is a school project. Code:

Code:
#include <stdio.h>
#include <stdlib.h>

[code]....

View 2 Replies View Related

Programming :: Grep Multiple Values In Single Pass Through Log File?

Nov 13, 2010

I have a huge binary log file. There are lets say 4 id's that I want to find in a log file. I know that those 4 id's will be present in the log file and I also know in what order they will be present. I want to find 1st id from the log then 2nd id and then third id and so on..

Simple/inefficient solution is: Loop through the id's and then grep in the log file. Problem with this solution is for each id grep will search from the beginning of the file.

Better/efficient solution would be: Sine I know the order in which id's will be present in the log file. Loop through id's, grep 1st id and then move on to grep 2nd id and so on...this way I can grep all id's in one pass. Is this solution possible ?

I have 500000 + values to find in log files and I have to find efficient solution for it.

View 2 Replies View Related

Programming :: Unable To Delete A Table In MySQL?

Oct 17, 2010

A sed mishap prior to a database import left me with a table name with, eh, well, this: Code: mysql> show tables;

+-------------------+
| Tables_in_someday |
+-------------------+
| day20101016 |
| day20101017); |
+-------------------+

I've corrected the sed mishap and imported the database the way it was intended Code: mysql> show tables;

+-------------------+
| Tables_in_someday |
+-------------------+
| day20101016 |
| day20101017); |
| day20101017 |
+-------------------+

But I can't seem to drop the table day20101017); because no matter how I seem to escape it it errors.

View 1 Replies View Related

Programming :: Multiple Input Into Seq Command From Pipe - Single Column Unique Numbers

May 13, 2011

Have this script which is reading in a series of files, one at a time with while-do-done loop, each file goes through various greps/awk's where this info is then saved to various files for later use. i.e....

Script is being run on Linux Red Hat,

In one of the grep/awk's the output (currently) are 2 columns (min max), i.e....| awk '{print $1, $2}' | sort -u which outputs (e.g.)

The number of "min max" pairs varies from file to file. Want to output a single column of unique numbers from the min max pairs & get the number of them for input to a file...i.e...

Where <PROCESS> is some process/technique that will generate a single column of integers (increment of 1) to pipe into the next one (sort -u)

i.e. (example from above)

Have tried command seq - only works for single pair input i.e.

Is there any command like seq etc which will output a single column based on a input of min max numbers (increment 1) to pipe onwards to next command?

View 4 Replies View Related

Programming :: Using Perl To Update Mysql Table On Certain Event?

Feb 6, 2011

I'd like to use a perl script to update a fields in mysql database when pianobar (command line pandora radio player) starts a new song. Pianobar has the ability to run a script based on events, I'd like to take advantage of and use perl toparse the artist,song,album and update the corresponding fields. Then later retrieve them and display them with php/html. I am by no means proficient with perl. I started to use bash, but it looks like perl will be much more efficient and and less time consuming.

Code:
#! /usr/bin/perl -wT
use strict;

[code]...

View 2 Replies View Related

Programming :: Perl: Compare CGI Input With Data From A MySQL Table?

Nov 19, 2008

I have this program:

#! /usr/bin/perl
use DBI ;
use strict ;

[code]....

and I get this error simply running the program from the command line: DBD::mysql::st execute failed: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 at ./submit.cgi line 24.

is this the right syntax to use, both, for this line:

my (@param) = $cgi->param("firstname","lastname","type") ;

as well as this one:

$sth=$dbh->prepare ("SELECT firstname,lastname,type FROM dts WHERE firstname LIKE $param[0] AND lastname LIKE $param[1] and type LIKE $param[2]" );

or should there be quotes around the $param[0] or something? (also is it $param[0] or $param(0)?)

View 1 Replies View Related

Programming :: Shell Script To Get Count Of Records In A Mysql Table?

Oct 23, 2010

I'm using MYTHTV with AT&T's U-Verse system. AT&T apparently turns off the set-top box if the box doesn't receive any commands after some number of hours. When this happens the box takes so long to turn on that it doesn't process the lirc IR channel change command. I've rewritten my channel changer to add a lockfile, and added a cron entry to kick off an entry to just "ping" the set-top box once an hour. But, OK, I'd like to play the bandwidth saving game and not do this if there isn't anything in the "record" table.

So, how would I write a script that will check the number of rows in the "record" table in the "mythconverg" database and exit if there are zero rows? I'm afraid I don't know how to even start this. Here is my "keepalive.sh" script that does the pinging:

Code:
#!/bin/sh
#if there are no rows in the record table, just exit this script
# lock the lockfile - MUST be same one as channel lock
while [ `lockfile "/tmp/mythchanlock.lck"` ]

[Code]....

View 3 Replies View Related

General :: Delete Rows Based On Values In A Column Using Sed?

Jan 18, 2011

I have a lot of files with thousands of rows and usually two columns of data. Column 1 is a coordinate, column 2 is a score. I want to delete rows that have a value in column 2 over, in this case, 50.

For example, here's a clip from a file:

2999898 39
2999899 40.9
2999900 42.7
2999901 44.7
2999902 46.7
2999903 48.9
2999904 51.1
2999905 53.3
2999906 55.7

I want the output to be this:

2999904 51.1
2999905 53.3
2999906 55.7

I know how to use sed for very basic things like deleting rows or ranges of rows but I can't figure out this ostensibly easy command.

View 6 Replies View Related

Programming :: PHP Auto Removes Stale Sessions On It's Own But Doesn't Remove From MYSQL Table

Aug 24, 2010

I know PHP auto removes stale sessions on it's own, but that doesn't remove them from the MYSQL table. So I was gonna make a cron script that ran once every hour that removed any MYSQL shopping cart item from the table if the original session_id that created it does not exist anymore.

From my understanding a session_id is an "actual" file located somewhere on the harddisk (is it not? correct me if I'm wrong), so I was going to do a simple check for each item in the shopping cart to check for it's original session file, if it didn't exist on the harddisk, then simply remove it from the mysql table.

View 1 Replies View Related

OpenSUSE :: Kmail Akonadi And Mysql Errors - Can't Open And Lock Time Zone Table: Table

May 3, 2010

Kmail 1.13.2 Problem on startup, error is from nepomuk, data storage. "cannot find Redland backend, nepomuk is disabled until fixed. Also see the following error from the akonadi console:

100503 10:00:15 [Note] Plugin 'ndbcluster' is disabled.
100503 10:00:15 InnoDB: Started; log sequence number 0 31413862
100503 10:00:15 [Warning] Can't open and lock time zone table: Table
'mysql.time_zone_leap_second' doesn't exist trying to live without

[code]....

View 2 Replies View Related

Programming :: DBD::mysql::st Execute Failed: Column Count Doesn't Match Value Count At Row 1

Feb 24, 2010

I have the following perl/DBI script:

Quote:

#!/usr/bin/perl
use DBI;
my ($db, $user, $pw) = ('dbname', '****', '***********');
my $dbh = DBI->connect("DBI:mysql:$db",$user,$pw) or die "Cannot connect to $db: $DBI::errstr

[code].....

The error message is

[Wed Feb 24 13:03:27 2010] myscript.cgi: DBD::mysql::st execute failed: Column count doesn't match value count at row 1 at myscript.cgi. [Wed Feb 24 13:03:27 2010] myscript.cgi: DBI::db=HASH(0x8a30c60)->errstr

View 2 Replies View Related

General :: Sort The 3rd Column In A Table Numerically

Jun 22, 2010

i wanna sort the 3rd column in a table numerically ( no actual borders...only tabs seperating the columns)
it should be something like this but i cant get it right

Sort -u +1 -3 results

the file is called results

View 7 Replies View Related

Server :: Mysql 'Table 'mysql.user' Doesn't Exist'?

Aug 2, 2010

I'm trying to setup wordpress on my server, which of course I need mysql for. I setup a database the other day, which worked perfectly, but I had to start again as I put some information in wrong. Now, I can create a database fine, but when I run

Code:
GRANT ALL ON wordpress.* TO wordpress@localhost IDENTIFIED BY "password";
I get the output:

[code]...

View 13 Replies View Related

Programming :: Loading Multiple Page Versions With PHP And MySQL?

Jun 18, 2011

I have a page which is going to be internationalized, and available in more languages. It contains PHP scripts to load, let's say, current user's data from database and the internationalized content itself, like "Welcome user" message. The problem for me is the fact, that internationalized content is not continual, and it's all over the page mixed with php scripts.

I don't want to use eval(). I've got 2 , they are, however, not good enough. 1. One file per language version, with scripts included - there will be many languages, so there would have to be many files with redundant data. Also if I wanted to change structure of script, I would have to change it in all pages. 2. Load international data from db, while scripts are on the page - not sure about good database structure I mean, how would I get the right content from database? (content would be split into rows, columns, or something?)

View 8 Replies View Related

Software :: Completely Emptying Column In MySQL

Mar 25, 2010

I have a database with the following table (see below). What I need to do is to empty the itype column completely, so that if I do a Select itype from items; it will return empty set. I have tried dropping and recreating the itype column, but it just adds the data I want to insert to the end, and even when I recreate it, it is not empty.. I need to overwrite it, or better, start with an empty column.

mysql> desc items;
+----------------------+--------------+------+-----+-------------------+----------------+
| Field | Type | Null | Key | Default | Extra |
+----------------------+--------------+------+-----+-------------------+----------------+
| itemnumber | int(11) | NO | PRI | NULL | auto_increment |
| biblionumber | int(11) | NO | MUL | 0 | |
| biblioitemnumber | int(11) | NO | MUL | 0 | |
| barcode | varchar(20) | YES | UNI | NULL | |
| dateaccessioned | date | YES | | NULL | |
| booksellerid | mediumtext | YES | | NULL | |
| homebranch | varchar(10) | YES | MUL | NULL | |
| price | decimal(8,2) | YES | | NULL | |
| replacementprice | decimal(8,2) | YES | | NULL | |
| replacementpricedate | date | YES | | NULL | |
| datelastborrowed | date | YES | | NULL | |
| datelastseen | date | YES | | NULL | |
| stack | tinyint(1) | YES | | NULL | |
| notforloan | tinyint(1) | NO | | 0 | |
| damaged | tinyint(1) | NO | | 0 | |
| itemlost | tinyint(1) | NO | | 0 | |
| wthdrawn | tinyint(1) | NO | | 0 | |
| itemcallnumber | varchar(30) | YES | | NULL | |
| issues | smallint(6) | YES | | NULL | |
| renewals | smallint(6) | YES | | NULL | |
| reserves | smallint(6) | YES | | NULL | |
| restricted | tinyint(1) | YES | | NULL | |
| itemnotes | mediumtext | YES | | NULL | |
| holdingbranch | varchar(10) | YES | MUL | NULL | |
| paidfor | mediumtext | YES | | NULL | |
| timestamp | timestamp | NO | | CURRENT_TIMESTAMP | |
| location | varchar(80) | YES | | NULL | |
| onloan | date | YES | | NULL | |
| cn_source | varchar(10) | YES | | NULL | |
| cn_sort | varchar(30) | YES | | NULL | |
| ccode | varchar(10) | YES | | NULL | |
| materials | varchar(10) | YES | | NULL | |
| uri | varchar(255) | YES | | NULL | |
| itype | varchar(10) | YES | | NULL | |
| more_subfields_xml | longtext | YES | | NULL | |
| enumchron | varchar(80) | YES | | NULL | |
| copynumber | varchar(32) | YES | | NULL | |
+----------------------+--------------+------+-----+-------------------+----------------+
37 rows in set (0.05 sec)

View 4 Replies View Related

Fedora Servers :: FC5 > F12 - ERROR: Column Count Of Mysql.db Is Wrong

Jan 31, 2010

Target F12 mysql - 5.1.42-2
Source FC 5 mysql - 5.0.27-1

I've put SElinux into permissive mode as it was practically denying anything that moved. Both installed from the standard repos. I used mysql-administrator to create a backup of the FC5 server (all databases/tables) and transferred it to the new system. I restored it onto that machine and double checked that my standard admin user (full privs) was present and let me log in to make changes. All good so far.

So I copied over my files from my sites, point a browser at them and I get nothing, not even errors. Now it's a long while since I set the original up and have probably forgotten something simple but despite making the error output more verbose I can't seem to track anything down other than:

[Code]....

So it suggests my tables are invalid/trashed but I can't seem to figure out why. The original server is still running happily so I'm not in any rush to fix this, I'll keep plodding, Phpinfo reveals a normal operational php setup, so i think that side of the sites is functional. Apache test pages work on blank virtual hosts but viewing my sites reveals the favicon working fine but otherwise comepletely blank pages (zero output, even source). I tried running the page as a raw CLI input to the php package using php index.php and php returned nothing, logged nothing unusual but sat with my CPU at 100%, unsure if that is related.

View 1 Replies View Related

Ubuntu Servers :: Build Form On MySQL To Set Values

Sep 11, 2010

Is there a way to build a form so an admin can enter and add values to a database:
Example
Code:
use squid
insert into passwd values('testuser','test',1,'Test User','for testing purpose');
Is there a free software or an easy to configure script?

View 6 Replies View Related

General :: Transpose Multiple Rows Into A Single Column?

Apr 7, 2011

I need to transpose a file with over a 1000 rows of 5 columns of numbers into a file with a single column of numbers. The numbers are separated by a single space and range from one digit to 5 digits each. I tried using awk, but can only get it to grab one column of numbers.

Input:

1 2 3 4 50
600 7 8 9000 10
11 12000 13 14 15

Desired output:

1
2
3
4

[code]....

Tried using: awk '{split($0,a,""); print $NF}' <filename> and got:

50
10
15

It only grabbed the last number in each row.

View 13 Replies View Related

Ubuntu Networking :: MySQL Gammu - Unknown Column Signal In Field List

Feb 12, 2011

I seemed to configure my gammu and changed the version indicated version on my gammu table from 10 to 11 to match the version of my sql, upon starting my gammu-smsd the error:
gammu-smsd[3429]: Error code: 1054, Error: Unknown column 'Signal' in 'field list'
gammu-smsd[3429]: Error code: 1054, Error: Unknown column 'Signal' in 'field list'
gammu-smsd[3429]: Error code: 1054, Error: Unknown column 'Signal' in 'field list'
Kept on repeating on an infinite loop

View 3 Replies View Related

Red Hat / Fedora :: Bash - Echo Multiple Numeric Values On One Line

Aug 9, 2009

I'm trying to get multiple numeric valued version information into a variable, all on the same line. I want for example $VERSION=3.1.0.01.002. I'm trying to pull seperate values from the file named version.properties, wherein the file contains;

patch.rel.num=0
sqa.num=01
major.rel.num=3
build.num=002
minor.rel.num=1

So I have the following script:
#!/bin/bash
BUILDVERFILE="version.properties"

PATCH=`grep "patch.rel.num" ${BUILDVERFILE} | awk {'print $1'}`
SQA=`grep "sqa.num" ${BUILDVERFILE} | awk {'print $1'}`
MAJOR=`grep "major.rel.num" ${BUILDVERFILE} | awk {'print $1'}`
BUILD=`grep "build.num" ${BUILDVERFILE} | awk {'print $1'}`
MINOR=`grep "minor.rel.num" ${BUILDVERFILE} | awk {'print $1'}`

P=`echo $PATCH | tr -d .=[:alpha:]`
S=`echo $SQA | tr -d .=[:alpha:]`
MA=`echo $MAJOR | tr -d .=[:alpha:]`
B=`echo $BUILD | tr -d .=[:alpha:]`
MI=`echo $MINOR | tr -d .=[:alpha:]`

VERSION=$MA.$MI.$P.$S.$B
echo $VERSION #

I end up with the value of .002 ?? Seems like it's only getting the last portion because if I run the script thru "bash -x" I get:
...
+ VERSION=$'3
.1
.0
.01
.002
'
+ echo $'3
.1
.0
.01
.002
'
.002

View 7 Replies View Related

Server :: Replicate 1 Table In Mysql To Different IP?

Aug 7, 2009

I have 2 servers, 1 running a web server on 1 IP address,the other server running a proxy on a different IP address. I intend to change and update the ncsa file with usernames and passwords from a mysql table.Is there a way to replicate 1 table from the webserver to the proxy server databases and then run a cronjob? The cron will simply delete unused usernames and add new ones.Is there a better way of doing this? I don't want to run the webserver on the proxy server for security and also for performance.

View 2 Replies View Related

General :: Custom TCP Parameters For Multiple Interfaces - Change The Default Values

Feb 16, 2011

My question is about TCP parameters in Linux. By now, I want to change the default values of:

Initial Timeout
ACK Delay
Idle Connection Timeout

I have a Linux Box with kernel 2.6.x and 2 ethernet interfaces. I know TCP is a stack that doesn't have anything to do with ethernet devices. Said that, the question: is there a way to set custom values for each interface? For example, a server listening to connections in eth0 would use one value for Idle Connection Timeout and another server listening to connections in eth1 could use a different value for that parameter.

View 4 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved