PHP help please

We may earn a small commission from affiliate links and paid advertisements. Terms

JDMPlaya

Senior Member
Alright I'm not a PHP man, but I'm trying to get this little project finished here.

Basically this webpage features a search tool, So people can search through different companies to get there contact information..


as you can see here

I'm trying to make the results that come up Arial 10pt


And when they click on a website under a company in the results page have it so it opens in a new window rather taking it off the existing site.

Here is the PHP code for the file if they would searching by the business name

Code:
<?
include("conf.php");
include(DB_INC_FILE);

$search_string_name = stripslashes($search_string_name);

// ////////////////// block of variable to change for different display SORTING methods //////////////
// Next variable is sorting method for display - Change it for different sorting methods 
$order_by_field = "last_name";

// Next variable is the file name of this file
$current_file_name = "sel_by_business_type.php";
// ////////////////// end of block of variables to change //////////////////////////////////////////////


$table_name = "greg_chamblin";
$db = @mysql_select_db($db_name, $connection) or die("Couldn't select DCW Equitable database.");


$order_by_field_1 = premium;
$order_by_field_2 = business_name;
$sql = "SELECT business_name, first_name, last_name, address1, address2, city, state, zip, phone, fax, email, web_address, logo
    FROM $table_name
    WHERE business_name LIKE \"%$search_string_name%\"
    ORDER BY $order_by_field_1, $order_by_field_2
        ";


$result = @mysql_query($sql,$connection) or die("Couldn't execute DCW Equitable Read query.");

while ($row = mysql_fetch_array($result)) {
    $business_name = $row['business_name'];
    $first_name = $row['first_name'];
    $last_name = $row['last_name'];
    $address1 = $row['address1'];
    $address2 = $row['address2'];
    $city = $row['city'];
    $state = $row['state'];
    $zip = $row['zip'];
    $phone = $row['phone'];
    $fax = $row['fax'];
    $email = $row['email'];
    $web_address = $row['web_address'];
    $logo = $row['logo'];
    $business_type_1 = $row['business_type_1'];
    $business_type_2 = $row['business_type_2'];
    $business_type_3 = $row['business_type_3'];


    if ($logo != "") {$display_block .= "<img src=\"images/$logo\" border=\"0\"><br><br>";} 
    if ($web_address != "") {
        $display_block .= "
        <a href=\"http://$web_address\"><strong>$business_name</strong></a><br>";
    } else {
        $display_block .= "
        <strong>$business_name</strong><br>";
    }

    $display_block .= "
    $first_name $last_name<br>
    $address1<br>";

    if ($address2 != "") {$display_block .= "$address2<br>";} 
    $display_block .= "
    $city, $state $zip<br>
    Phone: $phone<br>";
    if ($fax != "") {$display_block .= "FAX: $fax<br>";} 

    if ($email != "") {$display_block .= "<a href=\"mailto:$email\">$email</a><br>";}

    if ($web_address != "") {$display_block .= "<a href=\"http://$web_address\">$web_address</a><br>";}
    $display_block .= "
    <hr align=\"LEFT\" size=\"2\" width=\"100%\" color=\"navy\" noshade><br>
    ";
}
?>

I'd really appreciate the help!!
 
Originally posted by JDMPlaya@Apr 11 2005, 06:34 PM
Alright I'm not a PHP man, but I'm trying to get this little project finished here.

Basically this webpage features a search tool, So people can search through different companies to get there contact information..


as you can see here

I'm trying to make the results that come up Arial 10pt


ok, first of all. lesson in web design vs print design. :)

points are used for print media where you have a fixed given sheet of paper or whatever that the design will come out on.

on the web, you're not so lucky. countless reslutions, countless monitor sizes, countless O/S's and their own quirks that go with them. thus, using a pt on a web based output is a horrible idea. what you want to use are either pixels (px), percentages (%) or em's (em) [i have no idea what em stands for.. lol).

an EM is basically a percentage-- its a RELATIVE size to its parent container.



Now, before we even get into your question, you have some problems.
a lot of your links are double http'd EG:
Code:
http://http//www.tuffy.com

that won't get you very far. :)


And when they click on a website under a company in the results page have it so it opens in a new window rather taking it off the existing site.


cake.


Here is the PHP code for the file if they would searching by the business name


who cares? :p

you're worried about basic html-- not the search query or database connection here.



ok lets get to the part that matters...
Code:
    if ($logo != "") {$display_block .= "<img src=\"images/$logo\" border=\"0\"><br><br>";} 
    if ($web_address != "") {
        $display_block .= "
        <a href=\"http://$web_address\"><strong>$business_name</strong></a><br>";
    } else {
        $display_block .= "
        <strong>$business_name</strong><br>";
    }

    $display_block .= "
    $first_name $last_name<br>
    $address1<br>";

    if ($address2 != "") {$display_block .= "$address2<br>";} 
    $display_block .= "
    $city, $state $zip<br>
    Phone: $phone<br>";
    if ($fax != "") {$display_block .= "FAX: $fax<br>";} 

    if ($email != "") {$display_block .= "<a href=\"mailto:$email\">$email</a><br>";}

    if ($web_address != "") {$display_block .= "<a href=\"http://$web_address\">$web_address</a><br>";}
    $display_block .= "
    <hr align=\"LEFT\" size=\"2\" width=\"100%\" color=\"navy\" noshade><br>
    ";
}
?>

$display_block is a variable used to hold your entire output it appears... the .= connotation means $display_block = $display_block PLUS all this stuff on this line too.. basically adding to that one variable at the end.

you're also in good hands, becase the code uses the element to connotate what you want to be arial 10px (not POINTS !!!)


all you need to do, is in the head of the page under the <title> tag, add this:

Code:
<style type="text/css" media="screen">
strong { font: 10px/1em bold arial, sans-serif; }
</style>

done.

so, actually, the answer to your question is, you needed to apply a style sheet to an element.

I'd really appreciate the help!!
[post=485822]Quoted post[/post]​


anytime :)
 
Hell yea dude that's awesome, thanks It worked.

I imported all the table data in the database from an excel file that explains the weird data. But anyway thanks alot for your help.
 
ohh... i forgot the new window links part.

change the <a href=... to <a target="_blank" href=...
 
Back
Top