Page 1 of 1

Flash/php/mysql

Posted: Mon Dec 21, 2009 2:24 pm
by rnash
I know this is a topic that has been beat to death in every php forum around the net. I've been looking all over for answers to this specific problem.

I am trying to do a lookup in a mysql DB using a partnumber and displaying the price in flash. here is my code:

Code: Select all

<?php
 
// Only run this script if the sendRequest is from our flash application
if ($_POST['sendRequest'] == "parse") {
 
// Access the value of the dynamic text field variable sent from flash
$uname = $_POST['uname'];
 
//*** hidden for security but connection has been established successfully
$link = mysql_connect("***","***","***") or die ("Could not connect to mysql because ".mysql_error());;
mysql_select_db("****");
 
$results = mysql_query("SELECT price FROM partno WHERE partnum = '$uname'");
$row = mysql_fetch_assoc($results);
 
// Print  two vars back to flash, you can also use "echo" in place of print
print "var1=The name field with a variable of $uname has been sent to PHP and is back.";
print "&var2=$row";
 
}
I am using this template as a guide for communicating flash <> php

http://www.developphp.com/Flash_tutoria ... hp?tid=39

I keep getting "Resource id..." I am so close. Please help.

Thanks,

Jarrett

Re: Flash/php/mysql

Posted: Mon Dec 21, 2009 3:29 pm
by AbraCadaver
Not sure whay you're getting resource id... I would expect Array because $row is an array. Try:

Code: Select all

print "&var2=" . $row['price'];

Re: Flash/php/mysql

Posted: Tue Dec 22, 2009 8:29 am
by rnash
thanks but that didn't fix the problem.