Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
What is wrong w/my formatting (alignment)?
Old 02-12-2008, 04:19 PM What is wrong w/my formatting (alignment)?
Extreme Talker

Posts: 176
Name: Aaric
Trades: 0
Check it out here:http://www.bjjnews.org/TUF/fighterdb...h.php?search=A

You will see what I am talking about.

How can I get this aligned and looking good?

PHP Code:
<?php
// connect to the mysql database server.
mysql_connect ($dbhost$dbusername$dbuserpass);
//select the database
mysql_select_db($dbname) or die('Cannot select database');
//search variable = data in search box or url
if(isset($_GET['search']))
{
$search $_GET['search'];
}
//trim whitespace from variable
$search trim($search);
$search preg_replace('/\s+/'' '$search);
//seperate multiple keywords into array space delimited
$keywords explode(" "$search);
//Clean empty arrays so they don't get every row as result
$keywords array_diff($keywords, array(""));

//Set the MySQL query
if ($search == NULL or $search == '%'){
} else {
for (
$i=0$i<count($keywords); $i++) {
$query "SELECT * FROM registering_fighters " .
"WHERE id LIKE '%".$keywords[$i]."%'".
" OR field_1 LIKE '%".$keywords[$i]."%'" .
" OR field_2 LIKE '%".$keywords[$i]."%'" .
" OR field_13 LIKE '%".$keywords[$i]."%'" .
" OR field_7 LIKE '%".$keywords[$i]."%'" .
" OR field_8 LIKE '%".$keywords[$i]."%'" .
" ORDER BY field_2";
}
//Store the results in a variable or die if query fails
$result mysql_query($query) or die(mysql_error());
}
if (isset (
$_GET['id'])) {
    
$id $_GET['id'];
}
if (
$search == NULL or $search == '%'){
} else {
//Count the rows retrived
$count mysql_num_rows($result);
}
echo 
"<html>";
echo 
"<head>";
echo 
"<title>Tuff-N-Uff Fighter Database</title>";
echo 
"<link rel=\"stylesheet\" type=\"text/css\" href=\"style.css\" />";
echo 
"</head>";
echo 
"<body onLoad=\"self.focus();document.searchform.search.focus()\">";
echo 
"<center>";
echo 
"<br /><form name=\"searchform\" method=\"GET\" action=\"search.php\">";
echo 
"<input type=\"text\" name=\"search\" size=\"15\" TABINDEX=\"1\" />";
echo 
" <input type=\"submit\" value=\"Search\" />";
echo 
"</form>";
//If search variable is null do nothing, else print it.
if ($search == NULL) {
} else {
echo 
"You searched for <b><FONT COLOR=\"blue\">";
foreach(
$keywords as $value) {
   print 
"$value ";
}
echo 
"</font></b>";
}
echo 
"<p> </p><br />";
echo 
"</center>";
//If users doesn't enter anything into search box tell them to.
if ($search == NULL){
echo 
"<center><b><FONT COLOR=\"red\">Please enter a search parameter to continue.</font></b><br /></center>";
} elseif (
$search == '%'){
echo 
"<center><b><FONT COLOR=\"red\">Please enter a search parameter to continue.</font></b><br /></center>";
//If no results are returned print it
} elseif ($count <= 0){
echo 
"<center><b><FONT COLOR=\"red\">Your query returned no results from the database.</font></b><br /></center>";
//ELSE print the data in a table
} else {
//Colors for alternation of row color on results table
$color1 "#d5d5d5";
$color2 "#e5e5e5";
//While there are rows, print it.
while($row mysql_fetch_array($result))
{
//Row color alternates for each row
$row_color = ($row_count 2) ? $color1 $color2;
//table background color = row_color variable
echo "<center><table bgcolor=".$row_color." width=\"750\">";
echo 
"<tr>";
echo 
"<td><b>".$row['field_1']."  ".$row['field_2']."</b></td>";
echo 
"<td>".$row['field_13']."</td>";
echo 
"<td>".$row['field_7']."</td>";
echo 
"<td>".$row['field_8']."</td>";
echo 
"<td><b><a href='fighter_bio.php?id=".$row['id']."'> VIEW PROFILE</b></a></td>";
echo 
"</tr>";
echo 
"</table></center>";
$row_count++;
//end while
}
//end if
}
echo 
"</body>";
echo 
"</html>";
if (
$search == NULL or $search == '%') {
} else {
//clear memory
mysql_free_result($result);
}
?>
aaricwon is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 02-13-2008, 11:53 AM Re: What is wrong w/my formatting (alignment)?
Mooofasa's Avatar
Defies a Status

Posts: 1,611
Name: Michael (mik) Land
Location: England
Trades: 0
Learning HTML and CSS properly is a start. Secondly, I "don't see" what you're getting at.
__________________

Please login or register to view this content. Registration is FREE
- Tumblog with thoughts, quotes, links, videos, images and my creations.

Please login or register to view this content. Registration is FREE
- The best free web browser.

Please login or register to view this content. Registration is FREE
- Firefox is now Firefail.
Mooofasa is offline
Reply With Quote
View Public Profile Visit Mooofasa's homepage!
 
Old 02-13-2008, 03:37 PM Re: What is wrong w/my formatting (alignment)?
dlaroche22's Avatar
Skilled Talker

Posts: 84
Name: Dustin Laroche
Trades: 0
As far as the formatiting of the page I don't know exactly what kind of formatting you are looking for, because you were not specific enough.
__________________
Under Construction, But A Work In Progress
Webhosting isn't cheap, sponsors are important

Please login or register to view this content. Registration is FREE
dlaroche22 is offline
Reply With Quote
View Public Profile
 
Old 02-13-2008, 03:48 PM Re: What is wrong w/my formatting (alignment)?
Extreme Talker

Posts: 176
Name: Aaric
Trades: 0
Quote:
Originally Posted by dlaroche22 View Post
As far as the formatiting of the page I don't know exactly what kind of formatting you are looking for, because you were not specific enough.
You're right. I am new to all of this and most likely word half of my questions wrong.

Everyone here has been very helpful and friends, I suppose Moofasa is the exception.

Thanks everyone.
aaricwon is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to What is wrong w/my formatting (alignment)?
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.42847 seconds with 12 queries