PHP syntax
| From: | Ron Allen | Date: | Thu, 01 May 2003 10:59:11 +0000 |
| Subject: | PHP syntax | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-145924@lists.php.net to get a copy of this message | ||
What I would like to do is use what Luke or Burhan gave me to try as far as
replacing the spaces with an underscore, but I am having a hard time placing
the variable for me to manipulate!
Overall all result will be 3 columns with different record fields represnted
by a bar code with spaces taken out.
I have been looking at this for several hours now and I am still scrathcing
my head. Any suggestions?
<?PHP
include 'drop.php';
$DBName = "******";
$table = "*****";
$db = mysql_connect("$DBhost","$DBuser","$DBpass") or
die("Problem
connecting");
mysql_select_db("$DBName") or die("Problem selecting database");
$query = "SELECT * FROM $table";
$result = mysql_query($query) or die ("Query failed");
//let's get the number of rows in our result so we can use it in a for loop
$numofrows = mysql_num_rows($result);
?>
<?PHP
echo "<body>";
echo "<TABLE align=left BORDER=\"1\">\n";
echo "<TR width=75%<TD WIDTH=150><font size=2><center><b>BLDG ROOM
CABINET</b></center></TD>\n";
for($i = 0; $i < $numofrows; $i++) {
$row = mysql_fetch_array($result); //get a row from our result set
//$Bldgroomcabpost = ".$row['Bldgroomcab'].";
//$Bldgroomcabspace = str_replace(" ", "_", $Bldgroomcabpost);
echo "<TD><font size=3
face=********><center>".$row['Bldgroomcab']."</TD>\n";
echo "</TR>\n";
}
//now let's close the table and be done with it
echo "</TABLE>\n";
echo "</body>"
?>