+ Reply to Thread
Page 1 of 2 12 LastLast
Results 1 to 10 of 14

Thread: Anyone good with PHP

  1. #1
    KSclans is offline x10 Sophmore KSclans is an unknown quantity at this point
    Join Date
    Nov 2007
    Posts
    198

    Anyone good with PHP

    db.php is a file that connect to my database
    and I trying to array subtitle byline and content that is from clanwebs

    PHP Code:
    <?php

    require_once 'db.php';

    $result mysql_query("SELECT subtitle, byline, content FROM post WHERE `name` ='clanwebs'");
    $boxes = array();
    while (
    $row mysql_fetch_assoc($result))
    {
      
    $new_box = array('subtitle' => $row['subtitle'], 'content' => $row['content'],  'byline' => $row['byline']);
      
    $boxes[] = $new_box;
    }
    $content['boxes'] = $boxes;

    echo 
    "[$boxes]";

    ?>
    but then I echo the variable boxes and all it show is Array, not the stuff that i array the word Array

    why it showing the word array like i echo 'array' instead pf echo '$boxes'

  2. #2
    tittat's Avatar
    tittat is offline x10 Spammer tittat is an unknown quantity at this point
    Join Date
    Sep 2007
    Location
    Kerala,India
    Posts
    2,479

    Re: Anyone good with PHP

    ****Thread Moved to Programming Help*****
    PLAY ONLINE GAMES
    WWW.TMONDO.COM PlayFar Flash Games
    Former X10 Forum Senior Moderator(Retired)


  3. #3
    natsuki's Avatar
    natsuki is offline x10 Sophmore natsuki is an unknown quantity at this point
    Join Date
    Sep 2008
    Posts
    112

    Re: Anyone good with PHP

    because the string value of an array is "Array". If you want the contents try var_dump($boxes) or print($boxes)

  4. #4
    KSclans is offline x10 Sophmore KSclans is an unknown quantity at this point
    Join Date
    Nov 2007
    Posts
    198

    Re: Anyone good with PHP

    Nevermind my friend tell me the answer
    but he say loopeach on it because it a looping array

  5. #5
    dickey's Avatar
    dickey is offline x10 Sophmore dickey is an unknown quantity at this point
    Join Date
    Sep 2008
    Location
    Singapore
    Posts
    128

    Re: Anyone good with PHP

    You need loops to do the manipulations but if you just want to check contents print_r($boxes) would do.
    Don't get me wrong as I believe if and when I help someone I also help myself whereby whatever someone learns I also learn.

    But I will also accept credits or reps if you really want to part with it.

  6. #6
    lordskid is offline x10Hosting Member lordskid is an unknown quantity at this point
    Join Date
    Mar 2008
    Posts
    41

    Re: Anyone good with PHP

    I didn't know that command print_r... what exactly does it do?

  7. #7
    KSclans is offline x10 Sophmore KSclans is an unknown quantity at this point
    Join Date
    Nov 2007
    Posts
    198

    Re: Anyone good with PHP

    I need a box(es) that have one title and muti content like this

    My Title
    1. hello
    2. hi
    3. bye
    My 2nd Title
    1. ,,dfd,
    2. llddfl

    something like that... and i create a table for this kind of table name ol (CSS div class)
    and have field name title content

    but I have 3 content (maybe more depend on what users want)

    should I have 3 row for the array ? like

    name title content
    ----------------------------------
    clanwebs HI hello
    clanwebs HI hi
    clanwebs Hi bye

    but in array how do I tell the browser that row that have the same title is one box

    for each box that have 1 title and 1 content
    I select the boxes that belong to the user

    SELECT subtitle, byline, content FROM post WHERE `name` ='clanwebs'");


    but what i put for 1 title and muti content?
    how do i select "the same" title ...

  8. #8
    xmakina's Avatar
    xmakina is offline x10 Lieutenant xmakina is an unknown quantity at this point
    Join Date
    May 2008
    Location
    England
    Posts
    265

    Re: Anyone good with PHP

    You either want to just make sure the <td>'s occur in the same place or use <br /> to add a line break.

    Although I don't think this is what you want (both are incredibly simple solutions) but your english is so broken I'm confused as to what your after. Perhaps you can provide an example on the internet or draw what your after and upload it?
    IF($this->$post.content() == "SEE SIG"){
    w3Schools and Google
    }

  9. #9
    phpasks is offline x10 Sophmore phpasks is an unknown quantity at this point
    Join Date
    Apr 2008
    Posts
    145

    Thumbs up Re: Anyone good with PHP

    HTML Code:
    <Table>
    <Tr>
    <Td>My Title</td>
    </tr>
    <Tr>
    <Td>1. hello</td>
    </tr>
    <Tr>
    <Td>2. hi</td>
    </tr>
    <Tr>
    <Td>3. bye</td>
    </tr>
    <Tr>
    <Td> My 2nd Title</td>
    </tr>
    <Tr>
    <Td>1. ,,dfd,</td>
    </tr>
    <Tr>
    <Td>2. llddfl
    You can use this way or Your Array
    PHP Code:
    <?php
    echo "<Table>";
    while(list(
    $key$val) = each($array_name))
    {
          echo 
    "<tr><Td>".$val.</td></tr>
    }
    echo 
    "</table>";
    ?>
    Quote Originally Posted by KSclans View Post
    I need a box(es) that have one title and muti content like this

    My Title
    1. hello
    2. hi
    3. bye
    My 2nd Title
    1. ,,dfd,
    2. llddfl

    something like that... and i create a table for this kind of table name ol (CSS div class)
    and have field name title content

    but I have 3 content (maybe more depend on what users want)

    should I have 3 row for the array ? like

    name title content
    ----------------------------------
    clanwebs HI hello
    clanwebs HI hi
    clanwebs Hi bye

    but in array how do I tell the browser that row that have the same title is one box

    for each box that have 1 title and 1 content
    I select the boxes that belong to the user

    SELECT subtitle, byline, content FROM post WHERE `name` ='clanwebs'");


    but what i put for 1 title and muti content?
    how do i select "the same" title ...
    Asif Khalyani
    http://www.phpasks.com

  10. #10
    KSclans is offline x10 Sophmore KSclans is an unknown quantity at this point
    Join Date
    Nov 2007
    Posts
    198

    Re: Anyone good with PHP

    I know my english is not that good, but... from the top first post
    Quote Originally Posted by KSclans View Post
    db.php is a file that connect to my database
    and I trying to array subtitle byline and content that is from clanwebs

    PHP Code:
    <?php

    require_once 'db.php';

    $result mysql_query("SELECT subtitle, byline, content FROM post WHERE `name` ='clanwebs'");
    $boxes = array();
    while (
    $row mysql_fetch_assoc($result))
    {
      
    $new_box = array('subtitle' => $row['subtitle'], 'content' => $row['content'],  'byline' => $row['byline']);
      
    $boxes[] = $new_box;
    }
    $content['boxes'] = $boxes;

    ?>
    I am using template separate HTML with PHP
    ===================================
    Now I want

    I need a box(es) that have one title and muti content like this

    My Title
    1. hello
    2. hi
    3. bye
    My 2nd Title
    1. ,,dfd,
    2. llddfl

    something like that... and i create a table for this kind of table name ol (CSS div class)
    and have field name title content

    but I have 3 content (maybe more depend on what users want)

    should I have 3 row for the array ? like

    name title content
    ----------------------------------
    clanwebs HI hello
    clanwebs HI hi
    clanwebs Hi bye

    but in array how do I tell the browser that row that have the same title is one box

    for each box that have 1 title and 1 content
    I select the boxes that belong to the user

    SELECT subtitle, byline, content FROM post WHERE `name` ='clanwebs'");


    but what i put for 1 title and muti content?
    how do i select "the same" title ...


    Does it make sense now?

    anyway so array the table in database like that it will show


    HI
    hello
    HI
    hi
    Hi
    bye


    (it won't show clanwebs (username) because i use it to select which row to show so the browser will only show the row that belongs to the user.)

    but what code can tell the browser to only display the same title only once and then display its content

    Hi (title )
    Hello (content)
    hi (content)
    bye (content)
    Last edited by KSclans; 11-11-2008 at 09:38 AM.

+ Reply to Thread
Page 1 of 2 12 LastLast

Similar Threads

  1. Any good PHP websites?
    By soten355 in forum Scripts & 3rd Party Apps
    Replies: 10
    Last Post: 01-29-2009, 09:47 AM
  2. Cambios IMPORTANTES en PHP.
    By Fedlerner in forum Noticias y Anuncios
    Replies: 1
    Last Post: 11-06-2007, 11:13 AM
  3. Sigo con problemas con phpbb2
    By reciecho in forum Soporte
    Replies: 7
    Last Post: 10-20-2007, 06:28 PM
  4. "PHP Startup: Invalid Library" - Interesting error
    By javaguy78 in forum Free Hosting
    Replies: 5
    Last Post: 03-27-2007, 02:33 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers