Gary White wrote:
> True. However, a doSomething() or die("Some message");
will display Some
> message if the function fails, regardless of
display_errors.
No, it won't - at least not in this case.
I didn't notice it first time, but there's no closing
parenthesis after
the database name, which causes a parse error. Even when you
correct
that, the problem that Mick spotted causes another parse
error. Both
parse errors prevent anything appearing onscreen if
display_errors is off.
There are at least three mistakes in that script. The one I
spotted, the
one that Mick spotted, and the closing parenthesis that I've
just
noticed. The following might work:
<?php
DEFINE ('DB_USER', 'manda');
DEFINE ('DB_PASSWORD', '*****');
DEFINE ('DB_HOST', '**.***.**.***');
DEFINE ('DB_NAME', 'products');
$dbc = @mysql_connect (DB_HOST, DB_USER, DB_PASSWORD) OR die
('Could not
connect to MySQL: ' . mysql_error() );
@mysql_select_db (DB_NAME) OR die ('Could not select the
database; ' .
mysql_error() );
$search=$_POST["search"];
//get the mysql and store them in $result
//change whatevertable to the mysql table you're using
//change whatevercolumn to the column in the table you want
to search
$result = mysql_query("SELECT * FROM products WHERE item
number LIKE
'%$search%'");
//grab all the content
while($r=mysql_fetch_array($result))
{
//the format is $variable = $r["nameofmysqlcolumn"];
//modify these to match your mysql table columns
$image=$r["title"];
$item_number=$r["message"];
$title=$r["who"];
$description=$r["date"];
$price=$r["time"];
//display the row
echo "$image <br> $item number <br> $title
<br> $description |
$price <br>";
}
?>
--
David Powers, Adobe Community Expert
Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/