aha I'm getting somewhere lol
I tried the test script I've been using on the forum and its showing me the records in my product table
<?php
$connection=mysql_connect("localhost","icsm","------");
if (!$connection) {
echo "Could not connect to MySQL server!";
exit;
}
$db=mysql_select_db("icsm_org",$connection);
if (!$db) {
echo "Could not connect to the database!";
exit;
}
$sql="SELECT * FROM products";
$mysql_result=mysql_query($sql,$connection);
$num_rows =mysql_num_rows($mysql_result);
while ($row = mysql_fetch_row( $mysql_result))
{ $rec_str.="<TR>";
foreach ($row as $field) $rec_str .= "<TD>$field</TD>";
}
echo "<B>In the table personal there are $num_rows rows in the personal table<BR>And here they are...</B><BR>";
echo $rec_str;
mysql_close($connection);
?>
that works but this is the real script which gives errors
I'll try and not use the num rows command and see what happens
<?php
$connection=mysql_connect("localhost","icsm","----");
if (!$connection) {
echo "Sorry the database isn't working at the moment, please return later.!";
exit;
}
$db=mysql_select_db("icsm_org",$connection);
if (!$db) {
echo "Could not connect to the database!";
exit;
}
$sql="SELECT * FROM products WHERE name,company LIKE '%$name%'";
$mysql_result=mysql_query($sql,$connection);
$num_rows=mysql_num_rows($mysql_result);
if ( $num_rows == "0" ) {
echo "Sorry no products to display";
} else {
echo "
<table>
<tr>
<td valign=\"top\" align=\"center\"><b><font size=\"2\" face=\"Verdana\">Picture</font></b></td>
<td valign=\"top\" align=\"center\">
<b><font size=\"2\" face=\"Verdana\">Name</font></b></div>
</td>
<td align=\"center\">
<b><font size=\"2\" face=\"Verdana\">Price</font></b></div>
</td>
<td align=\"center\">
<b><font size=\"2\" face=\"Verdana\">Manufacture</font></b></div>
</td>
<td align=\"center\">
<b><font size=\"2\" face=\"Verdana\">Description</font></b></div>
</td>
<td align=\"center\">
<b><font size=\"2\" face=\"Verdana\">Buy</font></b></div>
</td>
</tr>
";
while ($row=mysql_fetch_array($mysql_result))
{
$name=$row["name"];
$price=$row["price"];
$company=$row["company"];
$desc=$row["desc"];
$picture=$row["picture"];
echo "
<tr>
<td width=180 align=\"center\">
<A HREF=\"$picture\"><font face=Verdana size=2>Here</A></td>
<td width=183 align=\"center\"><font face=Verdana size=2>$name</font></td>
<td width=166 align=\"center\"><font face=Verdana size=2>£$price</td>
<td width=121 align=\"center\"> <font face=Verdana size=2>$company</td>
<td width=121 align=\"center\"> <font face=Verdana size=2>$desc</td>
<td width=121 align=\"center\"> <font face=Verdana size=2><BR>
<form name=\"_xclick\" target=\"paypal\" action=\"https://www.paypal.com/cgi-bin/webscr\" method=\"post\">
<input type=\"hidden\" name=\"cmd\" value=\"_cart\">
<input type=\"hidden\" name=\"business\" value=\"orders15@postmaster.co.uk\">
<input type=\"hidden\" name=\"item_name\" value=\"$name\">
<input type=\"hidden\" name=\"amount\" value=\"$price\">
<input type=\"hidden\" name=\"no_note\" value=\"1\">
<input type=\"hidden\" name=\"currency_code\" value=\"GBP\">
<input type=\"image\" src=\"http://members.lycos.co.uk/mgcomputers/images/buy.bmp\" border=\"0\" name=\"submit\" alt=\"Make payments with PayPal - it's fast, free and secure!\">
<input type=\"hidden\" name=\"add\" value=\"1\"> </form>
</td>
</tr>
<tr><BR></tr>
";
}
}
mysql_close($connection);
?>