Only been using PHP since last Thursday, so all this is totally new and I don't know if it's possible.
In a nushell I've got the following code in a page:
Which, if results are found, go to another page which lists the results.
The PHP on the 'findresults' page is:
But I get an error of "Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in html/findresults.php on line 6"
Any ideas what I'm doing wrong, or is it not possible? I'd have thought by passing $Results in a session I'd be able to retrieve it's entireity on the calling page!
In a nushell I've got the following code in a page:
<?php?>
require("connect.php");
$txtAction = $_REQUEST['txtAction'];
$txtName = $_REQUEST['txtName'];
if ($txtAction == 'Find')
{
$sql= "SELECT name, town, county FROM customers WHERE name LIKE '%$txtName%'";
$result = @mysql_query($sql,$dbh) or die (mysql_error());
$num = mysql_num_rows($result);
if ($num > 0 )
{
$_SESSION["Results"]=$result;
header ('Location: findresults.php');
}
}
Which, if results are found, go to another page which lists the results.
The PHP on the 'findresults' page is:
<?php
require("connect.php");
$result=$_SESSION["Results"];
while ($row = mysql_fetch_array($result))
{
$name = $row['name'];
$town = $row['town'];
$county = $row['county'];
echo "<p>$name</p>";
}
?>
But I get an error of "Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in html/findresults.php on line 6"
Any ideas what I'm doing wrong, or is it not possible? I'd have thought by passing $Results in a session I'd be able to retrieve it's entireity on the calling page!