flash to php PARTIALLY SOLVED

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

Cateyes
Forum Commoner
Posts: 63
Joined: Mon Jun 14, 2004 5:06 pm

Post by Cateyes »

Just trying to find one user once I can get a simple search working all the time than I will start messing around with the flash part I want to get working.
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

change this:

Code: Select all

<?php
    $result = @mysql_query("Select player_profiles.playerid, player_profiles.alias 
          FROM player_profiles WHERE name='$name'"); 
?>
to this

Code: Select all

<?php
    $result = @mysql_query("Select player_profiles.playerid, player_profiles.alias 
          FROM player_profiles WHERE name='$name'") or die(" error: ".mysql_error()); 
?>
it just kicks back the part I have eched and nothing else, like there are no matches
what do you mean?
Cateyes
Forum Commoner
Posts: 63
Joined: Mon Jun 14, 2004 5:06 pm

Post by Cateyes »

Well I Put the code in and nothing happens just this same page with no results. This is the page that displays. I have tried all 29 id number as well as 29 alias and no matches.

Search Results

Click here to go back to the search page.
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

if you are using ids make sure you change the query to where id='$id'
also you are using both NAME and alias in your code you provided in your first post... make sure you arn't mixing them up.. maybe change the query to where alias='$alias'

and a small note... where var='foo'

var will be the column name in your db... just checking u knew that
Cateyes
Forum Commoner
Posts: 63
Joined: Mon Jun 14, 2004 5:06 pm

Post by Cateyes »

OK now that I feel totally stupid but thans to all you people that helped Phenom your last post I think woke me up sure felt stupid but relieved that it fetches a result. Now I need to get it to post the whole row that matched the result I have 8 columns in 1 row right now it just returns the result on the id # how would it display all of it?
Here is my new working code:

Code: Select all

<HTML>
<HEAD>
<TITLE>Meamebers Search</TITLE>
</HEAD>
<BODY>
<H2>Search Results</H2>
<?php
$id = $_POST["id"];
$db = mysql_connect("localhost", "name", "password"); 
    mysql_select_db("covfiles", $db); 
    $query = "Select player_profiles.playerid FROM player_profiles WHERE playerid = '".$id."'";
    $result = mysql_query($query);
	while ($record = mysql_fetch_assoc($result)){
		while (list($fieldname, $fieldvalue) = each ($record)) {
			echo $fieldname.": <B>".$fieldvalue."</B><BR>";
     	}
	 echo "<BR>";
	 }
?>
<A HREF="seachbyname.html">Click here to go back to the search page.</A>
 </BODY>
 </HTML>
Again thanks for the help.


feyd|LAST WARNING USE

Code: Select all

TAGS.[/color]
Cateyes
Forum Commoner
Posts: 63
Joined: Mon Jun 14, 2004 5:06 pm

Post by Cateyes »

Scratch that last post I can be so stupid some days I forgot I made changes to my code to only display the id was up till almost 5 in the morning no wonder stupid mistakes happen.
Last edited by Cateyes on Mon Jun 21, 2004 10:58 am, edited 1 time in total.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Code: Select all

$query = mysql_query("select * from player_profiles where playerid = '$id'");
while($row = mysql_fetch_assoc($query))
{
  foreach($row as $k => $v)
  {
    echo "$k = $v<br />\n";
  }
  echo "<br /><br />\n\n";
}
Cateyes, use the

Code: Select all

tags!
Cateyes
Forum Commoner
Posts: 63
Joined: Mon Jun 14, 2004 5:06 pm

Post by Cateyes »

Thanks Feyd your way is easier, but now I was wondering how to take each value and pass to a variable an example would be something like this $alias = $['alias'];, there are 6 values to pass alias, name, profile, age, weapon, quote Again here is my existing code.

Code: Select all

<HTML>
<HEAD>
<TITLE>Meamebers Search</TITLE>
</HEAD>
<BODY>
<H2>Search Results</H2>
<?php
$id = $_POST&#1111;"id"];
$db = mysql_connect("localhost", "name", "password"); 
    mysql_select_db("covfiles", $db); 
    $query = "Select player_profiles.alias, player_profiles.name, player_profiles.profile, player_profiles.age,
		player_profiles.weapon, player_profiles.quote FROM player_profiles WHERE playerid = '".$id."'";
    $result = mysql_query($query);
	while ($record = mysql_fetch_assoc($result))&#123;
		while (list($fieldname, $fieldvalue) = each ($record)) &#123;
			echo $fieldvalue."<BR>";
     	&#125;
	 echo "<BR>";
	 &#125;
?>
<A HREF="seachbyname.html">Click here to go back to the search page.</A>
 </BODY>
 </HTML>
On the plus side I do know how to send the variables back to flash just need to create the now.
Grim...
DevNet Resident
Posts: 1445
Joined: Tue May 18, 2004 5:32 am
Location: London, UK

Post by Grim... »

/headbutts table.

Well, he's getting closer at least...
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

thread locked until Cateyes fixes posting code!

Cateyes, read this: Posting Code in the Forums
Locked