I'm running Windows, having installed IIS 7.5, PHP 5.3 (FastCGI). Trying to connect to MySQL and getting an error "A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.".
Started to develop a project with XA...
how can I count duplicates rows wihtin select statement
here is my table
name food
A Apple
B Banana
A Banana
C Apple
Result should be like this:
name food count
A apple (2)
B Banana (1)
A Bananaa (2)
C Apple (1)
I need a third coloumn in result set which value will be count (Name)
Thanks ...
I wrote this code:
<?php
mysql_connect("localhost", "root", "root") or
die("Could not connect: " . mysql_error());
mysql_select_db("internal");
$result = mysql_query("SELECT Title, Message FROM msg");
?>
<?php
while ($row = mysql_fetch_array($result, MYSQL_NUM)){
?>
<div>
<h3><a href="#"><?php printf("%s", $row[0...
I have a table with a column containing text, and I want to select all of the tables where the text from one of the rows in a second table appears in that row. Here is a pseudo-query:
SELECT title FROM recipes AS r
JOIN ingredients AS i
ON r.ingredients LIKE '%' + i.name + '%';
The above query does not work, however. How do I ...
I am looking up which exchange services which telephone numbers, from a table of fragmentary numbers that show which exchange services them.
So my table contains, for example:
id |exchcode |exchname |easting|northin|leadin |
-----------------------------------------------------------------
12122 |SNL/UC |SANDAL ...
I'm writing an app which should take a sql file generated from mysqldump and import it into a mysql database. Is there a way to do this from ADO.NET or do I need to use the mysql cli?
...
I have a field in MySQL as varchar and need to do a select with a range. The date is in the following format "%m/%d/%Y" (Ej. 10/14/2010).
...
When I run the code below inside phpmyadmin I get an error "Undefined Variable tmpportfolio"
what is the problem?
SQL:
CREATE TEMPORARY TABLE tmpportfolio (p_name VARCHAR(255),portfolio_id INT UNSIGNED NOT NULL);
SELECT p_name, portfolio_id INTO tmpportfolio
FROM portfolio
WHERE parent_portfolio_id IS NULL
AND portfolio_i...
I have three tables:
table "package"
-----------------------------------------------------
package_id int(10) primary key, auto-increment
package_name varchar(255)
price decimal(10,2)
table "zones"
------------------------------------------------------
zone_id varchar(32) primary key (ex of data: A1,...
I have a products table in a mysql.sql file. I wish to extract that one table and place it in it's own file. How would you go about doing this?
...
a href="deleteresnext.php?rid=< ?php echo $row->rid ?>" onclick="return confirm('Are you sure you want to cancel reservation?');" >Delete
can i retrieve 2 values using this code ? because i need it to another php file, i would like to retrieve rid and roomid by the code above ?
need help urgent and thanks
-renz
...
Has anyone used the Joomla banner Ads know how to make the Ads Rand() and DISTINCT.
Everything I've tried to change on the banner.php page is not working. Here is what the code looks like. The images will Rand() just fine but they show up in duplicates.
$query = "SELECT *"
. ($randomise ? ', RAND() AS ordering' : '')
. ' FROM #__banner...
We add tags to our news posts (we use our own CMS), and I'd like to pull 5 related stories depending on what tags are used for an individual story. We have tags in the database seperated by spaces, so I use this code to get the tags into an array
$tags = explode(" ", $tags);
Now that we have the tags in an array, I want to use them t...
Does anyone know why latin1_swedish is the default for MySQL. It would seem to me that UTF-8 would be more compatible right?
Defaults are ussually chosen because they are the best universal choice, but in this case it does not seem thats what they did.
...
Using PHP and MySQL I'm trying to select unique values from multiple columns in a table (but not all the columns in the table) and put all the unique values from each column selected in its own array. The uniqueness of each columns values should be compared only to other values in the same column.
The code below puts all the unique valu...
I have an unnormalized table with a column containing a comma separated list that is a foreign key to another table:
+----------+-------------+ +--------------+-------+
| part_id | material | | material_id | name |
+----------+-------------+ +--------------+-------+
| 339 | 1.2mm;1.6mm | | 1 | 1.2mm |
| ...
I have four tables, user, user_billingprofile, user_shippingprofile, and user_address.
user: userId, dateCreated
user_billingprofile: userId, address
user_shippingprofile: userId, address
user_address: random address crap
Here is the query I have to get a users billing and shipping profiles in one shot.
SELECT * FROM `user`
JOIN `us...
PHP:
<?php
if (isset($_POST['name'])){
mysql_connect("localhost", "db", "test") or die(mysql_error());
mysql_select_db("db") or die(mysql_error());
$tmp = mysql_query("SELECT commercial FROM Channels WHERE name='.$_POST[name].'");
echo $tmp[0];
}
else
{
?>
<form method="post" action="<?php echo $_SERVER['PHP_SELF'];?>">
<input name=...
Hi,
Within one of our systems we have an option that switches the search system between a LIKE search, or a FullText search with either IN BOOLEAN MODE or WITH QUERY EXPANSION
For some reason, the FULLTEXT index was missing but when the system was set to be IN BOOLEAN MODE the query still worked, in the case of WITH QUERY EXPANSION the ...
Command that provides mysql server information?
what are properties of myisam dynamic row format?
what is the maximum value allowed for tinyint(2)
...