SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Threaded View

  1. #1
    SitePoint Guru
    Join Date
    Feb 2007
    Posts
    731
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    Multi-Dimensional Array, Almost There

    Hi,

    I have been trying to complete a multidimensional array. It currently dumps the whole array but it wont echo individual rows which are the last 3 lines.

    Can anyone please advise how I can echo just single rows instead of the whole array?


    PHP Code:
    <?php
        
    if(isset($_GET['skill'])) {
            
    $skills $_GET['skill'];
            
            
    $sql "SELECT * FROM users WHERE skill1 = '$skills'";
            
    $res mysql_query($sql) or die(mysql_error());
            
    //This will return one row, is that what you want?
            //    $row = mysql_fetch_assoc($res); 
            //    $num_rows = mysql_num_rows($res); 
            
            //in your job post it sounds like the query would retutn multiple rows.
            //this will loop the resut of the query.
            
    while ($row mysql_fetch_assoc($res)) {
                
    var_dump($row);
                echo 
    $firstname;
            }
        }

    ?>



    <?php echo (!empty($row['skill1'])) ? $row['skill1'] : ''?>
    <?php 
    echo $skill1?>
    <?php 
    echo $skill?>
    Last edited by SpacePhoenix; Apr 9, 2013 at 11:24. Reason: placed php tags around php code


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •