Programming :: PHP / MySQL Statement - Query Result
Jan 29, 2011
It is under PHP/MySQL
$queryresult = $conn->query("INSERT INTO normalrequests VALUES($finalkey, 1234, 5678, FALSE)");
It is connected to the database successfully but I feel there is something wrong with the statement up there.
View 6 Replies
ADVERTISEMENT
Oct 17, 2010
I am not sure if this is possible. I have IP's stored in a mysql database. When I query the database, it returns the IP. I would like to replace the IP with something else prior to displaying the results. Is it possible even though I have not stored it in the database?
I have the following in a while loop (mysql_fetch_array).
Code:
<td align="left">' . $row[IP] . '</td>
Instead of displaying $row[IP] from the database, I would like it to display something else which I define in the PHP code but based on the IP.
ie. aaa.bbb.ccc.ddd = hostnameABC
View 4 Replies
View Related
Apr 26, 2010
I have created a database which stores students grades for different stages of a project. One of the stages of the project is the specification part. I have a simple bit of html code which is going to be used as the searching facility. I want the user to be able to enter their ID and then it will display only their results. At the moment, it is displaying the results for EVERY student because I cant seem to find the correct syntax for my statement.
Heres the HTML code
<html>
<head>
</head>
<body>
<body bgcolor="#6881bb">
<center>
[Code]....
At the moment when i click the button, no matter what I enter every students marks appear on the screen.
I think, but obviously dont know for sure because if i did i would know how to solve the problem, the code that i need to change is in green.
View 3 Replies
View Related
Jul 12, 2011
When i enter this query to mysql:
Code:
return this error:
Code:
when i delete the insert part :
Code:
query is ok:
Code:
1 row in set (0.00 sec)
View 2 Replies
View Related
Dec 2, 2010
Trying to export a Mysql query to a .csv file the query draws from multiple tables, e.g. sales, purchase and currency
Code:
What i'm trying to do is to export both the sales and purchase to a single line where both the currency for the sales and the purchase is specified.
Basically like this:
Code:
Problem here is that i'm stating currency.value twice in the same select and don't know how to define which currency.value applies to sales and which to purchase.
View 7 Replies
View Related
Jul 27, 2010
i will be quick, im trying to send a mysql query output into an array ie:
Code:
declare -a HD
HD=`echo "USE db; SELECT uid FROM user" | mysql -u $login -p$pwd -h $dbhost -B`
echo ${#HD}
those vars in mysql connection are previously and correctly assigned.
but got an error
script.sh: 2: declare: not found
View 3 Replies
View Related
Sep 15, 2010
I am querying a single string column in a table. The string values have spaces in them. I want to loop over each value in bash. I set IFS to split lists on newlines instead of spaces. When I try this, it is splitting the list of results on the actual character 'n', not the newline ''.
DATA=`mysql -u root -ppassword --silent 'SELECT name FROM table_a;'`
IFS=$'
'
for i in $DATA; do
echo "item = $i"
[Code]....
View 5 Replies
View Related
Feb 22, 2011
So I've got a rather vast database, one of the columns is date in the following format: DD/MM/YY HH:MM:SS. This is starting to cause problems with a php page I'm writing which asks the user for a 'start date'. Would it be better for me to split the date column into date and say time? Or is there a way of using distinct and masking the times.
View 10 Replies
View Related
Jun 28, 2010
We are building our C++ project in Kdevelop IDE. Every time we run "Run Configure" from the "Build" menu, a file named "libtool" gets automatically generated. This file contains a statement as "ECHO="echo"".f we run "Automake", without modifying the "libtool" the system hangs and theputer needs to be restarted.Therefore every time we run "Run Configure" we need to include the line "echo="echo"" below the statement "ECHO="echo"" manually.I think a script can be written which does the above on its own.I am not a shell script programmer, I know the good tutorials for shell scripts are available on the net, but learning scripting only for this task would be time-consuming and painful.
View 4 Replies
View Related
May 25, 2011
I am connecting to MySQL DataBase using shellscript and writing a select statement like select attachmentid from attachments where pageid=10175 I want to store the output of the select statement into a shellvariable or a file. How can i do it using shellscript.
View 4 Replies
View Related
Oct 6, 2010
I've written a simple perl code to learn switches in perl.My code is pasted below,
#!/usr/bin/perl
$opt = 1;
switch($opt) {
[code]...
View 3 Replies
View Related
Apr 14, 2011
Can query browser be installed in 11.4??
I've tried to use workbench but it's such a big step backwards in that you can't easily edit the output from a "select x,y,z from table" query. I'd have thought that was a pretty basic requirement...
View 5 Replies
View Related
Sep 21, 2010
I have the following mysql query which works great.
Code:
SELECT msg FROM `logs` WHERE ((`host` = 'aaa.bbb.ccc.ddd') OR (`host` = 'aaa.bbb.ccc.ddd')) AND `msg` REGEXP CONVERT( _utf8 'physical addresses' USING latin1 ) COLLATE latin1_swedish_ci
I need to refine this query so that I can query the last # hours using the `datetime` field in the database. I have researched the DATE_SUB function and can query for example the last 1 hour like this:
[Code]....
View 10 Replies
View Related
Jan 17, 2011
I am on a CentOS 64 bit and used webmin to rotate MySQL slow query log. Now the thing is although logs are being rotated daily but the new log files being created are empty which means MySQL is unable to write them due to some reason. I have checked using "ls -l" that both permission and owner of files is same but still MySQL is not writing logs. What could be the reason?
View 10 Replies
View Related
Jan 28, 2010
i have MySQL on my CentOS server and have installed it and got it up and running through the command line.
I have changed root's username and password so there is no user called 'root' anymore. I also created a database called pancakes.Now when i try to log in using Query Browser, i put the server's IP in 'hostname', my new roots username and password in 'username' and 'password'.When i try to log in it gives me error 1130 and says connection from myhostname not allowed.
View 6 Replies
View Related
Mar 17, 2011
I want to install mysql query browser in debian
View 1 Replies
View Related
Aug 31, 2010
I am using MySQL 5.0.77 Version rpm on CentOS 5 Red Hat Linux. I want to install micro second slow query log patch on this MySQL S/W version.As I found the slow query micro second patch on percona site i.e. [URL]step by step to install above mentioned patch with rpm based MySQL installation? Do we need MySQL source files to apply patch ?
View 13 Replies
View Related
Jan 16, 2011
Does anyone know where I can get a link to download MySql query browser(windows version)?
I want to query my database on my fedora box in windows to make life easier... I can not seem to find a link to download the query browser though
View 2 Replies
View Related
Nov 17, 2010
I am running Ubuntu 10.04 LTS. I am trying to run a query browser for mysql but keep receiving the following error:
X11 connection rejected because of wrong authentication.
The application 'mysql-query-browser-bin' lost its connection to the display localhost:10.0; most likely the X server was shut down or you killed/destroyed the application.
In ssh_config, I do have ForwardX11 set to yes.
View 4 Replies
View Related
Mar 1, 2011
I need help about the error in my website. I have the following error....
Code:
user warning: Got error 134 from storage engine query: SELECT data, created, headers, expire, serialized FROM cache WHERE cid = 'theme_registry:database1' in /var/www/html/web/includes/cache.inc on line 26.
View 2 Replies
View Related
Jul 9, 2010
I am trying to create a script to be used on RHEL server. If I replace the $t with a number, the script works. If I try add a variable or the $1, the script doesn?t work (returns all processes even if less than the $t value). I thought that it may be treating it as a literal, but I wasn?t sure of the conversion.
t=$1
echo $t
lcnt=`ps -eo pid,ppid,rss,vsize,pcpu,pmem,cmd -ww --sort=pid | awk '{if ($6 > $t) print
[code]...
View 2 Replies
View Related
Aug 12, 2009
When you use an if statement directly in bash you have to put the ";" at the end or not? or am I mixing it with the for loop? I am reading advance bash scripting and it shows the if - then statements without ";" so I need a little clarification here.
View 2 Replies
View Related
Sep 14, 2010
I have a site which will have, for example, a login system where people have to enter their usernames and passwords, depending on which they'll be let in to the site. So, in code, I've got a line like:
if ($_POST['password'] == $password) {
then do whatever
}
else { print "Wrong password" ; )
My problem is, this "Wrong password" printing is just a solitary line, not keeping with the colours and style of the site, and it looks very bad. I want to ideally, output some HTML, which will have a picture, and print the "Wrong password" in the font and colours I desire. Do I have to put all the HTML in a print statement, and then deal with the nightmare of escaping all the quote marks in it with a ""? Or is there a cleaner method to the whole thing? Maybe something like this -
if ($_POST['password'] == $password) {
then do whatever
}
[code]....
View 4 Replies
View Related
Sep 21, 2010
I'm trying to code a sql statement for use in a PHP script.I'm looking to find the number of matching records in two tables and display them.How would you write that statement.I've tried using count a few ways, but no cigar.
View 2 Replies
View Related
Jun 9, 2010
the following works and BASH doesn't complain, but VIM highlights the closing square bracket is if it sees a syntax error. Is there a better way to express regex in a case statement or is this an issue with VIM?
Code:
#!/bin/bash
case $1 in
[code]...
View 3 Replies
View Related
Jan 23, 2010
Does it possible to escape * in the case statement
Code:
View 2 Replies
View Related
Jun 7, 2010
The script that Iam trying to write is running a for loop and reading line by line from a text file. inside this for loop i would like to execute update SQL statement .
a pesudo code is
Quote:
`$ISQL -U $username -P $Password -D $Dbname -I $INTERFACE <<QRY
for id in $idlist #idlist iam reading from a file
[code]...
View 8 Replies
View Related
Oct 6, 2010
This script that I found online does the job it promises. it does convert the files to mp3 without an issue. What I need to include now is an if statement that says If $file.mp3 exists then delete $file.wav
Code:
#!/bin/sh
# name of this script: wav2mp3.sh
# wav to mp3
# Credit to the script creator (Nikesh Jauhari):
[Code]...
After that I'm stumped as to how to do the if statement
View 14 Replies
View Related
Aug 7, 2010
I've started dabbling with the case statement in order to pass some option's arguments into variables. I do not think I am doing this right.
Code:
usage() {
echo "Usage: $0 [-z|--snooze] [-c|--channel] [-p|--playlist]
[-m|--message] [-v|--mpcvolume]"
[code]....
As you can see, I want to pass arguments depending on the option(s) chosen by the user; ie. --snooze, or --channel. By default, if no options are chosen, I'll display a usage message; though in the future I'll provide some sane defaults. I'd like to create a case statement to handle passing arguments to any number of options; something like:
Code:
wakethehellup.sh --snooze 20 --message 'wake up!'
and for the other arguments, it would have a default set. The case statement I provided fails with a syntax error "syntax error near unexpected token `$2'" near the '--snooze' in the statement, so I take it you can't pass a parameter in this way; but I'm confused as to how I'm supposed to pass different parameters to different options without the options being confused as parameters.
View 2 Replies
View Related
Apr 8, 2011
I want to match for this string:
Code:
Content-Transfer-Encoding:[:space:]base64
Content-Disposition:[:space:]attachment;[:space:]filename="%variable%"
Both lines are new lines, so they won't be inline. Other than that, they are all constants, I want this regex match to be an if statement rather than returning match string. so if the $content variable contains some string that matches:
Code:
if `sed "//p"` ;
View 4 Replies
View Related