PHP I am trying to retrieve data from database and put it into SELECT option to edit the value of datafields ?

Posted by admin on October 29th, 2009 and filed under select into | 3 Comments »


To edit a value (field), you don’t use "select", but "update"!
ie
$sql = "update `tablename` set `fieldname` = ‘".$newvalue. "’ where `otherfield`= ‘".$value."’" limit 1";

MYSQL and PHP why are my records displaying twice?

Posted by admin on October 29th, 2009 and filed under subquery | 2 Comments »

View the page and source at:

http://nlmphotography.net/MAIN/news/news.php

[CODE]<?php

header("Content-type: text/xml");

$host = "xxxx";
$user = "xxxx";
$pass = "xxxx";
$database = "xxxx";

$linkID = mysql_connect($host, $user, $pass) or die("Could not connect to host.");
mysql_select_db($database, $linkID) or die("Could not find database.");

$query = "SELECT DISTINCT year_id, date FROM news ORDER BY year_id";
$resultID = mysql_query($query, $linkID) or die("Data not found.");

$xml_output = "<?xml version=\"1.0\" encoding=\"iso-8859-1\" standalone=\"yes\"?>\n";
$xml_output .= "<newsmodule>\n";

while ($row = mysql_fetch_array($resultID))
{

$xml_output .= "\t<year name=\"" .date(’Y', strtotime($row[date])). "\">\n";

$year_id = $row[0];
$subQuery = "select * from news where year_id =’" .$year_id. "’ order by id DESC";
$res = mysql_query($subQuery);

while ($subRow = mysql_fetch_array($res))
{

$xml_output .= "\t\t<news>\n";
$xml_output .= "\t\t\t<date>" .date(’M d’, strtotime($subRow[date])). "</date>\n";
$xml_output .= "\t\t\t<title><![CDATA[" .$subRow["title"]. "]]></title>\n";
$xml_output .= "\t\t\t<info>\n";
$xml_output .= "\t\t\t\t<![CDATA[" .$subRow["info"]. "]]>\n";
$xml_output .= "\t\t\t</info>\n";
$xml_output .= "\t\t</news>\n";

}

$xml_output .= "\t</year>\n";

}

$xml_output .= "</newsmodule>";

echo $xml_output;

?>[/CODE]
Here is an SQL dump.

[CODE]
SET NAMES latin1;
SET FOREIGN_KEY_CHECKS = 0;

CREATE TABLE `news` (
`id` int(5) NOT NULL auto_increment,
`date` date NOT NULL,
`title` varchar(80) NOT NULL,
`info` varchar(80) NOT NULL,
`year_id` year(4) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;

insert into `news` values(’1′,’2009-04-08′,’NLM Photography is LIVE!’,'Welcome to the new website! Have a look around as more is on the way!’,'2009′),
(’2′,’2009-04-09′,’New Links added to the links!’,'Visit our web host/designer Z Web Design!’,'2009′);

SET FOREIGN_KEY_CHECKS = 1;

[/CODE]
Thanks Chris later I will be adding functions to add records.
[RESOLVED]

Code line change:

$query = "SELECT DISTINCT year_id FROM news ORDER BY year_id";

Okay first off, in an mysql_query, you dont need the $linkID unless you are changing databases, and even then you mysql_select_db. So $resultID = mysql_query($query, $linkID) or die("Data not found.") is not wholly needed, you can remove everything passes $query and then put the parenthesis ‘$resultID = mysql_query($query);’.
And since your script looks fine to me, I am guess that in your database, your news is doubled up. Since the php only activates while the database is full.. 4 instead of your desired two, i could be wrong, should mean that you have a double-up in your news table.

**And for the person who answered above, that wouldn’t be the problem. That problem would only happen if he activated BOTH of the variables, because, as you see, each mysql query is in its own separate variable**

Problems with my inner thighs?

Posted by admin on October 29th, 2009 and filed under inner join | 4 Comments »

ok ,I have problems with my inner thighs , there is some skin discolouration on my inner thighs ,where two legs join,,at the sides of my private part, and it is some kind of wet over there,because of this skin over there ,get peeled and some times ,i can see red flesh .and it burns when I pour water on it. And I began to apply powder on that area ,but no use .

Why it is caused , Due to sweat or is it some kind of infection??
Can you suggest a remedy??

i had a similar problem happen to me a few years ago. i applied peroxide on the area, it helped heal it up. the doctor also gave me a steroid cream to apply. i really didn’t use much of the cream b/c the peroxide seemed to do the job.

i’m not sure what cause my irratation. i hope this helps for you

Can anyone help me with an access database problem?

Posted by admin on October 29th, 2009 and filed under select distinct | 2 Comments »

I have a table of records that contains duplicate account numbers. The table is sorted so that the rows are grouped by account number. I need to select just the first row for each unique account number. Using DISTINCT doesn’t work because I need the whole row and each row is a little different except for the account number. FIRST also causes the same problem.
GROUP BY also doesn’t work because access forces me to group the whole row if I want to select the whole row. Because each row is a little different, except for the account number, the group by returns multiple rows with the same account number. Basically, the table is sorted and grouped by account number with the first row of each unique account number containing the most recent and must up to date information. I need to grab the data from that row and ignore each succeding row, until I get to a row with a new account number which I grab and so on…

http://www.w3schools.com/sql/sql_groupby.asp

You might also consider a WHERE clause to narrow it down

**********************************
Additional info

then dump it into a dataset with your current SQL and run a loop against the dataset to manually build a dataview to use. You can test each record’s fields to see what they have and do a compare as you loop. You have to have a unique field to group records or they aren’t unique. Try grouping them on company name as oppossed to account num.

how do I create a myspace group train where the owners pictures are side by side?

Posted by admin on October 29th, 2009 and filed under group by | 1 Comment »

hi, i was wondering how to create a myspace group train where the owners pictures are side by side and where i could click on each image so it would take me to their profile. thanks.

go to myspace groups and create you group upload some pictures witch allows you to change there psoition.

Can you insert the sony memory stick duo pro into the Toshiba A215 laptop?

Posted by admin on October 29th, 2009 and filed under insert into | 2 Comments »

I bought this Sony DSC-W80 camera and it take s the sony memory stick duo or the sony memory stick duo pro card. Can you just insert this into the Toshiba A215-S5825 laptop to transfer pictures? I know it has media ports I just don’t know if this is one of them. Can anyone help?

Yes it works with both memory stick and memory stick pro however for the duo you will likely need an adapter. NOTE:most memory stick duos come with adapters when you buy the memory stick duo. If you don’t have an adapter you will need to get it.

Here is your link to the detailed specs of your model

javascript:popWindow(’http://cdgenp01.csd.toshiba.com/content/product/pdf_files/detailed_specs/satellite_A215-S5825.pdf#’ ,’yes’,'yes’,'700′,’500′,’yes’,'yes’)

Look under expandability and you will see this:

Expandability

2 main memory slots. Both slots may be occupied.

ExpressCard™ slot (ExpressCard/34 and ExpressCard/54)

5-in-1 Bridge Media Adapter
o
Secure Digital, Memory Stick™, Memory Stick PRO™, Multi Media Card, xD Picture Card [shared slots]

The adapter is called Sony MSAC-M2 Memory Stick Duo Adapter.

So if you don’t have one you can either get one on amazon for $5.95 plus shipping.

http://www.amazon.com/Sony-MSAC-M2-Replacement-Adaptor-Package/dp/B0000CD7K9/ref=sr_1_1?ie=UTF8&s=electronics&qid=1204608607&sr=8-1

Or you can simply buy a memory stick duo that comes with an adapter such as this one for $9.95 plus shipping.

http://www.amazon.com/gp/product/B00012OJ22/sr=8-1/qid=1204608607/ref=dp_cp_ob_title_1?ie=UTF8&qid=1204608607&sr=8-1

Good Luck

How does a database work in a large retail store?

Posted by admin on October 29th, 2009 and filed under database | 3 Comments »

How does a database work in a large retail store, per store, such as Home Depot for example? For example is there a central database for a specific store that has all the products (just the products) that are currently availible on the shelf in the store? (Talking about specific stores, rather than an overall db for a whole franchise or region).

In most cases, especially with Tier 1 retailers (like your example of Home Depot), there is no single database in the store that has all of the product data and information, but a collection of databases, which have been built ‘fit for purpose’ to support specific business processes in that environment.

The most important of these will be the SKU PLU (price look up) file on the POS (point of sale) system that contains minimal product information, item numbers and prices. This same database usually contains any promotional pricing and clearance pricing also and is synchronized with the head-office database at least once a day to ensure correct pricing in stores and that each item can be scanned when it is taken to the checkout.

Many retailers will also have an in-store inventory management system which will vary in complexity and breadth of function based on the sophistication of the retailer and their level of centralization. This will have functionality such as stock availability, expected receipts, special orders, stock taking/counting etc.

In some cases this database will have a local copy which is synchronized periodically with a central repository – but in many cases, this database is actually housed centrally and you will see sales associates looking things up on ‘green screen’ terminals. So, although the business function and the access is taking place at the store, the database is not physically located there.

This same system may also be responsible for tracking receipts as they are loaded from trucks out back – or this can be a separate system again, with yet another database.

Does anybody know how to specify the data pulled from a webpage when using a microsoft excel web query?

Posted by admin on October 29th, 2009 and filed under query | 2 Comments »

I don’t want everything on the page, just certain data. How do I write the query to specify?

I don’t know how to specify the certain data in a web query. What you could do is query the whole page on a separate sheet and then reference the cells that you want on your original sheet.

Example:
If Sheet3 had your web query and cell D5 had the data you wanted. On Sheet1, use the formula =Sheet3!D5

I have 13 words I need to be able to select individually and then have those items pasted into a single cell.?

Posted by admin on October 27th, 2009 and filed under select into | 1 Comment »

These items will be different each time the excell form is filled in. I am just starting to use MVB and am at a loss with the code. I can build the macro but do not know how to get the words to past into excell. Thanks for your help

=A1&" "&B1&" "&C1&" "&D1&" "&E1&" "&F1 etc…
(no " before the first cell or after the last, they are between cells not before and after)
If you want a comma between cells =A1&","&B1& etc…
You can also add spaces as needed the same way between the "s

Pls Help me w/ this SQL statement I wrote, I got stuck..thanks a lot!!?

Posted by admin on October 27th, 2009 and filed under subquery | 2 Comments »

I need to retrieve Country name and total value of all sales that I have made to that country during 2007 where the total values of sales to that country is under $5,000. Result set should have just one row per country name.

I have a Orders table, OrderDetails (from Northwind db)

I keep getting errors from following statement (ERROR Line 1: An aggregate may not appear in the WHERE clause unless it is in a subquery contained in a HAVING clause or a select list, and the column being aggregated is an outer reference.)

SELECT ShipCountry AS ‘Country’, SUM(UnitPrice) As ‘Total Value’
FROM Orders INNER JOIN OrderDetails
ON Orders.OrderID = OrderDetails.OrderID
Where YEAR(OrderDate) = 2007
AND Sum(UnitPrice) < 5000
GROUP By ShipCountry

HELP PLEASE!

If you want to use a rolled-up value as part of row criteria, use HAVING instead of WHERE. In your example:

SELECT ShipCountry AS ‘Country’, SUM(UnitPrice) As ‘Total Value’
FROM Orders
INNER JOIN OrderDetails ON Orders.OrderID = OrderDetails.OrderID
WHERE YEAR(OrderDate) = 2007
GROUP BY ShipCountry
HAVING SUM(UnitPrice) < 5000