09-17-2010
We have billions of MySQL queries per month in these forums.
When the logic is in PHP, all is generally well. When the DB logic is complex, we tend to have problems.
There is a huge difference in theory and practice.
Generally speaking, keeping thing simple and stupid (the KISS principle) wins over complexity and clever most every time.
Of course, "to each his own" as they say. I am only talking from my experience of running a lot of third party MySQL/PHP code and what I find best and easiest to debug when a problem arises.
8 More Discussions You Might Find Interesting
1. Programming
Hello,
I have three tables.
I need an SQL query (preferably Sybase) that will return all of the stringID values of table B where the following conditions exist:
(1) B.intID = A.intID
(2) B.intID != C.intID
or (B.intID = C.intID and
(C.v1 = 0 or C.v2... (2 Replies)
Discussion started by: chatieremerrill
2 Replies
2. Programming
Hi there,
I have a hierarchical database that include 4 tables. Table A is the parent of B, B is Parent of C, C is parent of D. If I want to query everything in D that is associated with A.name, how do I do that? Thanks!
YanYan (0 Replies)
Discussion started by: pinkgladiator
0 Replies
3. Web Development
hello all
i have 2 columns every column in the following format
column1
2011-04-01 11:39:54
column2
2019-02-03 00:00:00
i want get difference between above data as following
2 days 11:39
how to do so ?
i tried many functions but nothing works
please advice what is the query... (6 Replies)
Discussion started by: mogabr
6 Replies
4. Shell Programming and Scripting
A file whose location i am not aware of contains the below text
<url>jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS_LIST=(FAILOVER=on)(ADDRESS=(PROTOCOL=TCP)
(HOST=ngm2sn1p2-vip.mybank.net)(PORT=4001))(ADDRESS=(PROTOCOL=TCP)(HOST=ngm2sn2p2-vip.mybank.net)... (1 Reply)
Discussion started by: mohtashims
1 Replies
5. Programming
Hello
i have created mysql query to compare to values and get difference in percentage
as following:
SELECT file_name, 100 - ((100 * (SELECT file_count FROM xipi_files z WHERE x.file_group = z.file_group AND x.file_name = z.file_name AND z.insert_date = CURDATE( ) - INTERVAL 1 DAY)) /... (1 Reply)
Discussion started by: mogabr
1 Replies
6. Shell Programming and Scripting
Hi,
I wish to find the latest occurance of the below string in my log file.
Once found, I need to search the below string after the above string
and display this
Request 331489 has passed
or
Request 331489 has failed
I would like my query to be platform... (11 Replies)
Discussion started by: mohtashims
11 Replies
7. Shell Programming and Scripting
Hi,
I provide the path to a folder.
I would like so drill in each folder inside the folder i gave and show me the size in human readable form du -sh <folder-name> of the top 8 folders with maximum sizes.
For example:
Path of the folder: "/opt/app/myapp" has these directories.
ls... (2 Replies)
Discussion started by: mohtashims
2 Replies
8. Programming
Hi All,
i have a table in mysql with the following data
Table name Test
Assettype Serial_No Status location
Mouse 123456 In Stock chennai
Mouse 98765 Allocated chennai
Keyboard ... (2 Replies)
Discussion started by: venkitesh
2 Replies
LEARN ABOUT PHP
mysql_errno
MYSQL_ERRNO(3) 1 MYSQL_ERRNO(3)
mysql_errno - Returns the numerical value of the error message from previous MySQL operation
SYNOPSIS
Warning
This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQL extension should
be used. See also MySQL: choosing an API guide and related FAQ for more information. Alternatives to this function include:
omysqli_errno(3)
o PDO::errorCode
int mysql_errno ([resource $link_identifier = NULL])
DESCRIPTION
Returns the error number from the last MySQL function.
Errors coming back from the MySQL database backend no longer issue warnings. Instead, use mysql_errno(3) to retrieve the error code. Note
that this function only returns the error code from the most recently executed MySQL function (not including mysql_error(3) and
mysql_errno(3)), so if you want to use it, make sure you check the value before calling another MySQL function.
o $
link_identifier -The MySQL connection. If the link identifier is not specified, the last link opened by mysql_connect(3) is
assumed. If no such link is found, it will try to create one as if mysql_connect(3) was called with no arguments. If no connection
is found or established, an E_WARNING level error is generated.
Returns the error number from the last MySQL function, or 0 (zero) if no error occurred.
Example #1
mysql_errno(3) example
<?php
$link = mysql_connect("localhost", "mysql_user", "mysql_password");
if (!mysql_select_db("nonexistentdb", $link)) {
echo mysql_errno($link) . ": " . mysql_error($link). "
";
}
mysql_select_db("kossu", $link);
if (!mysql_query("SELECT * FROM nonexistenttable", $link)) {
echo mysql_errno($link) . ": " . mysql_error($link) . "
";
}
?>
The above example will output something similar to:
1049: Unknown database 'nonexistentdb'
1146: Table 'kossu.nonexistenttable' doesn't exist
mysql_error(3), MySQL error codes.
PHP Documentation Group MYSQL_ERRNO(3)