Current location: Hot Scripts Forums » Programming Languages » PHP » Need help getting info from MySQL


Need help getting info from MySQL

Reply
  #1 (permalink)  
Old 08-22-04, 08:05 PM
naransim naransim is offline
New Member
 
Join Date: Aug 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Question Need help getting info from MySQL

Hello people, I know this could be a stupid question but I´m new at PHP. I have this code:

<table width="90%" border="0" align="center" cellpadding="2" cellspacing="2">
<tr align="center" valign="middle" bgcolor="#666666">
<td width="25%" class="mytext"><a href="galerias.php?cod=<? echo $row["id_seccion"]; ?>">
<? echo $row["nombre"]; ?></a><br><img name="imagen" src="images/contenido/<? echo $row["imagen"]; ?>" border="1"></td>
<td width="25%" class="mytext">&nbsp;</td>
<td width="25%" class="mytext">&nbsp;</td>
<td width="25%" class="mytext">&nbsp;</td>
</tr>
</table><br><br>

Obviously this shows the info just in te first cell of the table, I want the record to be shown in each of the four cells of the table and then, start to add rows as the records grow.

Thanks for the help !!!
Reply With Quote
  #2 (permalink)  
Old 08-22-04, 09:58 PM
kvnband kvnband is offline
Wannabe Coder
 
Join Date: Jun 2003
Posts: 242
Thanks: 0
Thanked 0 Times in 0 Posts
OK, basically, you've got your query. (SELECT * from table, etc...)

so you're going to want SOMETHING like

PHP Code:

<table width="90%" border="0" align="center" cellpadding="2" cellspacing="2">

<? 
while ($row mysql_fetch_array($query){
?>
<tr align="center" valign="middle" bgcolor="#666666">
<td width="25%" class="mytext"><a href="galerias.php?cod=<? echo $row["id_seccion"]; ?>">
<? echo $row["nombre"]; ?></a><br><img name="imagen" src="images/contenido/<? echo $row["imagen"]; ?>" border="1"></td>
<td width="25%" class="mytext">&nbsp;</td>
<td width="25%" class="mytext">&nbsp;</td>
<td width="25%" class="mytext">&nbsp;</td>
</tr>
<?
}
?>
</table><br><br>
That should help you out. That way, when new records are added, it will cycle through all the records, creating a new row each time.

Kevin

Last edited by kvnband; 08-22-04 at 10:04 PM.
Reply With Quote
  #3 (permalink)  
Old 08-23-04, 08:48 AM
naransim naransim is offline
New Member
 
Join Date: Aug 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Question

Hello kvnband, thanks for ur help, but is still doesn´t work, I know this is easy but I´m trying to undertand the code, yet I don´t have the skill. I´m sending you the files because this is part of a paging system that I downloaded, theres one file that calls the condig file (connection) and the template (tabl with results). Thanks.
Attached Files
File Type: txt config_listar_galerias.txt (1.3 KB, 79 views)
File Type: txt listar_galerias.txt (1.9 KB, 193 views)
File Type: txt template_listar_galerias.txt (578 Bytes, 87 views)
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP and MySQL ? rob2132 Hot Scripts Forum Questions, Suggestions and Feedback 4 08-29-08 02:22 AM
cascade info script? zeon Script Requests 0 05-23-04 11:42 PM
Storing Mysql Info As A Varaible CarBoffin PHP 6 02-26-04 05:11 AM
PHP to MySQL script question...(using a field to update info in MySQL) DisneyFan25863 PHP 4 11-02-03 03:31 AM
great product for dumping/recovering MySQL databases Dave Brown General Advertisements 1 10-03-03 07:40 AM


All times are GMT -5. The time now is 04:23 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.