flash to php PARTIALLY SOLVED
Moderator: General Moderators
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
change this:
to this
Code: Select all
<?php
$result = @mysql_query("Select player_profiles.playerid, player_profiles.alias
FROM player_profiles WHERE name='$name'");
?>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());
?>what do you mean?it just kicks back the part I have eched and nothing else, like there are no matches
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
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
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
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:
Again thanks for the help.
feyd|LAST WARNING USE
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>feyd|LAST WARNING USE
Code: Select all
TAGS.[/color]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.
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
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";
}Code: Select all
tags!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.
On the plus side I do know how to send the variables back to flash just need to create the now.
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.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)){
while (list($fieldname, $fieldvalue) = each ($record)) {
echo $fieldvalue."<BR>";
}
echo "<BR>";
}
?>
<A HREF="seachbyname.html">Click here to go back to the search page.</A>
</BODY>
</HTML>