14-12-2004, 11:42 AM
|
#1 (permalink)
|
|
Apprentice
Join Date: Sep 2004
Location: Thimphu
Posts: 87
|
Ok Dude,
I wanted php record set , i can get the data from database very easily but am not gettting the data in the wayu i wanted it ..
this is wat oi get from database ,
Tile|Content| Link
Tile|Content|Link
Tile|Content| Link
what my want is not in vertical i wanted in horizantol loop, like this
Titile1 | Titile2 | Titile2 |
Content|Content|Content|
Link | Link Link | Link Link
in this way , if u dont get me , let me mail u
__________________
Flip like a butterfly, sting like a bee
|
|
|
|
Advertisements. Register and be a member of the community to get rid of them.
|
|
Advertisement
|
|
16-12-2004, 02:06 AM
|
#2 (permalink)
|
|
Right Off the Assembly Line
Join Date: Nov 2004
Posts: 35
|
Code:
<table>
<?php
while($myrow=mysql_fetch_array($result)) {
echo "
<TR>
<TD>
<table>
<TR><TD>$myrow["Title"]</TD></TR>
<TR><TD>$myrow["Content"]</TD></TR>
<TR><TD>$myrow["Link"]</TD></TR>
</table>
</td>
</tr>
";
}
?>
</table>
Hope it helps.
__________________
http://arthunkal.BizHat.com
|
|
|
16-12-2004, 12:50 PM
|
#3 (permalink)
|
|
Apprentice
Join Date: Sep 2004
Location: Thimphu
Posts: 87
|
O Flash,
Thanks for coding , sadly ur codeing i couldnt use it, i got puzzeled, hey u mind if u look into my coding , i have givein the table also, plz hlp am running into this proble for so long ! Thakns i will really appreciate u
Codings
************************************************** *********
<?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 require_once('file:///C|/web/tol.com/Connections/conn.php'); ?>
<?php
$maxRows_Recordset1 = 3;
$pageNum_Recordset1 = 0;
if (isset($_GET['pageNum_Recordset1'])) {
$pageNum_Recordset1 = $_GET['pageNum_Recordset1'];
}
$startRow_Recordset1 = $pageNum_Recordset1 * $maxRows_Recordset1;
mysql_select_db($database_conn, $conn);
$query_Recordset1 = "SELECT title, content, link FROM news";
$query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1);
$Recordset1 = mysql_query($query_limit_Recordset1, $conn) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
if (isset($_GET['totalRows_Recordset1'])) {
$totalRows_Recordset1 = $_GET['totalRows_Recordset1'];
} else {
$all_Recordset1 = mysql_query($query_Recordset1);
$totalRows_Recordset1 = mysql_num_rows($all_Recordset1);
}
$totalPages_Recordset1 = ceil($totalRows_Recordset1/$maxRows_Recordset1)-1;
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
</head>
<body>
<table width="150" border="1">
<?php do { ?>
<tr>
<td><?php echo $row_Recordset1['title']; ?></td>
</tr>
<tr>
<td><?php echo $row_Recordset1['content']; ?></td>
</tr>
<tr>
<td><?php echo $row_Recordset1['link']; ?></td>
</tr>
<?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>
</table>
</body>
</html>
<?php
mysql_free_result($Recordset1);
?>
Table
************************************************** ********
# 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', 'click more');
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...', '', 'click more');
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', 'click more');
__________________
Flip like a butterfly, sting like a bee
|
|
|
16-12-2004, 01:08 PM
|
#4 (permalink)
|
|
Right Off the Assembly Line
Join Date: Nov 2004
Posts: 35
|
FileName : test.php
Code:
<?php
# FileName="Connection_php_mysql.htm"
# Type="MYSQL"
# HTTP="true"
$hostname_conn = "localhost";
$database_conn = "test";
$username_conn = "root";
$password_conn = "";
$conn = mysql_pconnect($hostname_conn, $username_conn, $password_conn) or trigger_error(mysql_error(),E_USER_ERROR);
?>
<?php
#require_once('file:///C|/web/tol.com/Connections/conn.php');
?>
<?php
$maxRows_Recordset1 = 3;
$pageNum_Recordset1 = 0;
if (isset($_GET['pageNum_Recordset1'])) {
$pageNum_Recordset1 = $_GET['pageNum_Recordset1'];
}
$startRow_Recordset1 = $pageNum_Recordset1 * $maxRows_Recordset1;
mysql_select_db($database_conn, $conn);
$query_Recordset1 = "SELECT title, content, link FROM news";
$query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1);
$Recordset1 = mysql_query($query_limit_Recordset1, $conn) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
if (isset($_GET['totalRows_Recordset1'])) {
$totalRows_Recordset1 = $_GET['totalRows_Recordset1'];
} else {
$all_Recordset1 = mysql_query($query_Recordset1);
$totalRows_Recordset1 = mysql_num_rows($all_Recordset1);
}
$totalPages_Recordset1 = ceil($totalRows_Recordset1/$maxRows_Recordset1)-1;
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
</head>
<body>
<table border="1">
<tr valign=top>
<?php do { ?>
<td>
<table width="150">
<tr>
<td><?php echo $row_Recordset1['title']; ?></td>
</tr>
<tr>
<td><?php echo $row_Recordset1['content']; ?></td>
</tr>
<tr>
<td><?php echo $row_Recordset1['link']; ?></td>
</tr>
</table>
</td>
<?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>
</tr>
</table>
</body>
</html>
<?php
mysql_free_result($Recordset1);
?>
Hope this is what you want...
__________________
http://arthunkal.BizHat.com
|
|
|
16-12-2004, 02:57 PM
|
#5 (permalink)
|
|
Apprentice
Join Date: Sep 2004
Location: Thimphu
Posts: 87
|
Flash,
Thanks a lot, is it working fine ,Let me try it , if erros i will get back to you.
Happy New Year
__________________
Flip like a butterfly, sting like a bee
|
|
|
16-12-2004, 03:23 PM
|
#6 (permalink)
|
|
Apprentice
Join Date: Sep 2004
Location: Thimphu
Posts: 87
|
Flash,
Thanks a lot , it worked finally , umm little not ok what i wanted , well if u look at the last row, "clickmore" cant that be in same line so that it looks consitent , as per me , the content somtimes gets more and less so if the last is is in the same row or in tr , that would solvbe my prob, reallyu sorry for the cause and tropuble to u ..
thanks
[/url]
__________________
Flip like a butterfly, sting like a bee
|
|
|
16-12-2004, 08:49 PM
|
#7 (permalink)
|
|
Version 2.0
Join Date: Jan 2004
Location: Mumbai
Posts: 977
|
I think cutting down the characters would help you..
u can use substr function to cut the string...
example..
Code:
<?php
$orig_string ="1234567890";
$cut_string = substr("$orig_string", 0,5); // will return 12345
$final_string = $cut_string. "... ". click for more"; // shall show 12345... click more
?>
I hope this is what you wanted..
cheers
Deep
__________________
- Deep Ganatra -
www.whoisdeep.com
www.twitter.com/DeepXP/
|
|
|
16-12-2004, 10:47 PM
|
#8 (permalink)
|
|
Apprentice
Join Date: Sep 2004
Location: Thimphu
Posts: 87
|
Folk,
no thats not what i wanted, what i mean to tell is that , every thing is ok,, just that "clickmore" part well u look at it clealy u will see one "clickmore" is bit tilted and the other column "clickmore" is in the line , so what i mean to say is that , when i add information into "content" that dosent effect the "clickmore" consistent , i wanted in the same line no matter wat the "content" might less or more , hope u understantd what i have mentioned.. ok if u go through my coding u will i guess..
thanks again for ur precious time that i took !
Merry Christnmas and HappyNewyear too
__________________
Flip like a butterfly, sting like a bee
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|
|