Flash/php/mysql

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
rnash
Forum Newbie
Posts: 3
Joined: Mon Dec 21, 2009 2:19 pm

Flash/php/mysql

Post 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
User avatar
AbraCadaver
DevNet Master
Posts: 2572
Joined: Mon Feb 24, 2003 10:12 am
Location: The Republic of Texas
Contact:

Re: Flash/php/mysql

Post 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'];
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
rnash
Forum Newbie
Posts: 3
Joined: Mon Dec 21, 2009 2:19 pm

Re: Flash/php/mysql

Post by rnash »

thanks but that didn't fix the problem.
Post Reply