Jump to content

Assistance on requesting variables


Hoke

Recommended Posts

ok I have a java applet for a puzzle, it uses PARAM's

 

I'd like the param's to to be pulled from mysql based on a predefined id number

 

e.g. in mysql id 1  has other fields populated, score, cols, rows,imgpath

 

I connect to mysql via a config.php script but I'm not sure of the syntax to put on the page to correctly place all of the variables, I'll give you an example

 

<?
include("config.php");
$nm = stripslashes($nm);
$puzzle = select("*","puzzles","puzzle_id='$id' and puzz_name='$nm'");
if($puzzle['puzzle_id'] != ""){
$puzzlename=$puzzle['puzz_name'];
$pts=$puzzle['points'];
$puzz=true;
$rows=$puzzle['rows'];
$cols=$puzzle['cols'];
$imgpath=$puzzle['imgpath'];
$key=$puzzle['key'];
$besttime=$puzzle['bestTime'];
$bonustime=$puzzle['bonusTime];
$bonuspoints=$puzzle['bonuspoints'];
?>



<html>
<head>
<title> The Hello World Applet </title>
</head>
<body>
<p>Here is the output of my applet:</p>
<applet code="SlidePuzzle.class" width="500" height="500">

<param name="id"         value="$id">
<param name="rows"       value="$rows">
<param name="cols"       value="$cols">
<param name="imgPath"    value="$imgpath">
<param name="key"        value="$key">
<param name="pts"        value="$pts">
<param name="bestTime"   value="$besttime">
<param name="bonusTime"  value="$bonustime">
<param name="bonusPts"   value="$bonuspoints">
<param name="width"      value="500">
<param name="height"   value="500">

</applet>

</body>
</html>

my error is

Warning: Unexpected character in input: ''' (ASCII=39) state=1 in /home/gametest.php on line 16

Parse error: syntax error, unexpected '<' in /home/gametest.php on line 33

I feel it is something that should be simple but as a beginner, these are the things that leave me scratching my head for days, it should get new entries for he params based on the current id number

 

PHP Ver 5.2.4

 

 

Link to comment
Share on other sites

You should address those errors too

 

$bonustime=$puzzle['bonusTime]; is missing the end '

 

You also can't use PHP Variables like this in HTML

 

<param name="id"        value="$id">

 

You need to wrap the $id in PHP.

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.