exzrael
11-09-2006, 02:55 PM
This is a bit of a problem for me. Now, don't hate me for my coding; im still a newbie at this :)
Before you guys check the code, this is what I would like:
Take the information from $row['link'] and make that appear in:
http://www.google.com/translate?u=http%3A%2F%2Fe61life.com&langpair=en%7Cde&hl=en&ie=UTF8
So, we remove http%3A%2F%2Fe61life.com and add the information from the database from $row['link']. Can this be done?
Fig 1 - Initiating database connection and fetching everything
<?php
$db = mysql_connect($DB_HOST,$DB_USER,$DB_PWD);
if (!$db) { die("Connection failed. Report to daniel@e61life.com.np.spam (remove .no.spam)"); }
$database = mysql_select_db($DB_DATABASE);
$query="SELECT * FROM blogs";
$query_result=mysql_query($query);
?>
Fig 2 - Displaying a table with the collected database information
<div id="table">
<br />
<center><table>
<tr>
<th><p>Title</p></th>
<th><p>Category</p></th>
<th><p>Language</p></th>
<th><p>Link</p></th>
<th><p>Translate</p></th>
<th><p>Other</p></th>
</tr>
<?php
while ($row = mysql_fetch_array($query_result)){
echo " <tr>\n<td><p>" . $row['title'] . "</p></td>\n <td><center><p>" . $row['cat'] . "</p></center></td>\n <td><center><p>" . $row['lang'] . "</p></center></td>\n <td><center><a href=\"" . $row['link'] . "\" target=\"_new\"><img border=0 src=\"" . "http://localhost/test/images/world_go.png" . "\"></a></center></td>\n <td><center><a href=\"" . $row['link'] . "\" target=\"_new\"><img border=0 src=\"" . "./images/flag_it.gif" . "\"></a> <a href=\"" . $row['link'] . "\" target=\"_new\"><img border=0 src=\"" . "./images/flag_de.gif" . "\"></a> <a href=\"" . $row['link'] . "\" target=\"_new\"><img border=0 src=\"" . "./images/flag_fr.gif" . "\"></a> <a href=\"" . $row['link'] . "\" target=\"_new\"><img border=0 src=\"" . "./images/flag_es.gif" . "\"></a></center></td>\n <td><center><img src=\"" . "./images/exclamation.png" . "\"> <img src=\"" . "./images/help.png" . "\"> <a href=\"" . $row['rss'] . "\" target=\"_new\"><img border=0 src=\"" . "./images/feed.png" . "\"></a></center></td></tr>\n";
}
?>
</center></table>
<?php mysql_close($db); ?>
</div>
</div>
Before you guys check the code, this is what I would like:
Take the information from $row['link'] and make that appear in:
http://www.google.com/translate?u=http%3A%2F%2Fe61life.com&langpair=en%7Cde&hl=en&ie=UTF8
So, we remove http%3A%2F%2Fe61life.com and add the information from the database from $row['link']. Can this be done?
Fig 1 - Initiating database connection and fetching everything
<?php
$db = mysql_connect($DB_HOST,$DB_USER,$DB_PWD);
if (!$db) { die("Connection failed. Report to daniel@e61life.com.np.spam (remove .no.spam)"); }
$database = mysql_select_db($DB_DATABASE);
$query="SELECT * FROM blogs";
$query_result=mysql_query($query);
?>
Fig 2 - Displaying a table with the collected database information
<div id="table">
<br />
<center><table>
<tr>
<th><p>Title</p></th>
<th><p>Category</p></th>
<th><p>Language</p></th>
<th><p>Link</p></th>
<th><p>Translate</p></th>
<th><p>Other</p></th>
</tr>
<?php
while ($row = mysql_fetch_array($query_result)){
echo " <tr>\n<td><p>" . $row['title'] . "</p></td>\n <td><center><p>" . $row['cat'] . "</p></center></td>\n <td><center><p>" . $row['lang'] . "</p></center></td>\n <td><center><a href=\"" . $row['link'] . "\" target=\"_new\"><img border=0 src=\"" . "http://localhost/test/images/world_go.png" . "\"></a></center></td>\n <td><center><a href=\"" . $row['link'] . "\" target=\"_new\"><img border=0 src=\"" . "./images/flag_it.gif" . "\"></a> <a href=\"" . $row['link'] . "\" target=\"_new\"><img border=0 src=\"" . "./images/flag_de.gif" . "\"></a> <a href=\"" . $row['link'] . "\" target=\"_new\"><img border=0 src=\"" . "./images/flag_fr.gif" . "\"></a> <a href=\"" . $row['link'] . "\" target=\"_new\"><img border=0 src=\"" . "./images/flag_es.gif" . "\"></a></center></td>\n <td><center><img src=\"" . "./images/exclamation.png" . "\"> <img src=\"" . "./images/help.png" . "\"> <a href=\"" . $row['rss'] . "\" target=\"_new\"><img border=0 src=\"" . "./images/feed.png" . "\"></a></center></td></tr>\n";
}
?>
</center></table>
<?php mysql_close($db); ?>
</div>
</div>