Mysidia Adoptables Support Forum

Mysidia Adoptables Support Forum (http://www.mysidiaadoptables.com/forum/index.php)
-   Questions and Supports (http://www.mysidiaadoptables.com/forum/forumdisplay.php?f=18)
-   -   Problems with percentage bar (http://www.mysidiaadoptables.com/forum/showthread.php?t=1640)

PokePets 01-09-2011 04:52 AM

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 ;)

Hall of Famer 01-09-2011 11:16 AM

RE: Problems with percentage bar
 
Apparently you forgot to enclose this if statement and your while loop with } symbols:

PHP Code:

if(is_numeric($id)){ 

PHP Code:

while ($i 1) { 

You have five { symbols but only three }, which is not consistent with PHP syntax. Try to add two more } to the appropriate locations of your php file and it should work then.

Edit: Guess you've figured out how to resolve this syntax error? Thats good, have fun coding!


All times are GMT -5. The time now is 05:22 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.