nemonoman wrote:I don't understand why you won't use the code I provided which would print out the query that is actually being sent to the database, and the actual rows returned by the database. Accordingly, I think I've about had it with offering opinions. Please have fun debugging your problem your own way.
Wow, I don't see the need of getting angry over this. I did try your code, and it produced no rows, just like every other code. Here's what I tried:
<?php
$con = mysql_connect("xxxxxxxxxxx.secureserver.net","xxxxxx","xxxxxx");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
//$name = 'pizza';
$name = $_POST['name'];
print "Your food is ". $name . ".<br>";
mysql_select_db("jonpom", $con);
$query="SELECT M.MName, M.MPrice, R.Name, R.City, R.Website
FROM MenuItem M, Restaurants R
WHERE M.RID = R.RID
AND M.MName LIKE '%".$name."%'";
echo $query;
$result = mysql_query($query);
if(!$result){
die(mysql_error());
}
$row=mysql_fetch_array($result);
print_r($row);
mysql_close($con);
?>
If entering 'pizza' on my page, it returns this...
Your food is
pizza
.
SELECT M.MName, M.MPrice, R.Name, R.City, R.Website FROM MenuItem M, Restaurants R WHERE M.RID = R.RID AND M.MName LIKE '%
pizza
%'
Once again, it returns no database rows. No code whatsoever reproduces database rows when it accepts the variable from Flash like we've been doing. Now if I do what I did last time and switch out the $name from flash to simply assigning it a text field ...
[CODE]
<?php
$con = mysql_connect("xxxxxxxxxxx.secureserver.net","xxxxxx","xxxxxx");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
$name = 'pizza';
//$name = $_POST['name'];
print "Your food is ". $name . ".<br>";
mysql_select_db("jonpom", $con);
$query="SELECT M.MName, M.MPrice, R.Name, R.City, R.Website
FROM MenuItem M, Restaurants R
WHERE M.RID = R.RID
AND M.MName LIKE '%".$name."%'";
echo $query;
$result = mysql_query($query);
if(!$result){
die(mysql_error());
}
$row=mysql_fetch_array($result);
print_r($row);
mysql_close($con);
?>
I receive this
Your food is pizza.
SELECT M.MName, M.MPrice, R.Name, R.City, R.Website FROM MenuItem M, Restaurants R WHERE M.RID = R.RID AND M.MName LIKE '%pizza%'Array ( [0] => 12" Margherita Pizza [MName] => 12" Margherita Pizza [1] => 7.50 [MPrice] => 7.50 [2] => Leo's Italian Restaurant & Pizzeria [Name] => Leo's Italian Restaurant & Pizzeria [3] => Wappingers Falls [City] => Wappingers Falls [4] => http://www.uEatOut.com/leos.swf [Website] => http://www.uEatOut.com/leos.swf )
Funny because it doesn't return all the rows that have pizza in it like the other query suggested in this post, or my original HTML table code. Nevertheless, notice how there is no size difference in the "pizza" variable, and how this time it actually returns rows. The only plausible solution is that the variable from Flash does not properly get thrown into the query as regular text. Once again, any thoughts?