Code: Select all
andCode: Select all
tags where approriate when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]
am pretty much an ameture at flash and php. based on the save movie position tutorial that some of you have may have seen, i have created 2 php files that gets data from the mysql files and inserts it into a flash file, well, trying to anyway
its a very simple file
i am basically asking to spot the errors if you can see any
the file runs of my localhost, im not sure how to load the actual files up so ive just copied the code from each file onto here.
the mysql file contains just 2 fields
- id (unique id)
- telno
here is the first php file
CODECode: Select all
<?
$DBhost = "localhost";
$DBuser = "";
$DBpass = "";
$DBName = "insurance";
$table = "contact";
?>Code: Select all
require 'include2.php';
// Connects to the database.
mysql_connect($DBhost,$DBuser,$DBpass);
mysql_select_db("$DBName");
// The SQL query
$query = "SELECT * FROM $table WHERE id = '$id'";
$result = mysql_query($query);
/* This just gets the number of rows in the Query - It's just a check to see if the Name exists - If not it prints out an error statement. */
$numR = mysql_num_rows($result);
// If the number of rows is not equal to one then it prints out an error statement - Name not in Database.
if ($numR == 1) {
print "Status=Success Login Complete&CheckLog=1";
}
else {
print "Status=Failure - Your name was not found - Please register";
}
?>CODE
Code: Select all
<?php
// The registration script adds a record to the SQL database with the user's Name. That's about it.
// This first line of Code is to load your database variables.
require 'include2.php';
// Connects to the Database.
mysql_connect($DBhost,$DBuser,$DBpass);
@mysql_select_db("$DBName");
//selects "id" from the database
$result = mysql_query("SELECT * FROM $contact WHERE id = '$id'");
//This sets the variables from the Database
$id = mysql_result($result,0,"id");
$telno = mysql_result($result,0,"telno");
/* This next bit prints out the value's of the Comment and the positions of the three objects whose properties you want to save. This is the line that Flash will read into the movie. */
print "$telno";
?>frame 1
Code: Select all
stop ();Code: Select all
// if checklog (from login3.php) has a value, go to frame 6
//otherwise go to frame 2
//just to make sure login.php was succesful at loading
if (CheckLog ne "") {
gotoAndPlay (6);
} else {
gotoAndPlay (2);
}Code: Select all
loadvairablesnum ("register2.php?id="+id, 0);
gotoandplay (6);Code: Select all
//if there is a value for id, enter it into texttel.text
if (id ne "") {
texttel.text = ("telno");
}
else{
gotoandplay (1);
}Code: Select all
on (release) {
if (Name ne "") {
gotoAndPlay(2);
Status = "Beginning Login Process.. Please Hold";
//The next line calls the Login.php script. And returns the results from it to the movie.
loadVariablesNum ("Login2.php?id="+id+"&R="+random(999), "0");
}
else {
Status = "Please enter a User Name";
}
}