Zend - The PHP Company




HTTP

Add Code


Space Eater  

Type: code fragment
Added by: idban
Entered: 24/04/2000
Last modified: 08/12/1999
Rating: **** (8 votes)
Views: 6174
if u use any (text) variable for your ID you will have problem with browser compatibility,
how to get rid off from space? u can use this.


<?
/* if u use any variable for your ID you will have problem with browser compatibility,
how to get rid off from space? u can use this.
best regard, idban@satunet.com 
greeting to my wife dessy fatmawati and all of my friends

free for use, keep my name :)
*/

$username "username"
$password "password"
$usertable "tabelname";
$dbName "DBname"

MYSQL_CONNECT($hostname$username$password) OR DIE("Unable to connect to database");
@
mysql_select_db"$dbName") or die( "Unable to select database");
$news_query mysql_query("select * from $usertable order by coloumname desc limit 0,5") or die(mysql_error());
while (
$row  =  mysql_fetch_array($news_query))

   {    
$var1=$row["colum_name"]; 

// change any space to + ( plus )
$var1_new eregi_replace(" ","+",$var1); 

print (
" the original text : <a href="http://domain.com/viewscript.php3?id=$var1">$var1</a>
 
<br> <font color="red"link will broken if use netscape!</font><br>");
print (" 
modified text : <a href="http://domain.com/viewscript.php3?id=$var1_new">$var1_new</a>
<
br><font color="red"link will NOT broken even use netscape!</font> <br><br>");
}
MYSQL_CLOSE();
?>


Usage Example


See the example


Rate This Script





Search



This Category All Categories