Mysidia Adoptables Support Forum  

Home Community Mys-Script Creative Off-Topic
Go Back   Mysidia Adoptables Support Forum > Mysidia Adoptables > Questions and Supports

Notices

Reply
 
Thread Tools Display Modes
  #1  
Old 01-09-2011, 04:52 AM
PokePets PokePets is offline
Premium Member
 
Join Date: Jun 2010
Posts: 228
Gender: Male
Credits: 19,310
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
  #2  
Old 01-09-2011, 11:16 AM
Hall of Famer's Avatar
Hall of Famer Hall of Famer is offline
Administrator, Lead Coder
 
Join Date: Dec 2008
Location: South Brunswick
Posts: 4,448
Gender: Male
Credits: 332,554
Hall of Famer is on a distinguished road
Default 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!
Reply With Quote
Reply


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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Couple Problems. NobodysHero Questions and Supports 1 07-13-2014 01:17 PM
New and having problems. Cremuex Levier Newcomer Center 3 03-28-2013 10:59 AM
Problems connecting Silvercivet Questions and Supports 10 02-09-2012 06:28 PM
Download problems.... Soffi Questions and Supports 1 11-27-2011 10:35 PM
How to change alternate percentage? [Answered] lollicat Questions and Supports 1 05-23-2009 10:31 AM


All times are GMT -5. The time now is 06:24 PM.

Currently Active Users: 589 (0 members and 589 guests)
Threads: 4,080, Posts: 32,024, Members: 2,016
Welcome to our newest members, jolob.
BETA





What's New?

What's Hot?

What's Popular?


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
vBCommerce I v2.0.0 Gold ©2010, PixelFX Studios
vBCredits I v2.0.0 Gold ©2010, PixelFX Studios
Emoticons by darkmoon3636