Jump to content

Search the Community

Showing results for tags 'multi dimensional array'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • 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

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 2 results

  1. I am creating a dynamic human readable sitemap from mysql>php. the array is created with; (array structure can be altered if this is causing the grief) <?php $row['category'] = varchar; // list of 10 categories $row['status'] = int; // 0,1 or 2 $row['id'] = int; // 1,2,3,4... (AI) // set the title for link $this->sitemap[$row['category']][$row['status']]['title'][$row['id']] = $row['seo_title']; // set the url for link $this->sitemap[$row['category']][$row['status']]['url'][$row['id']] = $row['slug'].".php"; ?> My required output to be as; <ul> <li>category[0] <ul> // all category[0][2] <li><a href="category[0][2]['title']['the row id']">category[0][2]['title']['the row id']</a></li> etc... // all category[0][1] <ul> <li><a href="category[0][1]['title']['the row id']">category[0][1]['title']['the row id']</a></li> etc.... // all category[0][0] <ul> <li><a href="category[0][0]['title']['the row id']">category[0][0]['title']['the row id']</a></li> </ul> </ul> <li>category[1] <ul> // all category[1][2] <li><a href="category[1][2]['title']['the row id']">category[1][2]['title']['the row id']</a></li> etc... keep in mind where caetgory[0] is a string as key, not an integer. Any ideas or questions welcomed, thanks.
  2. Hi, I decided to learn PHP & MySQL from scratch with "PHP & MySQL in Easy Steps" by Mike McGrath. Page 35 is a tutorial on Describing Dimensions. I think I've done exactly what it says, but my output is weird. The php code I wrote: <?php $letters = array('A','B','C','D','E','F','G'); $numbers = array(1,2,3,4,5,6); $matrix = array('Letters'=> $letters,'Number'=> $numbers); echo "<p>Start: {$matrix['Letter'][0]}</p>"; foreach($matrix as $array => $list) { echo '<ul>'; foreach($list as $key => $value) {echo "<li>$array[$key]=$value";} echo '</ul>'; } ?> According to the book should display like this: Start: A - Letter [0] = A - Letter [1] = B - Letter [2] = C - Number[0] = 1 - Number[1] = 2 - Number[2] = 3 I've checked my code twice. And had a friend check it. Can't find a difference between the book and my code, yet mine appears like this: Start: L=A e=B t=C t=D e=E r=F s=G N=1 u=2 m=3 b=4 e=5 r=6 What's wrong with it!?
×
×
  • 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.