Page 2 of 2

Posted: Sun Jun 20, 2004 9:24 pm
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.

Posted: Sun Jun 20, 2004 10:55 pm
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?

Posted: Sun Jun 20, 2004 11:41 pm
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.

Posted: Mon Jun 21, 2004 12:31 am
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

Posted: Mon Jun 21, 2004 10:49 am
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]

Posted: Mon Jun 21, 2004 10:52 am
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.

Posted: Mon Jun 21, 2004 10:55 am
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!

Posted: Mon Jun 21, 2004 10:59 am
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.

Posted: Mon Jun 21, 2004 11:25 am
by Grim...
/headbutts table.

Well, he's getting closer at least...

Posted: Mon Jun 21, 2004 11:42 am
by feyd
thread locked until Cateyes fixes posting code!

Cateyes, read this: Posting Code in the Forums