View Single Post
  #1  
Old 01-09-2011, 04:52 AM
PokePets PokePets is offline
Premium Member
 
Join Date: Jun 2010
Posts: 228
Gender: Male
Credits: 19,764
PokePets
Default Problems with percentage bar

So, i want to make a percentage bar ( totalclicks / clicksrequired for next level)

This is the orginal code;
PHP Code:
<?php 
$c1 
="10"
$c2 ="13"
if(
$c1 == $c2

$c1 "100"
$c2 "100"

if(
$c1 $c2){ 
$c2 $c1/$c2
$c2 100/$c2
$c1 100-$c2

if(
$c1 $c2

$c1 $c2/$c1
$c1 100/$c1
$c2 100-$c1


$c1 round($c1); 
$c2 round($c2); 
$c2 $c2+$c1
$c1 $c1*2
$c2 $c2 *2

ob_start(); 
header("Content-Type: image/png"); 
$x 200 
$y 20 
$imgp imageCreate($x$y); 
$random imageColorAllocate($imgp230255232); 
$rand imageColorAllocate($imgp208,230,255); 
ImageFilledRectangle ($imgp0, -19$c1190$rand); 
ImageFilledRectangle ($imgp$c1, -19$c2190$random); 
imagePng($imgp); 
imageDestroy($imgp); 
ob_end_flush(); 
?>
& this is what i made from it xD
PHP Code:
<?php

$id 
$_GET["id"];
$id preg_replace("/[^a-zA-Z0-9s]/"""$id);
$id secure($id);

// Check that ID exists and is valid

if(is_numeric($id)){

// The ID appears to be valid, so double check...

$query "SELECT * FROM ".$prefix."owned_adoptables WHERE aid='$id'";
$result mysql_query($query);
$num mysql_numrows($result);

$query2 "SELECT * FROM ".$prefix."levels WHERE adoptiename='$type' and thisislevel='$nextlevel'";
$result2 mysql_query($query);
$num2 mysql_numrows($result);

//Loop out code
$i=0;
while (
$i 1) {
 


$aid=@mysql_result($result,$i,"aid");
$currentlevel=@mysql_result($result,$i,"currentlevel");
$type=@mysql_result($result,$i,"type");
$totalclicks=@mysql_result($result,$i,"totalclicks");
$requiredclicks=@mysql_result($result2,$i,"requiredclicks");

 
$c1 ="$totalclicks"
$c2 ="$requiredclicks"
if(
$c1 == $c2

$c1 "100"
$c2 "100"

if(
$c1 $c2){ 
$c2 $c1/$c2
$c2 100/$c2
$c1 100-$c2

if(
$c1 $c2

$c1 $c2/$c1
$c1 100/$c1
$c2 100-$c1


$c1 round($c1); 
$c2 round($c2); 
$c2 $c2+$c1
$c1 $c1*2
$c2 $c2 *2

ob_start(); 
header("Content-Type: image/png"); 
$x 200 
$y 20 
$imgp imageCreate($x$y); 
$random imageColorAllocate($imgp230255232); 
$rand imageColorAllocate($imgp208,230,255); 
ImageFilledRectangle ($imgp0, -19$c1190$rand); 
ImageFilledRectangle ($imgp$c1, -19$c2190$random); 
imagePng($imgp); 
imageDestroy($imgp); 
ob_end_flush(); 
?>
I get this error;
Parse error: syntax error, unexpected $end in /home/a2850873/public_html/EXPbalkje.php on line 71

& i think if it is fixed it will still not work ;s
I want images like siggy.php;
www.yoursite.com/percentagebar.php?id=1 shows the percentage bar of the adoptable with id 1.

Already thanks for your help ;)
Reply With Quote