homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / Databases
Forum Library, Charter, Moderator: open

Databases Forum

Changing rows to columns

Msg#: 4680051 posted 6:18 pm on Jun 15, 2014 (gmt 0)

I had a young fellow who wrote me a simple database query. He is long gone:(

I would like to change it and have been trying, but it is just over my head. So if there is someone with a few minutes who would do it for me, it would be appreciated. What I want is right now, it presents itself with 4 data cells in one row. I would like it to present itself in 4 rows with one data cell.

<title> Ads </title>
<body bgcolor="#C0C0C0" text="#000000" alink="#FF0000" vlink="#FF00FF" link="#0000FF">

<div align="center">
<table class="alt1" border="5" bgcolor="fffceb" cellpadding="6" cellspacing="1" width="100%">
<tr><td colspan="4"><u>WANTED ADS</u> in the <i>Team Classifieds</i>...</td></tr>
$mysql_link = mysql_connect("localhost", "teXXXXXX_root", "XXXXXXXX");
mysql_select_db ("teXXXXXX_forums");
print("Did not connect to database<br>");
function cl_get_ext( $filename ) {
return substr($filename, strrpos($filename,"."));

$result = mysql_query('SELECT p.id, p.cat, p.user, p.userid, p.bigimage, p.title FROM ppc_products p WHERE p.cat=\'58\' OR p.cat=\'59\' OR p.cat=\'60\' OR p.cat=\'61\' OR p.cat=\'62\' ORDER BY RAND() DESC LIMIT 0, 4');
while($row = mysql_fetch_array($result,MYSQL_NUM))
$photo = $row[4];
$photolen = strlen($photo);
$theext = cl_get_ext($photo);
$photo_name = str_replace( $theext, "", $photo );

echo ' <td width="25%"><center><a href=http://www.teXXXXXX.com/classifieds/showproduct.php?product='.$row[0].'>'.

<br />



Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / Databases
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved