RE: [PHP] PHP syntax
| From: | John W. Holmes | Date: | Thu, 01 May 2003 12:53:22 +0000 |
| Subject: | RE: [PHP] PHP syntax | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-145939@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!
>
> <?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 "<TD><font size=3
face=********><center>".str_replace("
","_",$row['Bldgroomcab'])."</TD>\n";
---John Holmes...