PHP probb.......

Discussion in 'QnA (read only)' started by Butterfly, Dec 21, 2004.

Thread Status:
Not open for further replies.
  1. Butterfly

    Butterfly New Member

    Joined:
    Sep 20, 2004
    Messages:
    87
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    Thimphu
    Folk,

    Its really been a long time am hooked up in this problem, i did manage to make a little change in it ..plz hlp ....belwo is my source code and table.


    Note : Plz run it and u will see what my prob is :(
    ***********************************************************

    <?php
    # FileName="Connection_php_mysql.htm"
    # Type="MYSQL"
    # HTTP="true"
    $hostname_conn = "localhost";
    $database_conn = "tol";
    $username_conn = "root";
    $password_conn = "";
    $conn = mysql_pconnect($hostname_conn, $username_conn, $password_conn) or trigger_error(mysql_error(),E_USER_ERROR);
    ?>

    <?php
    mysql_select_db($database_conn, $conn);
    $query_Recordset1 = "SELECT title, content, link FROM news";
    $Recordset1 = mysql_query($query_Recordset1, $conn) or die(mysql_error());
    $row_Recordset1 = mysql_fetch_assoc($Recordset1);
    $totalRows_Recordset1 = mysql_num_rows($Recordset1);
    ?>
    <table width="200" border="1" cellspacing="0">
    <tr>
    <?php
    do {
    ?>
    <td><?php echo $row_Recordset1['title']; ?></td>
    <?php
    } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1));
    ?>
    </tr>
    <?php
    mysql_data_seek($Recordset1, 0);
    ?>
    <tr>
    <?php
    do {
    ?>
    <td><?php echo $row_Recordset1['content']; ?></td>
    <?php
    } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1));
    ?>
    </tr>
    <?php
    mysql_data_seek($Recordset1, 0);
    ?>
    <tr>
    <?php
    do {
    ?>
    <td><?php echo $row_Recordset1['link']; ?></td>
    <?php
    } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1));
    ?>
    </tr>
    </table>
    <?php
    mysql_free_result($Recordset1);
    ?>
    <div id="mxloopercomment">Generated with MX Looper trial!</div>



    **********************************************************


    # --------------------------------------------------------

    #
    # Table structure for table `news`
    #

    CREATE TABLE `news` (
    `id` int(10) unsigned NOT NULL auto_increment,
    `title` varchar(200) NOT NULL default '',
    `content` longtext NOT NULL,
    `author` varchar(20) NOT NULL default '',
    `link` varchar(100) NOT NULL default '',
    PRIMARY KEY (`id`)
    ) TYPE=MyISAM AUTO_INCREMENT=10 ;

    #
    # Dumping data for table `news`
    #

    INSERT INTO `news` VALUES (1, 'JPEG', 'WindowPCs that are unpatched are vulnerabe to attacks by harmless image files. Picture in the JPEG ', 'karma', '/more.php');
    INSERT INTO `news` VALUES (3, 'Thsechu', '<img src=http://localhost/tol.com/images/mask.jpg width=47 height=47 border=1>\r\n <img src=http://localhost/tol.com/images/phob.jpg width=47 height=47 border=1>
    \r\nForm of arts and craft through \r\n centuries of influence by its culture...', 'BlasterZalmon', 'BlasterZalmon');
    INSERT INTO `news` VALUES (4, 'Highlights', '<img src=http://localhost/tol.com/images/mask.jpg width=47 height=47 border=1>\r\n <img src=http://localhost/tol.com/images/phob.jpg width=47 height=47 border=1>
    \r\nForm of arts and craft through \r\n centuries of influence by its culture...', 'asasa', 'sasasa');
     
  2. ironcross77

    ironcross77 New Member

    Joined:
    Nov 20, 2004
    Messages:
    46
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    India
    i have run the script and it seems to be ok.....
    Still i am not an expert in php.
     
  3. OP
    OP
    Butterfly

    Butterfly New Member

    Joined:
    Sep 20, 2004
    Messages:
    87
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    Thimphu
    Iron,

    Thanks for going through, yeah its working fine , but something is wrong in it , did u find any thing odd at the top row of the table ,....

    like say, it has to to 3 colums and 3 rows, in that one extra is added and the top of the "tile" its in wrong place ..

    can u do that for me plz....thanks a lot

    happy christmas and newyear too
     
  4. OP
    OP
    Butterfly

    Butterfly New Member

    Joined:
    Sep 20, 2004
    Messages:
    87
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    Thimphu
    Hellow Wake Up Folks
     
Thread Status:
Not open for further replies.

Share This Page