Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

php mysql and as3 trying to get multiple vars

Community Beginner ,
Dec 15, 2018 Dec 15, 2018

I don't know what i am doing.  this is my code it works with a simple php document but not the one one that is connected to mysql.  the php that is connected to mysql definitely works and gets variables from mysql.  I am trying to get multiple data back but I can't even get one

I get Error #2007: Parameter text must be non-null. with the file I want

var urlvars:URLVariables = new URLVariables();

  //var urlreq:URLRequest = new URLRequest ("http://www.ohohmoney.com/connectionflash.php");

var urlreq:URLRequest = new URLRequest("http://www.ohohmoney.com/alltogether.php")

urlreq.method = URLRequestMethod.POST;

urlreq.data = urlvars;

var loader:URLLoader = new URLLoader (urlreq);

    loader.dataFormat = URLLoaderDataFormat.VARIABLES;

  loader.addEventListener(Event.COMPLETE, completed);

function completed (event:Event):void{

  var variables:URLVariables = new URLVariables( event.target.data );

if( event.target.data.myId=="" ){

resptxt.text = "not good"

}

else{

resptxt.text = event.target.data.myId

}

}

loader.load(urlreq);

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////

///////////////////////////////////////////////////////////////////////////////////////////////////////////

<?php

DEFINE ('db_username', 'olin');

DEFINE ('db_password', 'xxxxxx');

DEFINE ('db_host', 'localhost');

DEFINE ('db_name', 'myXmlTest');

$con = @mysqli_connect(db_host, db_username, db_password, db_name);

if(mysqli_connect_errno())

{

echo "Failed to connect" . mysqli_connect_error();

}

if(mysqli_ping($con))

{

//echo "Connection Ok!!!";

}

else

{

echo "Error: " . mysqli_error($con);

}

$query = "SELECT id, name, thexml, comment  FROM XMLlist";

$response = mysqli_query($con, $query);

if (mysqli_num_rows($response) > 0) {

$mynum = 0;

while($row = mysqli_fetch_array($response)){

$mynum = $mynum+1;

$id = $row['id'] ;

$name = $row['name'];

$thexml = $row['thexml'];

$comment = $row['comment'];

/////////////this is what I want for my variables

//print "myId$mynum=$id   ";

//print "myName$mynum=$name   ";

///print "myXml$mynum=$thexml   ";

///print "myComment$mynum=$comment   ";

/////////////they print fine

}

/////////////this is was a test did't work

print "myId = hi" ;

}

else {

echo "Couldn't issue database query<br />";

echo mysqli_error($con);

}

mysqli_close($con);

?>

<?php

$x = "abc";

print "myId=$x";

?>

this works but it isn't really useful

279
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Dec 15, 2018 Dec 15, 2018
LATEST

I got it to work -- I had my code started a few lines down after the the php brackets.  For some reason air didn't like that.  I would of never noticed if I didn't start a new file. In that file I also put the code down a few lines.  It had the same error too. pulled them both up to the top and they both worked.   Strange the browser read it just fine.  Don't know what to make of it.  now I have to send the vars back.  hopefully this is easier.  

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines