PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
SlickEdit: Code in over 40 languages across 7 platforms. SlickEdit’s unmatched power, speed, and flexibility allows even the most accomplished developers to write better code faster. Download a free trial today!
  #1  
Old September 2nd, 2003, 11:10 PM
velocityX velocityX is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Posts: 72 velocityX User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 11 m 36 sec
Reputation Power: 6
Send a message via AIM to velocityX
How to make a php function loop when getting data

how do I make this code loop so instead of showing only 1 line of data it shows all of it

PHP Code:
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%">
  <
tr>
    <
td style="border-style:solid; border-width:1px; " align="center" width="34%">
    <
b><font face="Verdana" size="1"><u>Map Name:</u></font></b></td>
    <
td style="border-style:solid; border-width:1px; " align="center" width="33%">
    <
b><font face="Verdana" size="1"><u>Map Type</u></font></b></td>
    <
td style="border-style:solid; border-width:1px; " align="center" width="33%">
    <
u><font face="Verdana" size="1"><b>Delete</b></font></u></td>
  </
tr>
<?

    
$DB2 mysql_connect($DBhost,$DBuser,$DBpass) or die("Unable to connect to database");
    @
mysql_select_db("$DBName") or die("Unable to select database $DBName");
    
$sql2 "select mapname from maps_official where maptype='2'";

    
$result2 mysql_query($sql2,$DB2); 

    while (
$row2 mysql_fetch_array($result2))
    {
        
$len2 strlen($row2['mapname']) - 4;
        
$map_no_ext2 substr($row2['mapname'],0,$len2);
    }
?>
cs maps<br>
<font face="Verdana" size="1">
  <tr>
    <td style="border-style:solid; border-width:1px; " align="center" width="34%"><font face="Verdana" size="1"><?= $map_no_ext2 ?></font></td>
    <td style="border-style:solid; border-width:1px; " align="center" width="33%"><font face="Verdana" size="1">cs</font></td>
    <td style="border-style:solid; border-width:1px; " align="center" width="33%">
    <font face="Verdana" size="1"><a href="javascript:void(0)" onclick="openPopUp('editmap.php?mapname=<?= $map_no_ext2 ?>','_new','channelmode=no,directories=no,toolbar=no  ,location=no,status=no,menubar=no,scrollbars=yes,r  esizable=no,width=450,height=400')">edit map</a>
 / <a href="javascript:void(0)" onclick="openPopUp('deleteconfirm.php?mapname=<?= $map_no_ext2 ?>','_new','channelmode=no,directories=no,toolbar=no  ,location=no,status=no,menubar=no,scrollbars=yes,r  esizable=no,width=450,height=80')">delete map</a></td>
  </tr>
</font> 

Reply With Quote
  #2  
Old September 2nd, 2003, 11:37 PM
laidbak laidbak is offline
you know how we do
Dev Articles Novice (500 - 999 posts)
 
Join Date: Jun 2002
Location: In Tha IE -- San Bernardino COUNTY
Posts: 788 laidbak User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 4 m 2 sec
Reputation Power: 7
Send a message via ICQ to laidbak Send a message via AIM to laidbak Send a message via MSN to laidbak Send a message via Yahoo to laidbak
This example should help you figure this out...
In the following example I have a table row such as:
Code:
<tr>
  <td>name</td><td>website</td>
</tr>
<tr>
  <td>laidbak</td><td>http://www.laidbak.net/</td>
</tr>

I'd show three rows of data with this code below:
PHP Code:
<?php
   $mydata
[] = array('name'=>'laidbak''website'=>'http://www.laidbak.net/');
   
$mydata[] = array('name'=>'cyberdunn''website'=>'http://www.3gforfree.com/');
   
$mydata[] = array('name'=>'Wil''website'=>'http://www.wilmoore.com/');
?>
<tr>
  <td>name</td><td>website</td>
</tr>
<?php
  
foreach ($mydata as $data=>$info) {
?>
<tr>
  <td><?php print $info['name']; ?></td><td><?php print $info['website']; ?></td>
</tr>
<?php 
  
}
?>
__________________
__________________________________________________ _
Wil Moore III, MCP | Integrations Specialist | Senior Consultant
Are You Listed...? | DigitallySmooth Inc.

Reply With Quote
  #3  
Old September 2nd, 2003, 11:40 PM
laidbak laidbak is offline
you know how we do
Dev Articles Novice (500 - 999 posts)
 
Join Date: Jun 2002
Location: In Tha IE -- San Bernardino COUNTY
Posts: 788 laidbak User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 4 m 2 sec
Reputation Power: 7
Send a message via ICQ to laidbak Send a message via AIM to laidbak Send a message via MSN to laidbak Send a message via Yahoo to laidbak
What the above code is showing you is that you can start php tags:

Code:
<?php
  // some code here or none... its up to you
?>
Some regular text/html here
<?php
  // more php code here... this is a continuation of the above php code, so if you opened a bracket up there and did not close it, now is your chance to close that bracket.
?>
more html

Reply With Quote
  #4  
Old September 3rd, 2003, 05:22 PM
velocityX velocityX is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Posts: 72 velocityX User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 11 m 36 sec
Reputation Power: 6
Send a message via AIM to velocityX
I dont know what your code means......I dont specify the data in the script but its getting the info from the mysql table

Reply With Quote
  #5  
Old September 3rd, 2003, 06:02 PM
velocityX velocityX is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Posts: 72 velocityX User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 11 m 36 sec
Reputation Power: 6
Send a message via AIM to velocityX
heh, nvm i already fixed it

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingPHP Development > How to make a php function loop when getting data


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway