Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Variable definition inside mysql query Post 303034941 by RudiC on Thursday 9th of May 2019 03:51:22 PM
Old 05-09-2019
Quote:
Originally Posted by baris35
...
.....WHERE url = 'http://localhost/test/" $1 ".mkv';"}
...
I was about to ask why you were using the LIKE condition...



Quote:
I did not tell it to read video_id where $1 matches.
No? What is the result of these selects:

Code:
SELECT  video_id FROM video_series_files WHERE url = 'Mr.Smith.Goes.to.Washington.mkv';
SELECT  video_id, 'sub', 'custom' FROM video_series_files WHERE url = 'Mr.Smith.Goes.to.Washington.mkv';
 SELECT '.105.', video_id, 'sub', 'custom', 'http://localhost/test/Mr.Smith.Goes.to.Washington.en.srt', 'a:1:{i:0;s:2:"en";}', '', '1', '1' FROM video_series_files WHERE url = 'Mr.Smith.Goes.to.Washington.mkv';

 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

What wrong with the variable definition

i am using the below script and trying to move files in that directory in that pattern to archive. But it doesn;t seem to take the metacharacters. Please sugggest. Code Debug output: (1 Reply)
Discussion started by: dsravan
1 Replies

2. Shell Programming and Scripting

Passing a variable from shell script to mysql query?

I heard this was possible but from my research I haven't been able to figure it out yet. Seems it should be simple enough. Basically from a high level view I'm trying to accomplish... . $X='grep foo blah.log' then 'mysql command SELECT foo FROM bar WHERE ' . $X or something like that. ... (2 Replies)
Discussion started by: kero
2 Replies

3. Shell Programming and Scripting

variable inside variable inside loop headache

Hi Gurus I have a file called /tmp/CMDB which looks like this serial: 0623AN1208 hostname: server1 model: x4100 assetID: 1234 I am writing a for loop that will go through this file line by line creating a variable of itself. Using the first iteration of the loop (i.e. the first line) as... (6 Replies)
Discussion started by: hcclnoodles
6 Replies

4. Shell Programming and Scripting

How to define a variable with variable definition is stored in a variable?

Hi all, I have a variable say var1 (output from somewhere, which I can't change)which store something like this: echo $var1 name=fred age=25 address="123 abc" password=pass1234 how can I make the variable $name, $age, $address and $password contain the info? I mean do this in a... (1 Reply)
Discussion started by: freddy1228
1 Replies

5. Shell Programming and Scripting

bash assign mysql query single field to variable

I'm running a bash script query and assigning the output to a variable like this: exists=`mysql -u $USER_NAME --password=$PASSWORD -D "somedb" \ -e "SELECT * FROM somedb.sometable WHERE field1 ='$a' \ AND field2 ='$b' LIMIT 0 , 30";` which returns something like: echo... (2 Replies)
Discussion started by: unclecameron
2 Replies

6. Shell Programming and Scripting

Using a shell script variable in a mysql query using 'LIKE'

Hello. I am writing a simple script that reads a text file and removes records from a mysql database. The items in the text file are of the format: firstname.middle.lastXXX, where XXX is a 3 digit number. The table has an email field that will match the firstname.middle.last. So, I thought I... (1 Reply)
Discussion started by: bricoleur
1 Replies

7. UNIX for Dummies Questions & Answers

What is inside the definition of Unix?

Is FreeBSD and OpenBSD considered Unix? What O.S does Most of the forum members use? How popular are Licensed Unix operating systems for home users? Additionally I thought Linux was a Minux fork and BSD was a Unix fork. Thanks in ... (7 Replies)
Discussion started by: theKbStockpiler
7 Replies

8. UNIX for Advanced & Expert Users

Variable definition

Hi all, I'm bit new to the advanced bash shell scripting. When I'm looking at some of the existing code in my organization, got confused with a few variable definings. For ex: var1={1:-30} var2="abc def ghi" var3={xyz:-$var2} In above, 1st and last lines are confusing me.... (4 Replies)
Discussion started by: raghu.iv85
4 Replies

9. UNIX for Dummies Questions & Answers

Environment variable definition

I'm a bit confused about the term ‘environment variables'. Within your shell you can set two types of variables: 1. Shell variable - affecting functionality within your shell 2. User defined variable When using the ‘export' command on a variable you make sure it's being inherited by new sub... (2 Replies)
Discussion started by: niels
2 Replies
MAXDB_FETCH_OBJECT(3)							 1						     MAXDB_FETCH_OBJECT(3)

maxdb_fetch_object - Returns the current row of a result set as an object

       Procedural style

SYNOPSIS
object maxdb_fetch_object (object $result) DESCRIPTION
Object oriented style object maxdb_result::fetch_object (void ) The maxdb_fetch_object(3) will return the current row result set as an object where the attributes of the object represent the names of the fields found within the result set. If no more rows exist in the current result set, NULL is returned. RETURN VALUES
Returns an object that corresponds to the fetched row or NULL if there are no more rows in resultset. Note Field names returned by this function are case-sensitive. Note This function sets NULL fields to the PHP NULL value. EXAMPLES
Example #1 Object oriented style <?php $maxdb = new maxdb("localhost", "MONA", "RED", "DEMODB"); /* check connection */ if (maxdb_connect_errno()) { printf("Connect failed: %s ", maxdb_connect_error()); exit(); } $query = "SELECT name, state FROM hotel.city ORDER by zip"; if ($result = $maxdb->query($query)) { /* fetch object array */ while ($obj = $result->fetch_object()) { printf ("%s (%s) ", $obj->NAME, $obj->STATE); } /* free result set */ $result->close(); } /* close connection */ $maxdb->close(); ?> Example #2 Procedural style <?php $link = maxdb_connect("localhost", "MONA", "RED", "DEMODB"); /* check connection */ if (maxdb_connect_errno()) { printf("Connect failed: %s ", maxdb_connect_error()); exit(); } $query = "SELECT name, state FROM hotel.city ORDER by zip"; if ($result = maxdb_query($link, $query)) { /* fetch object array */ while ($obj = maxdb_fetch_object($result)) { printf ("%s (%s) ", $obj->NAME, $obj->STATE); } /* free result set */ maxdb_free_result($result); } /* close connection */ maxdb_close($link); ?> The above example will output something similar to: New York (NY) New York (NY) Long Island (NY) Albany (NY) Washington (DC) Washington (DC) Washington (DC) Silver Spring (MD) Daytona Beach (FL) Deerfield Beach (FL) Clearwater (FL) Cincinnati (OH) Detroit (MI) Rosemont (IL) Chicago (IL) Chicago (IL) New Orleans (LA) Dallas (TX) Los Angeles (CA) Hollywood (CA) Long Beach (CA) Palm Springs (CA) Irvine (CA) Santa Clara (CA) Portland (OR) SEE ALSO
maxdb_fetch_array(3), maxdb_fetch_assoc(3), maxdb_fetch_row(3). PHP Documentation Group MAXDB_FETCH_OBJECT(3)
All times are GMT -4. The time now is 10:41 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy