Guys, I'm doing a standard FORM..POST to a php page but for some reason, the page I'm posting to is not seeing the form var:
My form:
<form method="post" action="companylist.php">
<table width="100%" border="0">
<tr>
<td width="68%"><input name="compname" type="text" size="50" maxlength="50"></td>
<td width="12%"><input name="Submit1" type="submit" id="Submit1" value="Submit"></td>
<td width="20%"><input name="Reset2" type="reset" id="Reset2" value="Reset"></td>
</tr>
</table>
</form>
My PHP page:
<?php
$db = @mysql_connect( "localhost", "myu", "myp" );
if (!$db)
{
echo "Error: Could not connect to the database.";
exit;
}
mysql_select_db( "mydb" );
trim( $compname);
$compname = addslashes( $compname );
$query = "SELECT *
FROM company
WHERE companyname like '".$compname."%'
order by companyname";
$result = mysql_query( $query );
$numresults = mysql_num_rows( $result );
?>
I echo'd out the $compname at the beginning of the script and its definitely not there. Any ideas?
Also, I'm getting this error in a similar script:
" Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in productslist.php on line 17 "
Line 17 contains this:
$numresults = mysql_num_rows( $result );
This is the productslist.php script:
<?php
$db = @mysql_connect( "localhost", "myu", "myp" );
if (!$db)
{
echo "Error: Could not connect to the database.";
exit;
}
mysql_select_db( "mydb" );
$query = "SELECT company.companyID, companyname, city, province
FROM company, products, prodcompanylink
WHERE products.productid = ".$prodid." AND prodcompanylink.productid = products.productid AND company.companyID = prodcompanylink.Companyid";
$result = mysql_query( $query );
$numresults = mysql_num_rows( $result );
?>
This all works perfectly in my dev environment but when I pushed it up to the client's server, it chokes. Could this be a PHP version issue? My dev box is using PHP 4.3.4 and the hosting provider is using PHP Version 4.2.2.
Help!
SHP....