Search Results

Search found 93 results on 4 pages for 'rhys gibson'.

Page 4/4 | < Previous Page | 1 2 3 4 

  • Calculations coming out to 0.0?

    - by Nick Gibson
    A simple percentage calculation. It wont return a value except 0.0 and I think once or twice it returned 100.0%. Other than that it won't do a thing. I have tried playing with the code in several different ways and it just wont work. for (int loop = 1; loop < loopCount; loop++) { aa = r.nextInt(10+1); abc = (int) aa; String[] userAnswer = new String[x]; int totalQues = (correctAnswer + wrongAnswer), actualQues = (totalQues - 1); if(abc < x) { userAnswer[abc] = JOptionPane.showInputDialog(null,"Question "+quesNum+"\n\n"+questions[abc]+"\n\nA: "+a[abc]+"\nB: "+b[abc]+"\nC: "+c[abc]+"\nD: "+d[abc]+"\nCorrect Answers: "+correctAnswer+"\nWrong Answers: "+wrongAnswer+"\nTotal Questions: "+totalQues); if(userAnswer[abc].equals(answers[abc])) { correctAnswer++; } else { wrongAnswer++; }//else if(actualQues == x); { score = (correctAnswer / actualQues) * 100; JOptionPane.showMessageDialog(null,"The test is finished."); JOptionPane.showMessageDialog(null,"You scored "+score+"%"); }//if }//if }//for

    Read the article

  • MySQL Access in Php to a database created in C-Panel

    - by Rhys Drury
    Basically, i'm having trouble connecting to a mysql database using a php web page. I created the database in C-panel using the wizard i'm connecting like this $db_host = "localhost"; //your host Database address $db_username = "xxxx"; //your account username $db_pass = "xxxxx"; //your account password $db_name = "xxxxx"; //your database name @mysql_connect("$db_host","$db_username","$db_pass") or die ("could not connect to mysql"); @mysql_select_db("$db_name") or die ("no database"); But all my page seems to do is trigger the " could not connect to mysql" my page does have wordpress installed at the minute but I'm planning to get rid of it as I'm creating my site myself. I'm just baffled why it can't connect, because in Phpmyadmin ( a feature on C-panel) it says the database is in localhost.

    Read the article

  • Namespace and class conflict(?)

    - by dan gibson
    This is a bad title for the question, but I'm not quite sure of a better one. I have a namespace called Globals with a class X in it. I also have a class called Globals. When I try to access Globals.X.StaticMember it tries to access the class Globals.X and complains that X doesn't exist. How do I reference the namespace Globals - ie ::Globals.X.StaticMember (:: doesn't compile).

    Read the article

  • Getting bizarre "expected primary-expression" error.

    - by Fecal Brunch
    Hi, I'm getting a really strange error when making a method call: /* input.cpp */ #include <ncurses/ncurses.h> #include "input.h" #include "command.h" Input::Input () { raw (); noecho (); } Command Input::next () { char input = getch (); Command nextCommand; switch (input) { case 'h': nextCommand.setAction (ACTION_MOVELEFT); break; case 'j': nextCommand.setAction (ACTION_MOVEDOWN); break; case 'k': nextCommand.setAction (ACTION_MOVEUP); break; case 'l': nextCommand.setAction (ACTION_MOVERIGHT); break; case 'y': nextCommand.setAction (ACTION_MOVEUPLEFT); break; case 'u': nextCommand.setAction (ACTION_MOVEUPRIGHT); break; case 'n': nextCommand.setAction (ACTION_MOVEDOWNLEFT); break; case 'm': nextCommand.setAction (ACTION_MOVEDOWNRIGHT); break; case '.': nextCommand.setAction (ACTION_WAIT); break; } return nextCommand; } and the error: Administrator@RHYS ~/code/rogue2 $ make g++ -c -Wall -pedantic -g3 -O0 input.cpp input.cpp: In member function `Command Input::next()': input.cpp:21: error: expected primary-expression before '=' token input.cpp:24: error: expected primary-expression before '=' token input.cpp:27: error: expected primary-expression before '=' token input.cpp:30: error: expected primary-expression before '=' token input.cpp:33: error: expected primary-expression before '=' token input.cpp:36: error: expected primary-expression before '=' token input.cpp:39: error: expected primary-expression before '=' token input.cpp:42: error: expected primary-expression before '=' token input.cpp:45: error: expected primary-expression before '=' token make: *** [input.o] Error 1 Sorry about the lack of linenumbers, the errors occur on the lines "nextCommand.setAction(...)", which is totally bizarre considering that they don't contain a '='. Any ideas? Thanks, Rhys

    Read the article

  • sorting filtered data in asp.net listview

    - by user791345
    I've created a listview that's filled up with a list of guitars from the database on page load like so: protected void Page_Load(object sender, EventArgs e) { SqlConnection con = new SqlConnection(WebConfigurationManager.ConnectionStrings["GuitarsLTDBConnectionString"].ToString()); SqlCommand cmd = new SqlCommand("SELECT * FROM Guitars", con); SqlDataAdapter da = new SqlDataAdapter(cmd.CommandText, con); DataTable dt = new DataTable(); da.Fill(dt); lvGuitars.DataSource = dt; lvGuitars.DataBind(); } The following code filters that list of guitars by a certain Make when the user checks the checkbox corresponding to that make protected void chkOrgs_SelectedIndexChanged(object sender, EventArgs e) { DataTable dt = (DataTable)lvGuitars.DataSource; DataView dv = new DataView(dt); if (chkOrgs.SelectedValue == "Gibson") { dv.RowFilter = "Make = 'Gibson' OR Make='Fender'"; } lvGuitars.DataSource = dv.ToTable(); lvGuitars.DataBind(); } Now, what I want to do is be able to sort the latest data that is present within the listview. Meaning, if sort is clicked before filtering, the it should sort all data. If sort is clicked after filtering, it should sort the filtered data. I'm using the following code, which is triggered upon a LinkButton click protected void lnkSortResults_Click(object sender, EventArgs e) { DataTable dt = (DataTable)lvGuitars.DataSource; DataView dv = new DataView(dt); dv.Sort = "Make ASC"; lvGuitars.DataSource = dv.ToTable(); lvGuitars.DataBind(); } The problem is that all the data that the listview was loaded with before any filtering is sorted, and not the latest filtered data. How can I change this code so that the latest data available in the listview is the one that's sorted? Thanks

    Read the article

  • Python DictReader - Skipping rows with missing columns?

    - by victorhooi
    heya, I have a Excel .CSV file I'm attempting to read in with DictReader. All seems to be well, except it seems to omit rows, specifically those with missing columns. Our input looks like: mail,givenName,sn,lorem,ipsum,dolor,telephoneNumber [email protected],ian,bay,3424,8403,2535,+65(2)34523534545 [email protected],mike,gibson,3424,8403,2535,+65(2)34523534545 [email protected],ross,martin,,,,+65(2)34523534545 [email protected],david,connor,,,,+65(2)34523534545 [email protected],chris,call,3424,8403,2535,+65(2)34523534545 So some of the rows have missing lorem/ipsum/dolor columns, and it's just a string of commas for those. We're reading it in with: def read_gd_dump(input_file="blah 20100423.csv"): gd_extract = csv.DictReader(open('blah 20100423.csv'), restval='missing', dialect='excel') return dict([(row['something'], row) for row in gd_extract]) And I checked that "something" (the key for our dict) isn't one of the missing columns, I had originally suspected it might be that. It's one of the columns after that. However, DictReader seems to completely skip over the rows. I tried setting restval to something, didn't seem to make any difference. I can't seem to find anything in Python's CSV docs (http://docs.python.org/library/csv.html) that would explain this behaviour, but I may have misread something. Any ideas? Thanks, Victor

    Read the article

  • Are you ready for the needed changes to your Supply Chain for 2013?

    - by Stephen Slade
    With the initiation of the Dodd-Frank Act, companies need to determine if their products contain 'conflict materials' from certain global markets as the Rep of Congo. The materials include metals such as gold, tin, tungsten and tantalum. Compaines with global sourcing face new disclosure requirements in Feb'13 related to business being done in Iran. Public companies are required to disclose to U.S. security regulators if they or their affiliates are engaged in business in Iran either directly or indirectly.  Is your supply chain compliant?  Do you have sourcing reports to validate?  Where are the materials in your chips & circuit boards coming from? In the next few weeks, responsible companies will be scrutinizing their supply chains, subs, JVs, and affiliates to search for exposure. Source: Brian Lane, Atty at Gibson Dunn Crutcher, as printed in the WSJ Tues, Dec 11, 2012 p.B8

    Read the article

  • I'm working on my resume for a job fair this week; any tips? [closed]

    - by buu700
    This will change as I update the document, but here is my resume. The job fair I'm going to is really huge (very good chance that it will determine where I intern this summer), so I would definitely appreciate any possible assistance in polishing this up. Any advice possible will be appreciated, ranging from spacing or absurdly minor formatting issues, to rearranging bullet points, to browser incompatibilities, to major changes in anything I've organised or written. At the moment, my only specific question is whether easter eggs are acceptable (specifically, if representatives who understand the reference will generally frown upon my inclusion of "Hacked The Gibson", given the context). Also, if anyone wants to evaluate it (e.g. font size, final arrangement, etc.), here is a PDF snapshot of the document at the time this question was submitted (the final version will have a different file name and appropriate metadata, for the record). Thanks!

    Read the article

  • Using a constructor for return.

    - by Fecal Brunch
    Hi, Just a quick question. I've written some code that returns a custom class Command, and the code I've written seems to work fine. I was wondering if there are any reasons that I shouldn't be doing it this way. It's something like this: Command Behavior::getCommand () { char input = 'x'; return Command (input, -1, -1); } Anyway, I read that constructors aren't meant to have a return value, but this works in g++. Thanks for any advice, Rhys

    Read the article

  • Automatic Email Sender

    - by TheGBSoftware
    Hey All, I know that this is not the right forum to ask this question but I thought I would ask here first... I need to make a button where when you click it you are asked to provide your email and then click a "send" button... When you do it sends a default email to the email provided... And I would like to use this on my web-site so if it could be in HTML... ANY HELP IS APPRECIATED, THANKS -Gibson of GBSoftware and Island Games Limited-

    Read the article

  • Move exchange mailboxes cross forest

    - by Aceth
    Having a hard time migrating user mailboxes across 2 forests. I've set up ADMT 3.2, No dns issues and fully route-able between the domains etc. Have come to migrate user mailboxes and the exchange shell just comes back with ... [PS] C:New-MoveRequest -Identity "username" -TargetDatabase "maildb" -RemoteGlobalCatalog 'gdc.doman.local' -RemoteCredential (get-credential) -TargetDeliveryDomain 'sourcedomain.local' Parameter set cannot be resolved using the specified named parameters. + CategoryInfo : InvalidArgument: (:) [New-MoveRequest], ParameterBindingException + FullyQualifiedErrorId : AmbiguousParameterSet,New-MoveRequest We are running a mixed environment (windows server 2003 and up with exchange 2003 and exchange 2010 (different servers obviously)) as a source domain and full Server 2008 R2 servers in the target domain with only 1 exchange 2010 server. We have ran this command on the Exchange 2010 server on the target domain and when asked giving the credentials of an admin in source domain in the format : sourcedomain\source_administrator Any help would be greatly appreciated Thanks Rhys

    Read the article

  • What is the S.M.A.R.T. page?

    - by Mads Skjern
    I've just listened to Steve Gibson talk about his SpinRite software, on the Security Now podcast episode 336 (transscript). At 33:20 he says: I can show and do show on the SMART page that sectors are being relocated and that errors are being corrected. That SMART analysis page sometimes scares people because it shows, wait a minute, this thing says we're correcting so many errors per megabyte. What is this SMART page? 1) Some information saved on the HD by SMART, that I can access with a SMART tool like smartmontools? 2) A page (tab) in his SpinRite software? In any case, can I see, in any way, what sectors are marked as bad, without using SpinRite? Preferably using smartmontools!

    Read the article

  • Does SpinRite do what it claims to do?

    - by romandas
    I don't have any real (i.e. professional) experience with Steve Gibson's SpinRite so I'd like to put this to the SF community. Does SpinRite actually do what it claims? Is it a good product to use? With a proper backup solution and RAID fault tolerance, I've never found need for it, but I'm curious. There seems to be some conflicting messages regarding it, and no hard data to be found either way. On one hand, I've heard many home users claim it helped them, but I've heard home users say a lot of things -- most of the time they don't have the knowledge or experience to accurately describe what really happened. On the other hand, Steve's own description and documentation don't give me a warm fuzzy about it either. So what is the truth of the matter? Would you use it?

    Read the article

  • Round prices up to nearest 5 after conversion in oscommerce

    - by Rhyso
    Hi there, A conversion question relating to prices in oscommerce: I am needing for a custom currency conversion to round the USD prices up to the nearest 5$ to avoid prices being displayed at silly prices such as $263. I am trying to convert to an int and round the following line : $curr-display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])); ( as for some reason the price is displayed as a string, im guessing to include the currency sign) However not having much luck. Does anybody know where the root conversion takes place as it might be easier for me to round() or ceil() from there when it is a raw integer Or any other ideas of how I can round the conversion? Thanks for any help Rhys Thomas

    Read the article

  • Best programming novel to take on holiday

    - by Ed Guiness
    I am about enjoy a two week break in Spain where I expect to have lots of time for relaxing and reading. I normally read a lot of non-fiction so I'm looking for novel suggestions. If there is another Cryptonomicon out there I'd love to hear about it! UPDATE: In the end I took four books including Quicksilver. Quicksilver was fantastic and I look forward to continuing the series. I was disappointed with Gen X (Coupland) and Pattern Recognition (Gibson). Upon arrival I also found The Monsters Of Gramercy Park (Leigh) which was enjoyable though sad. Thanks for all the recommendations, I'm sure to return to this list when I have more free time.

    Read the article

  • Happy 3rd Birthday SilverlightCream!

    - by Dave Campbell
    Happy 3rd Birthday!     Yesterday (May 16) was the 'Birthday' of SilverlightCream, which started just after MIX in 2007 with a post "Interesting Silverlight posts today: Silverlight Control & Silverlight Pad". Too many good posts flying around led me to want to archive them, particularly since I was being aggregated at a new site Silverlight.net, and I could give some of that 'reach' to the community. Saturday's post was number 862, and as of that post, there were 5697 blog posts archived in the database all tagged up and searchable at SilverlightCream.com using the search page. The search needs to be better, and that's another discussion, but it does work. The blog didn't begin life as the SilverlightCream blog, as is obvious from the name, but once I realized people were following it closely, I've tried to keep the signal-to-noise ratio very high. I even secured another blog for when I just want to rant about something to keep that stuff out of this one :) If you've been around since MIX07 days you've heard all this, but after talking to some people at MIX10 I realized not everyone knows all the ways the information is presented, so I figured doing a post like this once a year probably isn't a bad idea :) I scrounge through an ever-growing list of blogs (right now sitting at 505) looking for good stuff. I try to spin through the list every day, but with the list growing that large, it's getting tough. I usually use it as a background task while working or watching TV. If I just sit and go through the blogs it takes about an hour. The list is long enough now that from time to time, I'll only get partway through it and have 10 to 13 entries, so I'll just stop there and go on the next day... I don't like to have more than 15 in any single post. It's all pattern recognition as in "seen that", "seen that", "that's new", etc... so if you're a blogger, look at a heading below for some comments about blogging from my perspective. When I see something new, I make sure you're not pulling a 'Mike Taulty' on me and dumping 6 or 8 new posts in one day :), and I tag the ones I want to review. If there's not a lot going on, I may just push the posts as I come across them. Some days there may be 60 posts in that 'to review' list! Some are non-Silverlight, some are essentially duplicates of others, some are demos, ads, new releases of something, session materials, etc. I push lots of material into a database at WynApse.com, and the "Tagged Posts" menu on the left sidebar there takes you to a tag cloud of (at this very moment) "9224 articles tagged 13915 different ways using 459 unique tags". There are links in there on Gibson guitars, Jazz Guitar instructional stuff, Ford F-250 links, and tons of technical and non-technical stuff I've been aggregating for about 5 years now. So when I decide to blog (or shoutout) something, I first push it into the database at WynApse.com. Then I tag it all up and push it into the database at SilverlightCream.com. Then it gets pushed to @SilverlightNews. For a little over a year now, we're tracking unique IP hits on posts launched from either the blog post or from one of the SilverlightCream.com pages, and the posts with top hits from unique IP addresses in the last 7 days are displayed in a 'Skim' page at SilverlightCream... and that page needs work as well. The Skim page and tracking was the brainchild of my buddy Michael Washington. What I blog/shoutout After some time doing posts, I decided there were things that probably have no need to be searchable, but are good information, so I post those as 'Shoutouts'. Eventually I also decided the Shoutouts should get posted to @SilverlightNews, and that's now taking place. Notes to bloggers Remember I said spinning throught the Big List-o-BlogsTM is pattern recognition... that means I don't spend a lot of time on any individual blog deciding if it has new content. If you're familiar with the term 'Above the Fold', then you're probably ok. If I have to scroll the page to see if there's something new, or wade through some maze of menus, I'm probably going to miss new stuff. Likewise if you only show the latest on the front page and make it a puzzle to find the rest of them, or if you make the titles and initial graphics almost identical to the previous article, I'll miss it. Another thing is name/brand-recognition. Far be it for me (WynApse) to comment on someone blogging with a pseudonym, but if you want to get get some recognition, you are going to want your name to be available somewhere. I can think right off the top of my head of a couple good blogs that I have no idea of the individuals' real names. I can pull that off a bit because I've been around so long almost everyone knows who I am, but if you're new to the blog-o-sphere, being able to be name-recognized is as important as getting your brand out there. Kick my tires Finally, stuff happens... I may hit the wrong key and delete your blog, or a post might slip past me and I not realize it's new because of the naming, and never blog it. If you think I missed something, send me an email or use the submit page at SilverlightCream.com. Some bloggers have figured out that if they submit (one way or another) to me, their posts will go out next. I try to honor anyone that takes the time to submit with a quicker 'Cream posting. Thanks! Finally, thanks to everyone that contributes to the community as a whole... the blogs, the videos, and the presentations. A special thanks to everyone that reads SilverlightCream, or follows @WynApse or @SilverlightNews. Keep it all coming, and... Stay in the 'Light

    Read the article

  • Values of generated column not appearing in table

    - by msh210
    I'm using mysql version 5.1.41-3ubuntu12.10 (Ubuntu). mysql> show create table tt\G *************************** 1. row *************************** Table: tt Create Table: CREATE TABLE `tt` ( `pz` int(8) DEFAULT NULL, `os` varchar(8) DEFAULT NULL, `uz` int(11) NOT NULL, `p` bigint(21) NOT NULL DEFAULT '0', `c` decimal(23,0) DEFAULT NULL, KEY `pz` (`pz`), KEY `uz` (`uz`), KEY `os` (`os`), KEY `pz_2` (`pz`,`uz`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 1 row in set (0.00 sec) mysql> select pz,uz,pz*uz, -> if(pz*uz,1,.5), -> left(pz,2) pl,left(lpad(uz,5,0),2) ul, -> p from tt limit 10; +-------+----+-------+----------------+--------+----+--------+ | pz | uz | pz*uz | if(pz*uz,1,.5) | pl | ul | p | +-------+----+-------+----------------+--------+----+--------+ | NULL | 0 | NULL | 0.5 | NULL | 00 | 4080 | | NULL | 0 | NULL | 0.5 | NULL | 00 | 323754 | | 89101 | 0 | 0 | 0.5 | 89 | 00 | 6880 | | 0 | 0 | 0 | 0.5 | 0 | 00 | 11591 | | 89110 | 0 | 0 | 0.5 | 89 | 00 | 72 | | 78247 | 0 | 0 | 0.5 | 78 | 00 | 27 | | 90062 | 0 | 0 | 0.5 | 90 | 00 | 5 | | 63107 | 0 | 0 | 0.5 | 63 | 00 | 4 | | NULL | 0 | NULL | 0.5 | NULL | 00 | 54561 | | 94102 | 0 | 0 | 0.5 | 94 | 00 | 12499 | +-------+----+-------+----------------+--------+----+--------+ So far so good. As you see, 0.5 appears as a value of if(pz*uz,1,.5). The problem is: mysql> select os, -> if(pz*uz,left(pz,2)<=>left(lpad(uz,5,0),2),.5) uptwo, -> if(pz*uz,left(pz,3)<=>left(lpad(uz,5,0),3),.5) upthree, -> sum(p) p,sum(c) c -> from tt t -> group by os,uptwo,upthree order by null; +----+-------+---------+---------+-------+ | os | uptwo | upthree | p | c | +----+-------+---------+---------+-------+ | u | 1 | 1 | 52852 | 318 | | i | 1 | 1 | 7046563 | 21716 | | m | 1 | 1 | 1252166 | 7337 | | i | 0 | 0 | 1830284 | 4033 | | m | 0 | 0 | 294612 | 1714 | | i | 1 | 0 | 911486 | 3560 | | m | 1 | 0 | 145182 | 1136 | | u | 0 | 0 | 12144 | 23 | | u | 1 | 0 | 1571 | 8 | +----+-------+---------+---------+-------+ Although I group by uptwo, 0.5 doesn't appear in that column. What happened to the 0.5 values? Edit: As noted in the comments to Todd Gibson's answer, I also tried it with if(pz*uz,cast(left(pz,2)<=>left(lpad(uz,5,0),2) as decimal),.5) instead of if(pz*uz,left(pz,2)<=>left(lpad(uz,5,0),2),.5), but it, too, didn't work.

    Read the article

  • Storing unique values into an array and comparing against a loop - PHP

    - by Aphex22
    I'm writing a PHP report which is designed to be exported purely as a CSV file, using commma delimiters. There are three columns relating to product_id, these three columns are as follows: SKU Parent / Child Parent SKU 12345 parent 12345 12345_1 child 12345 12345_2 child 12345 12345_3 child 12345 12345_4 child 12345 18099 parent 18099 18099_1 child 18099 Here's a link to the full CSV file: http://i.imgur.com/XELufRd.png At the moment the code looks like this: $sql = "select * from product WHERE on_amazon = 'on' AND active = 'on'"; $result = mysql_query($sql) or die ( mysql_error() );?> <? // set headers echo " Type, SKU, Parent / Child, Parent SKU, Product name, Manufacturer name, Gender, Product_description, Product price, Discount price, Quantity, Category, Photo 1, Photo 2, Photo 3, Photo 4, Photo 5, Photo 6, Photo 7, Photo 8, Color id, Color name, Size name <br> "; // load all stock while ($line = mysql_fetch_assoc($result) ) { ?> <?php // Loop through each possible size variation to see whether any of the quantity column has stock > 0 $con_size = array (35,355,36,37,375,38,385,39,395,40,405,41,415,42,425,43,435,44,445,45,455,46,465,47,475,48,485); $arrlength=count($con_size); for($x=0;$x<$arrlength;$x++) { // check if size is available if($line['quantity_c_size_'.$con_size[$x].'_chain'] > 0 ) { ?> <? echo 'Shoes'; ?>, <?=$line['product_id']?>, , , <?=$line['title']?>, <? $brand = $line['jys_brand']; echo ucfirst($brand); ?>, <? $gender = $line['category']; if ($gender == 'Mens') { echo 'H'; } else{ echo 'F'; } ?>, <?=preg_replace('/[^\da-z]/i', ' ', $line['amazon_desc']) ?>, <?=$line['price']?>, <?=$line['price']?>, <?=$line['quantity_c_size_'.$con_size[$x].'_chain']?>, <? $category = $line['style1']; switch ($category) { case "ankle-boots": echo "10013"; break; case "knee-high-boots": echo "10011"; break; case "high-heel-boots": echo "10033"; break; case "low-heel-boots": echo "10014"; break; case "wedge-boots": echo "10014"; break; case "western-boots": echo "10032"; break; case "flat-shoes": echo "10034"; break; case "high-heel-shoes": echo "10039"; break; case "low-heel-shoes": echo "10039"; break; case "wedge-shoes": echo "10035"; break; case "ballerina-shoes": echo "10008"; break; case "boat-shoes": echo "10018"; break; case "loafer-shoes": echo "10037"; break; case "work-shoes": echo "10039"; break; case "flat-sandals": echo "10041"; break; case "low-heel-sandals": echo "10042"; break; case "high-heel-sandals": echo "10042"; break; case "wedge-sandals": echo "10042"; break; case "mule-sandals": echo "10038"; break; case "mary-jane-shoes": echo "10039"; break; case "sports-shoes": echo "10026"; break; case "court-shoes": echo "10035"; break; case "peep-toe-shoes": echo "10035"; break; case "flat-boots": echo "10609"; break; case "mid-calf-boots": echo "10014"; break; case "trainer-shoes": echo "10009"; break; case "wellington-boots": echo "10012"; break; case "lace-up-boots": echo "10609"; break; case "chelsea-and-jodphur-boots": echo "10609"; break; case "desert-and-chukka-boots": echo "10032"; break; case "lace-up-shoes": echo "10034"; break; case "slip-on-shoes": echo "10043"; break; case "gibson-and-derby-shoes": echo "10039"; break; case "oxford-shoes": echo "10039"; break; case "brogue-shoes": echo "10039"; break; case "winter-boots": echo "10021"; break; case "slipper-shoes": echo "10016"; break; case "mid-heel-shoes": echo "10039"; break; case "sandals-and-beach-shoes": echo "10044"; break; case "mid-heel-sandals": echo "10042"; break; case "mid-heel-boots": echo "10014"; break; default: echo ""; } ?>, http://www.getashoe.co.uk/full/<?=$line['product_id']?>_1.jpg, http://www.getashoe.co.uk/full/<?=$line['product_id']?>_2.jpg, http://www.getashoe.co.uk/full/<?=$line['product_id']?>_3.jpg, http://www.getashoe.co.uk/full/<?=$line['product_id']?>_4.jpg, , , , , <? $colour = preg_replace('/[^\da-z]/i', ' ', $line['colour']); if( preg_match( '/white.*/i', $colour)) { echo '1'; } elseif( preg_match( '/yellow.*/i', $colour)) { echo '4'; } elseif( preg_match( '/orange.*/i', $colour)) { echo '7'; } elseif( preg_match( '/red.*/i', $colour)) { echo '8'; } elseif( preg_match( '/pink.*/i', $colour)) { echo '13'; } elseif( preg_match( '/purple.*/i', $colour)) { echo '15'; } elseif( preg_match( '/blue.*/i', $colour)) { echo '19'; } elseif( preg_match( '/green.*/i', $colour)) { echo '25'; } elseif( preg_match( '/brown.*/i', $colour)) { echo '28'; } elseif( preg_match( '/grey.*/i', $colour)) { echo '35'; } elseif( preg_match( '/black.*/i', $colour)) { echo '38'; } elseif( preg_match( '/gold.*/i', $colour)) { echo '41'; } elseif( preg_match( '/silver.*/i', $colour)) { echo '46'; } elseif( preg_match( '/multi.*/i', $colour)) { echo '594'; } elseif( preg_match( '/beige.*/i', $colour)) { echo '6887'; } elseif( preg_match( '/nude.*/i', $colour)) { echo '6887'; } else { echo '534'; } ?>, <?=$line['colour']?>, <?=$con_size[$x]?> <br> <? // finish checking if size is available } } ?> So at the moment this is simply echoing out the product_ID into the SKU column. The code would need to enter the product_id into an array and check whether it is unique. If the product_id is unique to the array, then the product_id is echoed out unaltered, and parent is echoed out to the 'Parent/Child' column and then the product_id is repeated to the 'Parent SKU' column. However, if the array is checked and the product_id already exists in the array, then the product_id is echoed out to the 'SKU' column with a suffix i.e. _1. Then child is echoed to the 'Parent / Child' column and the original parent product_id echoed to the 'Parent SKU' column. HOWEVER - the same SKU cannot be repeated with the same suffix i.e. 12345_1, 12345_1 - so presumably there would be to be another array for the suffixed SKUs to be checked against. If anybody could help, it would be great. Thanks --- UPDATE ANSWER --- I managed to solved this myself and thought I would share my solution for future reference. /* * Array to collect product_ids and check whether unique. * If unique product_id becomes parent SKU * If not product_id becomes child of previous parent and suffixed with _1, _2 etc... */ if (!in_array($line['product_id'], $SKU)) { $SKU[] = $line['product_id']; $parent = $line['product_id']; $a = 0; ?> <? echo 'Shoes'; ?>, <? echo $parent; ?>, <? echo "Parent"; ?>, <? echo $parent; ?>, <? } else { $child = $line['product_id'] . "_" . $a; ?> <? echo 'Shoes'; ?>, <? echo $child; ?>, <? echo "Child"; ?>, <? echo $child; <? // increment suffix value for child SKU $a++; ?>

    Read the article

< Previous Page | 1 2 3 4