Jump to content

Search the Community

Showing results for tags 'array php'.

  • 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. Hi I have a data set that is coming from a db table like this science, p1, some text science, p2, some more text maths, p1, some text maths, p2, some more text All together that are going to be around 200 entries. These are subject descriptions/levels that will be written out into documents for pupils class reports. I am trying to create an array that looks like this: $descriptors = [ 'science' => [ 'p1' => 'text', 'p2' => 'more text' ], 'maths; => [ 'p1'=> 'text', 'p2'=> 'more text'. ] etc etc ]; At the moment i have an array $subject_list which goes 'Speaking', 'Science', 'Maths' etc I loop through the $subject_list and perform a query which returns the subject, the grade(the p1 bit) and the text How do I turn this data in the 2d array shown above. I am trying to put an array with a name into an array but I can't figure it out. This is as far as I could get $desc[]=array('subject'=>$sub, 'grade'=>$row['grades'], $row['descriptor']); but this is creating an array which has about 200 arrays in it - all with 3 items - not what I want How can I do this please
  2. <?php session_start(); $_SESSION['cart']=array(); include("config.php"); ?> <?php $query=mysql_query("select * from answers"); while($result=mysql_fetch_array($query)) { ?><a href="m.php?cart=<?php echo $result['answer']; ?>&hello=yes"><?php echo $name= $result['answer'];?></a><br /><?php } if (isset($_REQUEST['hello'])) { $prod_id=$_REQUEST['cart']; array_push($_SESSION['cart'],$prod_id); } ?> <?php foreach($_SESSION['cart'] as $value) { echo $value; ?><br /><?php } ?> thanks..
×
×
  • 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.