Jump to content

Search the Community

Showing results for tags 'array'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start





Website URL








Donation Link

  1. Hey guys, I am probably about to ask too much but I really do not know where to start so I am asking for help. I have a javascript code that stores an array of 366 quotes. One per day(including leap year so the code does not fail on the 366th day). I currently switched to a host that allows PHP. I would like to somehow convert the code from JS to PHP. Could anyone help? I really do not know where to start. Date.prototype.getDOY = function() {var onejan = new Date(this.getFullYear(),0,1); return Math.ceil((this - onejan) / 86400000);} var today = new Date(); var DOY = today.getDOY(); var Quote=new Array() Quote[0]='Quote goes here'; Quote[1]='Quote goes here'; Quote[2]='Quote goes here'; Quote[3]='Quote goes here'; Quote[4]='Quote goes here'; Quote[5]='Quote goes here'; Quote[6]='Quote goes here'; Quote[7]='Quote goes here'; Quote[8]='Quote goes here'; Quote[9]='Quote goes here'; Quote[10]='Quote goes here'; Quote[11]='Quote goes here'; Quote[12]='Quote goes here'; Quote[13]='Quote goes here'; Quote[14]='Quote goes here'; Quote[15]='Quote goes here'; Quote[16]='Quote goes here'; Quote[17]='Quote goes here'; Quote[18]='Quote goes here'; Quote[19]='Quote goes here'; Quote[20]='Quote goes here'; Quote[21]='Quote goes here'; Quote[22]='Quote goes here'; Quote[23]='Quote goes here'; Quote[24]='Quote goes here'; Quote[25]='Quote goes here'; Quote[26]='Quote goes here'; Quote[27]='Quote goes here'; Quote[28]='Quote goes here'; Quote[29]='Quote goes here'; Quote[30]='Quote goes here'; Quote[31]='Quote goes here'; Quote[32]='Quote goes here'; Quote[33]='Quote goes here'; Quote[34]='Quote goes here'; Quote[35]='Quote goes here'; Quote[36]='Quote goes here'; Quote[37]='Quote goes here'; Quote[38]='Quote goes here'; Quote[39]='Quote goes here'; Quote[40]='Quote goes here'; Quote[41]='Quote goes here'; Quote[42]='Quote goes here'; Quote[43]='Quote goes here'; Quote[44]='Quote goes here'; Quote[45]='Quote goes here'; Quote[46]='Quote goes here'; Quote[47]='Quote goes here'; Quote[48]='Quote goes here'; Quote[49]='Quote goes here'; Quote[50]='Quote goes here'; Quote[51]='Quote goes here'; Quote[52]='Quote goes here'; Quote[53]='Quote goes here'; Quote[54]='Quote goes here'; Quote[55]='Quote goes here'; Quote[56]='Quote goes here'; Quote[57]='Quote goes here'; Quote[58]='Quote goes here'; Quote[59]='Quote goes here'; Quote[60]='Quote goes here'; Quote[61]='Quote goes here'; Quote[62]='Quote goes here'; Quote[63]='Quote goes here'; Quote[64]='Quote goes here'; Quote[65]='Quote goes here'; Quote[66]='Quote goes here'; Quote[67]='Quote goes here'; Quote[68]='Quote goes here'; Quote[69]='Quote goes here'; Quote[70]='Quote goes here'; Quote[71]='Quote goes here'; Quote[72]='Quote goes here'; Quote[73]='Quote goes here'; Quote[74]='Quote goes here'; Quote[75]='Quote goes here'; Quote[76]='Quote goes here'; Quote[77]='Quote goes here'; Quote[78]='Quote goes here'; Quote[79]='Quote goes here'; Quote[80]='Quote goes here'; Quote[81]='Quote goes here'; Quote[82]='Quote goes here'; Quote[83]='Quote goes here'; Quote[84]='Quote goes here'; Quote[85]='Quote goes here'; Quote[86]='Quote goes here'; Quote[87]='Quote goes here'; Quote[88]='Quote goes here'; Quote[89]='Quote goes here'; Quote[90]='Quote goes here'; Quote[91]='Quote goes here'; Quote[92]='Quote goes here'; Quote[93]='Quote goes here'; Quote[94]='Quote goes here'; Quote[95]='Quote goes here'; Quote[96]='Quote goes here'; Quote[97]='Quote goes here'; Quote[98]='Quote goes here'; Quote[99]='Quote goes here'; Quote[100]='Quote goes here'; Quote[101]='Quote goes here' Quote[102]='Quote goes here' Quote[103]='Quote goes here'; Quote[104]='Quote goes here'; Quote[105]='Quote goes here'; Quote[106]='Quote goes here'; Quote[107]='Quote goes here'; Quote[108]='Quote goes here'; Quote[109]='Quote goes here'; Quote[110]='Quote goes here'; Quote[111]='Quote goes here'; Quote[112]='Quote goes here'; Quote[113]='"People shouldn\'t be afraid of their government. Governments should be afraid of their people." - Alan Moore, V for Vendetta'; Quote[114]='"The best and most beautiful things in the world cannot be seen or even touched - they must be felt with the heart." - Helen Keller'; Quote[115]='"It is during our darkest moments that we must focus to see the light." - Aristotle Onassis'; Quote[116]='“The beautiful thing about learning is that no one can take it away from you.” - B. B. King'; Quote[117]='“Luck is what happens when preparation meets opportunity.” - Seneca'; Quote[118]='“Courage is not the absence of fear, but rather the judgement that something else is more important than fear.” - James Neil Hollingworth'; Quote[119]='“Those who wish to sing, always find a song.” - Swedish Proverb'; Quote[120]='“The most powerful weapon on earth is the human soul on fire.” - Ferdinand Foch'; Quote[121]='“He who is devoid of the power to forgive, is devoid of the power to love. ” - Martin Luther King Jr.'; Quote[122]='“Consider the postage stamp: its usefulness consists in the ability to stick to one thing till it gets there.” - Josh Billings'; Quote[123]='“Whoever said anybody has a right to give up? ” - Marian Wright Edelman'; Quote[124]='“Enthusiasm is the mother of effort, and without it nothing great was ever achieved.” - Ralph Waldo Emerson'; Quote[125]='“There are no traffic jams along the extra mile.” - Roger Staubach'; Quote[126]='“The difference between try and triumph is a little umph. ” - Anonymous'; Quote[127]='“Men exist for the sake of one another. Teach them then or bear with them.” - Marcus Aurelius Antoninus'; Quote[128]='“It is in the shelter of each other that the people live.” - Irish Proverb'; Quote[129]='“We\'re here for a reason. I believe a bit of the reason is to throw little torches out to lead people through the dark.” - Whoopi Goldberg'; Quote[130]='“Who, being loved, is poor?” - Oscar Wilde'; Quote[131]='“Love makes your soul crawl out from its hiding place.” - Zora Neale Hurst'; Quote[132]='“Start with what is right rather than what is acceptable. ” - Peter F. Drucker'; Quote[133]='“The last of the human freedoms is to choose one\'s attitudes.” - Viktor Frankl'; Quote[134]='“I will offer a choice, not an echo.” - Barry M. Goldwater'; Quote[135]='“Look at what you\'ve got and make the best of it. It is better to light a candle than to curse the darkness.” - Proverb'; Quote[136]='“Adopt the pace of nature: her secret is patience.” - Ralph Waldo Emerson'; Quote[137]='"He who destroys a good book, kills reason itself" - John Milton'; Quote[138]='“The greatest power is often simple patience.” - E. Joseph Cossman'; Quote[139]='“Perhaps the most important thing we can undertake toward the reduction of fear is to make it easier for people to accept themselves, to like themselves.” - Bonaro W. Overstreet'; Quote[140]='“Few things can help an individual more than to place responsibility on him, and to let him know that you trust him. ” - Booker T. Washington'; Quote[141]='“Those who mind don\'t matter, and those who matter don\'t mind.” - Bernard M. Baruch'; Quote[142]='"Life itself is only a vision, a dream. Nothing exists. Just empty space and you. And you, are but a thought." - Satan'; Quote[143]='“Action springs not from thought, but from a readiness for responsibility.” - Dietrich Bonhoeffer'; Quote[144]='“Put your ear down close to your soul and listen hard.” - Anne Sexton'; Quote[145]='"Quoth the raven, nevermore." - Edgar Allen Poe'; Quote[146]='“Man is so made that when anything fires his soul, impossibilities vanish.” - Jean de La Fontaine'; Quote[147]='“The heart may be broken, and the soul remain unshaken.” - Napoleon Bonaparte'; Quote[148]='"I contend that we are both atheists. I just believe in one fewer god than you do. When you understand why you dismiss all the other possible gods, you will understand why I dismiss yours." - Stephen Roberts'; Quote[149]='“There are souls in this world which have the gift of finding joy everywhere and of leaving it behind them when they go.” - Fredrick Faber'; Quote[150]='“It is common sense to take a method and try it. If it fails, admit it frankly and try another. But above all, try something.” - Franklin D. Roosevelt'; Quote[151]='“If you think you are too small to be effective, you have never been in the dark with a mosquito.” - Unknown'; Quote[152]='“Just go out there and do what you\'ve got to do.” - Martina Navrátilová'; Quote[153]='“Nothing is at last sacred but the integrity of your own mind.” - Ralph Waldo Emerson'; Quote[154]='"Freedom is not a gift from Heaven. One must fight for it every day." - Simon Wiesenthal'; Quote[155]='“Wisdom is knowing what to do next; virtue is doing it.” - David Star Jordan'; Quote[156]='“No amount of ability is of the slightest avail without honor.” - Andrew Carnegie'; Quote[157]='“Better keep yourself clean and bright. You are the window through which you must see the world.” - George Bernard Shaw'; Quote[158]='“We are all faced with a series of great opportunities brilliantly disguised as impossible situations.” - Charles Swindoll'; Quote[159]='“Good actions give strength to ourselves and inspire good actions in others.” - Plato'; Quote[160]='“Just don\'t give up trying to do what you really want to do. Where there\'s love and inspiration, I don\'t think you can go wrong.” - Ella Jane Fitzgerald'; Quote[161]='“If you tell a big enough lie and tell it frequently enough, it will be believed.” - Adolf Hitler'; Quote[162]='“Nothing is so strong as gentleness. Nothing is so gentle as real strength.” - Saint Francis de Sales'; Quote[163]='“The real man smiles in trouble, gathers strength from distress, and grows brave by reflection.” - Thomas Paine'; Quote[164]='“We either make ourselves miserable or we make ourselves strong. The amount of work is the same.” - Carlos Casteneda'; Quote[165]='“Were it not for hope the heart would break.” - Scottish Proverb'; Quote[166]='“No winter lasts forever; no spring skips it\'s turn.” - Hal borland'; Quote[167]='“Do not compare yourself to others. If you do so, you are insulting yourself.” - Adolf Hitler'; Quote[168]='“Once you choose hope, anything\'s possible.” - Christopher Reeve'; Quote[169]='“We must accept finite disappointment, but we must never lose infinite hope.” - Martin Luther King Jr.'; Quote[170]='“Strive to be first: first to nod, first to smile, first to compliment, and first to forgive.” - Anonymous'; Quote[171]='“Work is either fun or drudgery. It depends on your attitude. I like fun.” - Colleen C. Barrett'; Quote[172]='"A fool learns by his mistakes, a wise man learns from the mistakes of others." - The Librarian'; Quote[173]='“ \'Stay\' is a charming word in a friend\'s vocabulary.” - Louisa May Alcott'; Quote[174]='“We are all in the same boat in a stormy sea, and we owe each other a terrible loyalty.” - G. K. Chesterton'; Quote[175]='“The best things in life are never rationed. Friendship, loyalty, love, do not require coupons.” - George T. Hewitt'; Quote[176]='“It is better to be faithful than famous.” - Theodore Roosevelt'; Quote[177]='“The test of courage comes when we are in the minority. The test of tolerance comes when we are in the majority.” - Ralph W. Sockman'; Quote[178]='“Trust thyself: every heart vibrates to that iron string.” - Ralph Waldo Emerson'; Quote[179]='“Life has meaning only if one barters it day by day for something other than itself.” - Antoine de Sainte-Exupery'; Quote[180]='“No one is more cherished in this world than someone who lightens the burden of another.” - Unknown'; Quote[181]='“I can live for two months on a good compliment.” - Mark Twain'; Quote[182]='“No one\'s head aches when he is comforting another.” - Indian Proverb'; Quote[183]='“Appreciation...acknowledges the presence of good wherever you shine the light of your thankful thoughts.” - Alan Cohen'; Quote[184]='“The best way to find yourself is to lose yourself in the service of others.” - Mohandas Karamchand Gandhi'; Quote[185]='“Be a good listener. Your ears will never get you in trouble.” - Frank Tyger'; Quote[186]='“Dreams come in a size too big so that we may grow into them.” - Josie Bisset'; Quote[187]='“And the day came when the risk to remain tight in a bud was more painful than the risk it took to blossom.” - Anais Nin'; Quote[188]='“Gracefulness has been defined to be the outward expression of the inward harmony of the soul.” - William Hazlitt'; Quote[189]='“What ever beauty may be, it has for its basis order, and for its essence unity.” - Father Andre'; Quote[190]='“Example has more followers than reason.” - Christian Nestell Bovee'; Quote[191]='“A mind is a fire to be kindled, not a vessel to be filled.” - Plutarch'; Quote[192]='“To be good is noble, but to teach others how to be good is nobler--and less trouble.” - Mark Twain'; Quote[193]='“When there is no enemy within, the enemies outside cannot hurt you.” - African Proverb'; Quote[194]='“We learn more by looking for the answer to a question and not finding it than we do from learning the answer itself.” - Lloyd Alexander'; Quote[195]='“When spider webs unite they can tie up a lion.” - African Proverb'; Quote[196]='“I am a part of all that I have met.” - Alfred Tennyson, 1st Baron Tennyson'; Quote[197]='“Only a life lived for others is worth living.” - Albert Einstein'; Quote[198]='“The wise man belongs to all countries, for the home of a great soul is the whole world.” - Democritus'; Quote[199]='“Diversity is the one true thing we all have in common. Celebrate it every day.” - Unknown'; Quote[200]='“As man draws nearer to the stars, why should he not also draw nearer to his neighbor?” - Lyndon B. Johnson'; Quote[201]='“All doors open to courtesy. ” - Dr. Thomas Fuller'; Quote[202]='“Character is the total of thousands of small daily strivings to live up to the best that is in us.” - A. G. Trudeau'; Quote[203]='“With courage you will dare to take risks, have the strength to be compassionate, and the wisdom to be humble. Courage is the foundation of integrity.” - Keshavan Nair'; Quote[204]='“No steam or gas drives anything until it is confined. No life ever grows great until it is focused, dedicated, disciplined.” - Harry Emerson Fosdick'; Quote[205]='“Love yourself, accept yourself, forgive yourself, and be good to yourself, because without you the rest of us are without a source of many wonderful things.” - Dr. Leo Buscaglia'; Quote[206]='“To love means loving the unlovable. To forgive means pardoning the unpardonable. Faith means believing the unbelievable. Hope means hoping when everything seems hopeless.” - G. K. Chesterton'; Quote[207]='“When work, commitment, and pleasure all become one and you reach that deep well where passion lives, nothing is impossible.” - Nancy Coey'; Quote[208]='“It was character that got us out of bed, commitment that moved us into action, and discipline that enabled us to follow through.” - Zig Ziglar'; Quote[209]='“Reach high, for stars lie hidden in your soul. Dream deep, for every dream precedes the goal.” - Pamela Vaull Starr'; Quote[210]='“The road of life twists and turns and no two directions are ever the same. Yet our lessons come from the journey, not the destination.” - Don Williams Jr.'; Quote[211]='“Humility leads to strength and not to weakness. It is the highest form of self-respect to admit mistakes and to make amends for them.” - John J. McCloy'; Quote[212]='“Sense shines with a double luster when it is set in humility. An able and yet humble man is a jewel worth a kingdom.” - William Penn'; Quote[213]='“Dream your dream. Follow your heart. Imagine. Listen to the wind. Drink sunsets. Be free. Let the wonder never cease. Believe. Wish on EVERY star. Create adventure. Be Kind.” - Debbie Coulter'; Quote[214]='Quote goes here'; Quote[215]='Quote goes here'; Quote[216]='Quote goes here'; Quote[217]='Quote goes here'; Quote[218]='Quote goes here'; Quote[219]='Quote goes here'; Quote[220]='Quote goes here'; Quote[221]='Quote goes here'; Quote[222]='Quote goes here'; Quote[223]='Quote goes here'; Quote[224]='Quote goes here'; Quote[225]='Quote goes here'; Quote[226]='Quote goes here'; Quote[227]='Quote goes here'; Quote[228]='Quote goes here'; Quote[229]='Quote goes here'; Quote[230]='Quote goes here'; Quote[231]='Quote goes here'; Quote[232]='Quote goes here'; Quote[233]='Quote goes here'; Quote[234]='Quote goes here'; Quote[235]='Quote goes here'; Quote[236]='Quote goes here'; Quote[237]='Quote goes here'; Quote[238]='Quote goes here'; Quote[239]='Quote goes here'; Quote[240]='Quote goes here'; Quote[241]='Quote goes here'; Quote[242]='Quote goes here'; Quote[243]='Quote goes here'; Quote[244]='Quote goes here'; Quote[245]='Quote goes here'; Quote[246]='Quote goes here'; Quote[247]='Quote goes here'; Quote[248]='Quote goes here'; Quote[249]='Quote goes here'; Quote[250]='Quote goes here'; Quote[251]='Quote goes here'; Quote[252]='Quote goes here'; Quote[253]='Quote goes here'; Quote[254]='Quote goes here'; Quote[255]='Quote goes here'; Quote[256]='Quote goes here'; Quote[257]='Quote goes here'; Quote[258]='Quote goes here'; Quote[259]='Quote goes here'; Quote[260]='Quote goes here'; Quote[261]='Quote goes here'; Quote[262]='Quote goes here'; Quote[263]='Quote goes here'; Quote[264]='Quote goes here'; Quote[265]='Quote goes here'; Quote[266]='Quote goes here'; Quote[267]='Quote goes here'; Quote[268]='Quote goes here'; Quote[269]='Quote goes here'; Quote[270]='Quote goes here'; Quote[271]='Quote goes here'; Quote[272]='Quote goes here'; Quote[273]='Quote goes here'; Quote[274]='Quote goes here'; Quote[275]='Quote goes here'; Quote[276]='Quote goes here'; Quote[277]='Quote goes here'; Quote[278]='Quote goes here'; Quote[279]='Quote goes here'; Quote[280]='Quote goes here'; Quote[281]='Quote goes here'; Quote[282]='Quote goes here'; Quote[283]='Quote goes here'; Quote[284]='Quote goes here'; Quote[285]='Quote goes here'; Quote[286]='Quote goes here'; Quote[287]='Quote goes here'; Quote[288]='Quote goes here'; Quote[289]='Quote goes here'; Quote[290]='Quote goes here'; Quote[291]='Quote goes here'; Quote[292]='Quote goes here'; Quote[293]='Quote goes here'; Quote[294]='Quote goes here'; Quote[295]='Quote goes here'; Quote[296]='Quote goes here'; Quote[297]='Quote goes here'; Quote[298]='Quote goes here'; Quote[299]='Quote goes here'; Quote[300]='Quote goes here'; Quote[301]='Quote goes here' Quote[302]='Quote goes here' Quote[303]='Quote goes here'; Quote[304]='Quote goes here'; Quote[305]='Quote goes here'; Quote[306]='Quote goes here'; Quote[307]='Quote goes here'; Quote[308]='Quote goes here'; Quote[309]='Quote goes here'; Quote[310]='Quote goes here'; Quote[311]='Quote goes here'; Quote[312]='Quote goes here'; Quote[313]='Quote goes here'; Quote[314]='Quote goes here'; Quote[315]='Quote goes here'; Quote[316]='Quote goes here'; Quote[317]='Quote goes here'; Quote[318]='Quote goes here'; Quote[319]='Quote goes here'; Quote[320]='Quote goes here'; Quote[321]='Quote goes here'; Quote[322]='Quote goes here'; Quote[323]='Quote goes here'; Quote[324]='Quote goes here'; Quote[325]='Quote goes here'; Quote[326]='Quote goes here'; Quote[327]='Quote goes here'; Quote[328]='Quote goes here'; Quote[329]='Quote goes here'; Quote[330]='Quote goes here'; Quote[331]='Quote goes here'; Quote[332]='Quote goes here'; Quote[333]='Quote goes here'; Quote[334]='Quote goes here'; Quote[335]='Quote goes here'; Quote[336]='Quote goes here'; Quote[337]='Quote goes here'; Quote[338]='Quote goes here'; Quote[339]='Quote goes here'; Quote[340]='Quote goes here'; Quote[341]='Quote goes here'; Quote[342]='Quote goes here'; Quote[343]='Quote goes here'; Quote[344]='Quote goes here'; Quote[345]='Quote goes here'; Quote[346]='Quote goes here'; Quote[347]='Quote goes here'; Quote[348]='Quote goes here'; Quote[349]='Quote goes here'; Quote[350]='Quote goes here'; Quote[351]='Quote goes here'; Quote[352]='Quote goes here'; Quote[353]='Quote goes here'; Quote[354]='Quote goes here'; Quote[355]='Quote goes here'; Quote[356]='Quote goes here'; Quote[357]='Quote goes here'; Quote[358]='Quote goes here'; Quote[359]='Quote goes here'; Quote[360]='Quote goes here'; Quote[361]='Quote goes here'; Quote[362]='Quote goes here'; Quote[363]='Quote goes here'; Quote[364]='Quote goes here'; Quote[365]='Quote goes here'; function writeQuote() { document.getElementById("dayQuote").innerHTML = '<b>Quote Of The Day #'+DOY+'</b><br>'; document.getElementById("dayQuote").innerHTML += Quote[DOY]; }
  2. Is javascript navigation effective and smart? In one of my old web pages I used javascript for navigation. The code is listed below. I have knowledge of PHP includes. Currently I do not have web hosting which allows PHP(bills are tight so I opted for temporary free hosting). Would my below code be a good temporary fix until I can pay for hosting and use PHP includes? Are there any other methods? I appreciate all the help and/or ideas. var arrow = '<span>» </span>'; var clearance = 0; home = new Array(); home[1]= "<span class='asep'>Welcome</span>"; home[2]="<a href='#'>"+arrow+"Home</a>"; home[4]="<a href='http://safepiercing.org/en/piercing/body-aftercare' target='_blank'>"+arrow+"Piercing Aftercare [APP]</a>"; home[5]="<a href='#'>"+arrow+"Contact Us</a>"; computers = new Array(); computers[0]="<span class='asep'>Body Jewelry</span>"; if(clearance == 1) { computers[1]="<a href='#'>"+arrow+"Clearance</a>"; } computers[2]="<a href='#'>"+arrow+"New Arrivals</a>"; computers[3]="<a href='#'>"+arrow+"On Sale</a>"; computers[4]="<a href='#'>"+arrow+"Dermal Anchors</a>"; computers[5]="<a href='#'>"+arrow+"Barbells & Tongue Rings</a>"; computers[6]="<a href='#'>"+arrow+"Navel Rings</a>"; computers[7]="<a href='#'>"+arrow+"Non-Piercing Jewelry</a>"; computers[8]="<a href='#'>"+arrow+"Curved & Eyebrow Rings</a>"; computers[9]="<a href='#'>"+arrow+"Labret & Monroe Rings</a>"; computers[10]="<a href='#'>"+arrow+"Nipple Rings</a>"; computers[11]="<a href='#'>"+arrow+"Horse Shoes</a>"; computers[12]="<a href='#'>"+arrow+"Plugs & Tunnels</a>"; computers[13]="<a href='#'>"+arrow+"Guaged Tapers</a>"; computers[14]="<a href='#'>"+arrow+"Captive Bead Rings(CBR)</a>"; computers[15]="<a href='#'>"+arrow+"Twists & Hoops</a>"; computers[16]="<a href='#'>"+arrow+"Nose Rings</a>"; computers[17]="<a href='#'>"+arrow+"Retainers</a>"; computers[18]="<a href='#'>"+arrow+"Body Jewelry Parts</a>"; computers[19]="<a href='#'>"+arrow+"Skin Divers</a>"; computers[20]="<a href='#'>"+arrow+"Cartilage & Tragus</a>"; computers[21]="<a href='#'>"+arrow+"Fake Plugs & Tapers</a>"; computers[22]="<a href='#'>"+arrow+"316L Stainless Steel</a>"; computers[23]="<a href='#'>"+arrow+"Surgical Steel</a>"; computers[24]="<a href='#'>"+arrow+"Titanium Body Jewelry</a>"; computers[25]="<a href='#'>"+arrow+"Acrylic Body Jewelry</a>"; computers[26]="<a href='#'>"+arrow+"Organic Body Jewelry</a>"; computers[27]="<a href='#'>"+arrow+"Bio-Flex/PTFE</a>"; control = new Array(); control[1]="<span class='asep'>User Controls</span>"; control[2]="<a href='#' onclick='window.print(); return false'>"+arrow+"Print This Page</a>"; control[3]="<a href='#' onclick='addbookmark(location.href,document.title);'>"+arrow+"Bookmark Us</a>"; if(navigator.appName == "Microsoft Internet Explorer") { control[4]="<a href='#' onclick='setHomepage(\"http://google.com\");'>"+arrow+"Set As Homepage</a>"; } function writeLinks() { document.getElementById('homelinks').innerHTML = home.join(""); document.getElementById('computerslinks').innerHTML = computers.join(""); document.getElementById('usercontrol').innerHTML = control.join(""); } setTimeout(writeLinks, 0); // Fires the function on page load without stopping other loads
  3. Hey guys I'm at a bit of a snag. I have a script on this page [ http://vampire-news.webs.com/quote.htm ] which is supposed to show a different quote each day of the year. I have an array of 366(for leap years so the script does not fail) quotes. Each day it should display a different one. To write the quote I have a div with an ID of dayQuote and I am using document.getElementById("dayQuote").innerHTML = Quote[DOY]; to write the quote to the desired div. The issue is it doesn't work. In Chromes javascript console I get the following error "Uncaught TypeError: Cannot set property 'innerHTML' of null" I don't know what I am doing wrong. Thanks for any help.
  4. Hey guys I am currently updating my site and in all honestly I suck at javascript. My site is located at http://vampire-news.webs.com . At the top my main banner sits in the middle. I am truly considering moving my banner to the left side of the header and adding a quote of the day(or something else useful) to the right side to fill the gap. I used to have a script that did this and it worked perfectly. The issue I cannot think of a way around is a quote every day for 365 days. Can javascript use get date() and use an array of 365 objects to display a different one each day? Any help is appreciated. If I made no sense I apologize.
  5. I've got a foreach ($acct as $val){ $acc_s = explode(',',$val["access_type"]); } The value of ACC will Array from every foreach var_dump($acc_s); Output: array(1) { [0]=> string(1) "1" } array(2) { [0]=> string(1) "1" [1]=> string(1) "2" } array(2) { [0]=> string(1) "3" [1]=> string(1) "4" } array(1) { [0]=> string(1) "3" } My question is, how do I make a condition if the value of the "explode" element have 1 or 2 or 3 or 4. I'd try. for($i=0;$i<count($acc_s);$i++){ $out_acc = $acc_s[$i]; } But it won't give me the right output to what I need.
  6. When I submit my form, it limits the update to 1 character. For example if I put "Description" as the description, it inserts "d" in the database. What is wrong with my code? $size = count($_POST['checkbox']); // start a loop in order to update each record $i = 0; while ($i < $size) { // define each variable $title2= $_POST['title'][$i]; $description2= $description[$i]; $edit= $_POST['checkbox'][$i]; mysql_query("UPDATE `categories` SET `title`='$title2',`description`='$description2' WHERE id ='$edit'"); ++$i; }
  7. Any one please help me... I have three input type file in the form and the values are passed to a function if(isset($_POST['submit'])=='submit') { $result=$obj->insertdata($_POST); } ..form <form method="post" enctype="multipart/form-data"> <input type="file" name="f_image" style="width:220px;"/> <input type="file" name="ev_image" style="width:220px;"/> <input type="file" name="ga_thumb_image" style="width:220px;"/> My question is how do I send the value of each file one by one to this function public function file_upload($a, $b, $c) { print_r($a); } from the below function public function insertdata($a) { $ev_banner=self::file_upload($_FILES['ev_image'],'ev_image','gallery/banner'); } the answer i am getting is Array ( [f_image] => Array ( [name] => [type] => [tmp_name] => [error] => 4 => 0 ) [ev_image] => Array ( [name] => 027.JPG [type] => [tmp_name] => [error] => 1 => 0 ) [ga_thumb_image] => Array ( [name] => [type] => [tmp_name] => [error] => 4 => 0 ) I only want Array ( [name] => 027.JPG [type] => [tmp_name] => [error] => 1 => 0 ) this out put Please help
  8. Hello all! I want to format my post array so that I can insert the data into the database in a particular way such as this: Also, I'm making this dynamic in that I'm not always going to know the column names. So hardcoding the keys is not an option for this solution. INSERT INTO invoice_items (itemCode, itemDesc, itemQty, itemPrice, itemLineTotal) VALUES (1000', Widget0', 10', '25.00', '900.54), (1001', Widget1', 11', '25.01', '900.54), (1002', Widget2', 12', '25.02', '900.54) BUT my current output looks like this. Which is not right of course: INSERT INTO invoice_items (itemCode, itemDesc, itemQty, itemPrice, itemLineTotal) VALUES (1000', '1001', '1003), (Widget', 'Red Hat', 'ioPad with Cover), (1', '2', '3), (100.5', '25.02', '300.18), (25.02', '600.36', '900.54); I don't think I'm that far from having a solution but I can't wrap my head around how to get the output the way I need it. The original $_POST Array: Array ( [itemCode] => Array ( [0] => 1000 [1] => 1001 [2] => 1003 ) [itemDesc] => Array ( [0] => Widget [1] => Red Hat [2] => ioPad with Cover ) [itemQty] => Array ( [0] => 1 [1] => 2 [2] => 3 ) [itemPrice] => Array ( [0] => 100.5 [1] => 25.02 [2] => 300.18 ) [itemLineTotal] => Array ( [0] => 100.50 [1] => 50.04 [2] => 900.54 ) ) Here's the loop that creates the following arrays: $fields = $values = array(); foreach ($post as $column => $value) { $fields[] = $column; $value = implode("', '", $value); $values[$column] = $value; } $columns Array: Array ( [0] => itemCode [1] => itemDesc [2] => itemQty [3] => itemPrice [4] => itemLineTotal ) $values Array: Array ( [itemCode] => 1000', '1001', '1003 [itemDesc] => Widget', 'Red Hat', 'ioPad with Cover [itemQty] => 1', '2', '3 [itemPrice] => 100.5', '25.02', '300.18 [itemLineTotal] => 25.02', '600.36', '900.54 ) Create the sql statement: $query = "INSERT INTO " . $this->table ; $query .= " (" . implode(", ", $fields) . ") "; $query .= "VALUES (" . implode("), (", $values) . "); "; Which outputs this: INSERT INTO invoice_items (itemCode, itemDesc, itemQty, itemPrice, itemLineTotal) VALUES (1000', '1001', '1003), (Widget', 'Red Hat', 'ioPad with Cover), (1', '2', '3), (100.5', '25.02', '300.18), (25.02', '600.36', '900.54); THANK YOU for any help you can provide me!
  9. Hello, I have been trying to figure out how to write a certain php query and for the life of me I can not figure it out. I've tried searching on google like a mad man and still can not figure it out. Maybe Im missing something, Im not sure. I came across this site while googlin for answers. The php code is for a wordpress site I am working on. Here is my current code - <?php $custom_terms = get_terms('videoscategory'); $other_custom_terms = get_terms('product_category'); foreach(array($custom_terms as $custom_term) { wp_reset_query(); $args = array('post_type' => 'product', 'tax_query' => array( 'relation' => 'AND', array( 'taxonomy' => 'videoscategory', 'field' => 'slug', 'terms' => $custom_term->slug ), array( 'taxonomy' => 'product_category', 'field' => 'slug', 'terms' => $other_custom_term->slug ), ) ); $loop = new WP_Query($args); if($loop->have_posts()) { echo '<h1 style="margin-top:10px;">'.$custom_term->name.'</h1>'; while($loop->have_posts()) : $loop->the_post(); echo '<h2><a href="'.get_permalink().'">'.get_the_title().'</a></h2>'; endwhile; } } ?> Im trying to list all the posts that are in both of my custom taxonomies, however when I try using the code nothing shows but when I use 1 taxonomy at a time, with one array, it works perfectly. Someone on gave me some advice but I do not understand it - generate array of your second taxonomy terms and feed it into the query - What exactly is that advice telling me to do? Any help is appreciated. Thanks.
  10. Hi. I need help on how should I print the results using a foreach loop or for loop in a multi-dimensional array. The output should be something like this: ---------------------------------- CustomerNumber CustomerName - Phone - Address ---------------------------------- and if there is a two CustomerName but a same CustomerName, output should be like this: ---------------------------------- CustomerNumber CustomerName - Phone - Address CustomerName - Phone - Address ---------------------------------- Please need help..Thanks... Here is sample of my code: <?php include 'mysql_connect.inc'; echo "</br></br>"; $query = "SELECT * FROM customers"; $result = mysqli_query($conn, $query); while($row = mysqli_fetch_array($result)) { $header = $row["customerNumber"]; $details = $row["customerName"]."^".$row["phone"]."^".$row["addressLine1"]; $array[$header][$details] = "header & details"; } foreach($array as $arr1){ $key = key($arr1); echo $key."</br>"; } echo "<hr></br>test by: Lloyd Liongson"; ?>
  11. I can't figure out what's wrong with this. The program works, but the deduplication doesn't work. The error I get is : Warning: in_array() [function.in-array]: Wrong datatype for second argument in line 67. I bolded line 67 below, which is an if (in_array ) statement. in_array wants an array for the second argument, which I have, so don't see the problem. Any suggestions? TIA ---------------------------------------------------------------------- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Song Organizer</title> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" /> </head> <body> <h1>Song Organizer</h1> <?php // handle parameters in the URL if (isset($_GET['action'])) { if ((file_exists("SongOrganizer/songs.txt")) && (filesize("SongOrganizer/songs.txt") != 0)) { $SongArray = file("SongOrganizer/songs.txt"); // menu for Deduplication, Sort, Shuffle switch ($_GET['action']) { case 'Remove Duplicates': $SongArray = array_unique($SongArray); $SongArray = array_values($SongArray); break; case 'Sort Ascending': sort($SongArray); break; case 'Shuffle': shuffle($SongArray); break; } // end of switch statement // save the song list after it has been modified if (count($SongArray) > 0) { $NewSongs = implode($SongArray); $SongStore = fopen("SongOrganizer/songs.txt", "wb"); if ($SongStore === false) echo "There was an error updating the song file\n"; else { fwrite($SongStore, $NewSongs); fclose($SongStore); } } else unlink("SongOrganizer/songs.txt"); } } // read song file data into the $ExistingSongs array if (isset($_POST['submit'])) { $SongToAdd = stripslashes($_POST['SongName']) . "\n"; $ExistingSongs = array(); if (file_exists("SongOrganizer/songs.txt") && filesize("SongOrganizer/songs.txt") > 0) { $ExistingSongs = file("SongOrganizer/songs.txt"); } } // check to see if the song name entered is already in the song list // this is where it has a problem. if (in_array($SongToAdd, $ExistingSongs)) { echo "<p>The song you entered already exists!<br />\n"; echo "Your song was not added to the list.</p>"; } // add new song to the list file else { $SongFile = fopen("SongOrganizer/songs.txt", "ab"); if ($SongFile === false) echo "There was an error saving your message!\n"; else { fwrite($SongFile, $SongToAdd); fclose($SongFile); echo "Your song has been added to the list.\n"; } } // display the song list, or empty message if song list is empty if ((!file_exists("SongOrganizer/songs.txt")) || (filesize("SongOrganizer/songs.txt") == 0)) echo "<p>There are no songs in the list.</p>\n"; else { $SongArray = file("SongOrganizer/songs.txt"); echo "<table border=\"1\" width=\"100%\" style=\"background-color:lightgray\">\n"; foreach ($SongArray as $Song) { echo "<tr>\n"; echo "<td>" . htmlentities($Song) . "</td>"; echo "</tr>\n"; } echo "</table>"; } ?> <!-- Show hyperlinks for the three functions in the switch statement (Sort, Remove Dups, Shuffle) --> <p> <a href="SongOrganizer.php?action=Sort%20Ascending">SortSong List</a><br /> <a href="SongOrganizer.php?action=Remove%20Duplicates">Remove Duplicate Songs</a><br /> <a href="SongOrganizer.php?action=Shuffle">Shuffle Song List</a><br /> </p> <!-- web form for entering new song names into the song list --> <form action="SongOrganizer.php" method="post"> <p>Add a New Song</p> <p>Song Name: <input type="text" name="SongName" /></p> <p><input type="submit" name="submit" value="Add Song to List" /> <input type="reset" name="reset" value="Reset Song Name" /></p> </form> </body> </html>
  12. MFA

    foreach error

    Hi I have made the code below that outputs the contents of a CSV file into a table. The code works fine however on my server host CGI error log, it says PHP Warning: Invalid argument supplied for foreach() in "my_php_file_name" on line 83 do { $array = fgetcsv($filehandle, 65, ","); echo "<tr>"; foreach ($array as $tableformat) { echo "<td>".$tableformat."</td>"; } echo "</tr>"; $nextrow++; } while ($nextrow <= $lines); $lines refers to the number of lines in the CSV file and $nextrow represents the integer value 0. Although it is working, could someone please explain to me why this message appears so that I can correct it and learn from this experience. Thank you.
  13. Hello phpfreaks community, I really need your advice regarding this situation. In this program what i wanted is to fetch data from the database (sols.sql then grade_summary table) and show it in form18af.php by submit button from another page. Note: - subjects are dynamic - name of students appear more than once in the table - form18af.php is currently static - other tables were truncated from the system Please, i need your help and forgive me if my coding is noobish. Yeah, my friend suggested using arrays but i can't grasp the logic.. help.zip
  14. Is there any way to transform an array looking like this: Array ( [level-1] => 2 [quarter-1] => 1 [year-1] => 2014 [level-2] => 2 [quarter-2] => 2 [year-2] => 2015 [level-49] => 2 [quarter-49] => 2 [year-49] => 2015 [level-58] => 1 [quarter-58] => 1 [year-58] and take only the numbers after the keywords to use them in an sql table. For example, the table would look like: ID 1 Level 2 Quarter 1 Year 2014 ID 2 level 2 quater 2 Year 2015 ID 49 level 2 quarter 2 year 2015 Etc
  15. I've been working on the delete item from cart functionality all day. Still cannot figure this out. When I add 2+ items to my cart, and try to delete any item but the last item added, the script deletes the listing the last item added no matter which one I'm attempting to delete. I could do this in C++ but the php solution is evading me. This has frustrated me today for over 4 hours just this one little problem. Can somebody please shine light on this for me, to help me see why I'm so close to finishing the delete functionality but it won't quite work. Here's my code: header.html (included in cart at top): session_start(); // For personal debugging -- REMOVE WHEN DONE // if ($_GET['des']) { session_destroy(); unset($_GET['des']); } // ---- // // Count Cart Items // if (empty($_SESSION['count_cart'])) { $_SESSION['count_cart'] = 0; } // Handle Delete Item // if ($_POST['submitted']) { $_SESSION['count_cart']--; $delItem = $_POST['delItem']; unset($_SESSION['item'][$delItem]); unset($_POST['submitted']); } // Handle setting sessions // if ($_POST['name'] == $PHPSESSID && isset($_POST['mdl_key'])) { $idx = $_SESSION['count_cart']; $_SESSION['count_cart']++; $_SESSION['item'][$idx][0] = $_POST['mdl_key']; $_SESSION['item'][$idx][1] = $_POST['model']; $_SESSION['item'][$idx][2] = $_POST['manufacturer']; $_SESSION['item'][$idx][3] = $_POST['sellprice']; $_SESSION['uri'][$idx] = $_POST['uri']; } And here is the code for the shoppingcart_customer.php page where the above is included with include: <form name="del" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>"> <?php $i=0; $count = $i + 1; foreach ($_SESSION['item'] as $key=>$v1) { if (isset($_SESSION['item'][$key])) { echo "<tr><td width='30px'></td><td bgcolor='white'>".$count.".) "; foreach ($v1 as $v2){ echo $v2." "; } } echo " - <a href='".$_SESSION['uri'][$i]."' target='_blank'>View Details</a> | <input type='submit' value='Delete' name='delete'/> <input type='hidden' name='delItem' value='".$i."'/> <input type='hidden' name='submitted' value='TRUE'/> </td><td width='80px'></td></tr>"; $i++; } ?> </form> and here is the html $_POST code: <form enctype="multipart/form-data" action="shoppingcart-customer.php" method="post"> <input type="hidden" name="name" value="<?php echo $PHPSESSID; ?>"/> <input type="hidden" name="mdl_key" value="<?php echo $mdl_key; ?>"/> <input type="hidden" name="model" value="<?php echo $model; ?>"/> <input type="hidden" name="manufacturer" value="<?php echo $manufacturer; ?>"/> <input type="hidden" name="sellprice" value="<?php echo $sellprice; ?>"/> <input type="hidden" name="uri" value="<?php echo $_SERVER['REQUEST_URI']; ?>"/> <input type="submit" name="addtocart" value="Add To Cart" id="hyperlink-style-button"/> </form>
  16. Hi, I am trying to develop a room allocation application, but am struggling a bit to get my head around the coding. I am trying to break it down into small chunks and then maybe see if I can get everything to work together. I have a mysql table which contains a list of users. I have returned the results of the user IDs from my select query into an array. I also have another table which holds a numeric marker. The marker will change. My array of user IDs would look like: Array ( [0] => 1 [1] => 3 [2] => 5 ) My numeric marker could be: 1 What I need to do is do a complete loop through my array starting at the numeric marker position. This would return: [1]=>3 [2]=>5 [0]=>1 As you can see, it jumps back to the beginning of the array and outputs the first element to complete the loop. Depending on the numeric marker and this particular data set, the array could also run like: Marker = 0: [0]=>1 [1]=>3 [2]=>5 Marker = 2: [2]=>5 [0]=>1 [1]=>3 I have had a go at writing the code and if I start at numeric marker 1, I can get it to run to the end of the array. I just have no idea how to reset back to the beginning and run until I reach numeric marker minus 1. Here is what I have so far: $i = $numericMarker; foreach ($userID as $key => $value) { if ($key < $numericMarker) continue; echo '$i = '.$i.' $value = '.$value.'<br />'; $i++; } Any help you can give me would be greatly appreciated. Many thanks, John
  17. Sorry this could sound simple but not getting it. I need help on writing mysql query $sql=mysql_query("SELECT * FROM TABLE WHERE id = ("some array")"); the above query need to be run with id matches with a array of values,the array is say not of definite size. please could someone help
  18. Hello - I'm creating a source code generator and have the following code that loops over an array that creates an object. I want to add a , (comma) to the end of each iteration. Here's what the final output should look like: I have everything generating successfully but adding the , (comma) at the end of each item in the object. var rules1 = { 'fullName' : { required: true }, 'username' : { required: true, email: true }, 'password' : { required: true, minlength: 6, maxlength: 20 } }; How would I iterate over the object and add that comma? Also notice that the last item doesn't have a comma. Here's the source code I have to build the object: var rulesArray = []; $(".InputRulesSection").each(function () { $('.rulesTable').each(function () { var ruleInputName = $('.fieldNameInput', this).val(); var minLength = $('.minLengthInput', this).val(); var maxLength = $('.maxLengthInput', this).val(); var email = $(".email", this).attr("rel"); rulesArray.push( { ruleInputName:ruleInputName, minLengthInput:minLength, maxLengthInput:maxLength, email:email } ); }); }); return rulesArray; Here's the code I have to iterate over the newly created object: for (var i in rulesArray) { var ruleInputVal = rulesArray[i].ruleInputName; var email = rulesArray[i].email; var minLength = rulesArray[i].minLengthInput; var maxLength = rulesArray[i].maxLengthInput; rulesCode += "\t\t '" + ruleInputVal + "' : { \n "; rulesCode += "\t\t\t required: true" + addComma + "\n "; if (email == "email") { rulesCode += "\t\t\t email: true" + addComma + " \n "; } if (minLength > 0) { rulesCode += "\t\t\t minLength: " + minLength + addComma + " \n "; } if (maxLength > 0) { rulesCode += "\t\t\t maxLength: " + maxLength + addComma + " \n "; } rulesCode += "\t\t } \n"; } And finally, here's what I currently generate using the above code: Notice there aren't any commas after each item and keys? That's what I'm stumped on... how to approach it? Any help would be great. Thank you! var rules = { 'username' : { required: true email: true minLength: 6 maxLength: 20 } 'password' : { required: true minLength: 6 maxLength: 20 } };
  19. Dear all, 10 years ago I was a skilled PHP programmer... Now after many years of inactivity I'm facing a newbye problem I can't figure out. I've written this piece of code: $found = array('uno','due', 'tre'); for ($i=0;$i<count($found);$i++){ echo $found[i]; } my output page is empty?? Shouldn't I see unoduetre? I mean I see in the debugger the array is fed and the loop is done!! Please be kind help me out, I feel like daydreaming... BR, Max.
  20. Inside a foreach/as loop, in a nested if loop I have this little nugget: else { $currentRec = current($r); echo "Rec to Kill: $currentRec"; //Testing purposes only - Killing the right thing? unset($r[$currentRec]); } It's not working as I'd expect it to (which would be to kill the current record of my 2d array). Of course, I'm a PHP novice, (more used to working with dbase/foxpro) so there's something in transitioning to PHP's logic that I'm most definitely missing. A nudge in the right direction would be lovely. Thanks!
  21. How do I put condition upon exploding a variable that outputting different values. I've got a $variable from a loop, each loop the variable has a different content(style attribute) . sample content of the variable. . array(6) { [0]=> string(17) "font-family:Arial" [1]=> string(14) "font-size:11px" [2]=> string(13) "color:#000000" [3]=> string(16) "font-weight:bold" [4]=> string(25) "text-decoration:underline" [5]=> string(0) "" } array(4) { [0]=> string(17) "font-family:Arial" [1]=> string(14) "font-size:11px" [2]=> string(13) "color:#000000" [3]=> string(0) "" } array(3) { [0]=> string(15) "padding:1px 2px" [1]=> string(12) "display:none" [2]=> string(0) "" } array(1) { [0]=> string(0) "" } array(3) { [0]=> string(15) "padding:1px 2px" [1]=> string(12) "display:none" [2]=> string(0) "" } so if i'm going to explode it $style = explode(';', $variable); so to print out put; echo $style[0]; right? But how will I going to be more specifi. Like . . $style->font-family, or $style->font-weight Then make a condition etc. .
  22. I've stored entries from a large form into an array, this array I now want to pass to the next page, but when using either "$_GET[ ]" or "$_POST[ ]", I just get in my array 'a','r','r','a','y', then the rest of the array is empty... I've followed all the documentation I can find, but nothing has worked so far; can anybody help? the variable is man[x], all the other variables from the form passed over, perhaps I've not got the syntax right for an array where i declare it in the second file? $man=$_POST['man'];
  23. I've been playing for this and I really can't figure how to count the sub array and post a value: Array ( [1] => Array ( [A] => Hello [b] => [C] => Hello [D] => ) [2] => Array ( [A] => [b] => world! [C] => [D] => world! ) [3] => Array ( [A] => [b] => [C] => [D] => ) [4] => Array ( [A] => Miscellaneous [b] => [C] => [D] => ) [5] => Array ( [A] => List [b] => bump [C] => [D] => ) ) So what I want to happen is: <table> <tbody> <tr> <td>Hello</td><td>B</td><td>Hello</td><td>D</td> </tr> <tr> <td></td><td>world!</td><td></td><td>world!</td> </tr> <tr> <td>A</td><td>B</td><td>C</td><td>D</td> </tr> <tr> <td>A</td><td>B</td><td>C</td><td>D</td> </tr> <tr> <td>A</td><td>B</td><td>C</td><td>D</td> </tr> </tbody> </table> I already count the main array, but I can't get the sub array and post them on a table data w/ each specific value.
  24. Hi Just starting with php... This is the first part of the code: <?php $bestek = array ('vorken' => 5, 'messen' => 6, 'lepels' => 7); $servies = array ('borden' => 5, 'kopjes' => 6, 'schalen' => 2); $keuken = array ('bestek' => $bestek, 'servies' => $servies); echo '<table border=1>'; foreach ($bestek as $key => $value) { echo "<tr>"; echo "<td>". $key."</td>"."<td>".$value."</td>"."<br>\n"; echo "</tr>"; } foreach ($servies as $ke => $valu) { echo "<tr>"; echo "<td>". $ke."</td>"."<td>".$valu."</td>"."<br>\n"; echo "</tr>"; } echo "</table>"; ?> Printing the array's $bestek and $servies is not a problem, but now I want to print the $keuken-array in a table. Can anyone please help me with the code for that? I tried several things, but the result always is: Bestek Array Servies Array Thanks already for your help.
  25. I have several images in a directory, which I would like to output(in an organized way) to the page. I've tried reading all the directory contents, and loading their names into an array to display the images using HTML, but I can't for the life of me figure out how to then position the pictures correctly in CSS. Here's the code: <?php $dirLoc = 'myWebsite/galleryPics'; $handle = opendir($dirLoc); while($readDir = readdir($handle)){ if($readDir != '.' && $readDir != '..'){ $pic[] = $readDir; } } foreach($pic as $k){ echo "<div class = \"picsDiv\">"; echo "<img src = \"$dirLoc/$k\" height = \"100px\" width = \"100px\"/></div>"; } ?> <html> <head> <style type = "text/css"> .picsDiv {width:150px; height:150px; border:1px solid red; background-color:grey;} img {position:relative; top:50%; left:50%; margin-top:-50px; margin-left:-50px;} </style> </head> </html> Thank you in advance for any feedback.
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.