Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 03-11-2011, 08:39 PM   PM User | #1
x34cha
New Coder

 
Join Date: Mar 2011
Posts: 57
Thanks: 5
Thanked 3 Times in 3 Posts
x34cha is an unknown quantity at this point
Arcade Question

I have an arcade... and I call the game names from the db, I want to be able to take a game name, if I click on a button/link and inject it into my html flash player. thanks


PHP Code:



mysql_selectdb
("jaarcade_games",$con);

$result mysql_query("SELECT * FROM games") or die("Query failed with error: ".mysql_error());

while(
$row mysql_fetch_array($result))
  {
something something
  
}

?> 

Last edited by x34cha; 03-11-2011 at 09:38 PM..
x34cha is offline   Reply With Quote
Old 03-11-2011, 10:02 PM   PM User | #2
x34cha
New Coder

 
Join Date: Mar 2011
Posts: 57
Thanks: 5
Thanked 3 Times in 3 Posts
x34cha is an unknown quantity at this point
nobody knows?
x34cha is offline   Reply With Quote
Old 03-11-2011, 10:09 PM   PM User | #3
Lamped
Super Moderator


 
Join Date: Feb 2009
Location: England
Posts: 539
Thanks: 8
Thanked 63 Times in 54 Posts
Lamped will become famous soon enough
Please don't bump your posts.

Since $row will contain relevant information from your database, you can echo() out the code to insert the flash player, and include the information from $row within that.
__________________
lamped.co.uk :: Design, Development & Hosting
marcgray.co.uk :: Technical blog
Lamped is offline   Reply With Quote
Old 03-11-2011, 10:11 PM   PM User | #4
x34cha
New Coder

 
Join Date: Mar 2011
Posts: 57
Thanks: 5
Thanked 3 Times in 3 Posts
x34cha is an unknown quantity at this point
Quote:
Originally Posted by Lamped View Post
Please don't bump your posts.

Since $row will contain relevant information from your database, you can echo() out the code to insert the flash player, and include the information from $row within that.
Right but that would be for a specific game right?

I want a user to be able to click on any of my games, and the name inject into the flash player, through GET/POST???
x34cha is offline   Reply With Quote
Old 03-11-2011, 10:12 PM   PM User | #5
Lamped
Super Moderator


 
Join Date: Feb 2009
Location: England
Posts: 539
Thanks: 8
Thanked 63 Times in 54 Posts
Lamped will become famous soon enough
I don't know, you haven't been very specific. Maybe with more information, we could be more helpful.
__________________
lamped.co.uk :: Design, Development & Hosting
marcgray.co.uk :: Technical blog
Lamped is offline   Reply With Quote
Old 03-11-2011, 10:19 PM   PM User | #6
x34cha
New Coder

 
Join Date: Mar 2011
Posts: 57
Thanks: 5
Thanked 3 Times in 3 Posts
x34cha is an unknown quantity at this point
Quote:
Originally Posted by Lamped View Post
I don't know, you haven't been very specific. Maybe with more information, we could be more helpful.
Ok, so I have called 5 game names from a database and I want to be in any way possible to inject say "blabla.swf" into my flash player in another file or on the same page, when they click on one of the submit buttons for each game, i want the name of that game to go into my flash player.
x34cha is offline   Reply With Quote
Old 03-11-2011, 10:20 PM   PM User | #7
x34cha
New Coder

 
Join Date: Mar 2011
Posts: 57
Thanks: 5
Thanked 3 Times in 3 Posts
x34cha is an unknown quantity at this point
I did it.. code.. if anybody is interested...

PHP Code:
<?php

$con 
mysql_connect("","","");

mysql_selectdb("jaarcade_games",$con);

$result mysql_query("SELECT * FROM games") or die("Query failed with error: ".mysql_error());

while(
$row mysql_fetch_array($result))
  {
 
$game $row["game_name"];
  echo 
'<a href="/arcade2.php?game=' .$game'"> ' .$game'</a>';
 }

?>

Last edited by x34cha; 03-11-2011 at 10:41 PM..
x34cha is offline   Reply With Quote
Old 03-11-2011, 10:42 PM   PM User | #8
Lamped
Super Moderator


 
Join Date: Feb 2009
Location: England
Posts: 539
Thanks: 8
Thanked 63 Times in 54 Posts
Lamped will become famous soon enough
So that first page sets the name. You might want to use:

PHP Code:
echo('<input type="hidden" name="game_name" value="'.$row['game_name'].'" />'); 
Then in the next page, when displaying the swfobject code, <embed> or <object>, use:

PHP Code:
echo($_POST['game_name']); 
in place of your swf file.
__________________
lamped.co.uk :: Design, Development & Hosting
marcgray.co.uk :: Technical blog
Lamped is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 04:31 AM.


Advertisement
Log in to turn off these ads.