Line of Code [Resolved]

Need help with an engine or coding not on the list? Need help with a game or the website and forums here? Direct all questions here.
Post Reply
User avatar
Epiales
Posts: 1119
Joined: Thu Aug 15, 2013 1:38 am

Line of Code [Resolved]

Post by Epiales »

Okay, trying to write this code to work in my while loop, but can't get it working right...

Code: Select all

<button class="btn" onClick="$('#atknpc').w2popup()"><img src="images/arena.png" width="30" height="30" title="Attack '.$row['username']. '"></button>
any ideas?

code it needs to be in:

Code: Select all

echo '<td class="arenacharid">'.$row['id'].'</td><td class="arenacharname">'.$row['name'].'</td><td class="arenacharlevel">'.$row['level'].'</td><td class="arenacharhp">'.$row['hpoints'].'</td><td class="arenacharattack">'.$row['attack'].'</td><td class="arenachardefense">'.$row['defense'].'</td><td><center><img src="images/arena.png" width="30" height="30" title="Attack '.$row['name']. '"></center></td>';
Last edited by Epiales on Mon Nov 10, 2014 7:49 am, edited 1 time in total.
Nothing fancy, but a work in progress!

http://gameplaytoday.net
User avatar
Jackolantern
Posts: 10893
Joined: Wed Jul 01, 2009 11:00 pm

Re: Line of Code

Post by Jackolantern »

What is happening? An error? Working, but not correctly?
The indelible lord of tl;dr
User avatar
Epiales
Posts: 1119
Joined: Thu Aug 15, 2013 1:38 am

Re: Line of Code

Post by Epiales »

Jackolantern wrote:What is happening? An error? Working, but not correctly?
No error at all, but chops the page off so it won't display
Nothing fancy, but a work in progress!

http://gameplaytoday.net
User avatar
MikuzA
Posts: 395
Joined: Thu Aug 08, 2013 8:57 am

Re: Line of Code

Post by MikuzA »

Epiales wrote:Okay, trying to write this code to work in my while loop, but can't get it working right...

Code: Select all

<button class="btn" onClick="$('#atknpc').w2popup()"><img src="images/arena.png" width="30" height="30" title="Attack '.$row['username']. '"></button>
any ideas?

code it needs to be in:

Code: Select all

echo '<td class="arenacharid">'.$row['id'].'</td><td class="arenacharname">'.$row['name'].'</td><td class="arenacharlevel">'.$row['level'].'</td><td class="arenacharhp">'.$row['hpoints'].'</td><td class="arenacharattack">'.$row['attack'].'</td><td class="arenachardefense">'.$row['defense'].'</td><td><center><img src="images/arena.png" width="30" height="30" title="Attack '.$row['name']. '"></center></td>';
I see that you have in your <button>-tag both " and ', and when you are using php to echo you are using '.
So what I suspect here is that it gets broken here>>

Code: Select all

onClick="$('#atknpc').w2popup()"
try this>

Code: Select all

onClick="$(\'#atknpc\').w2popup()"
Why so serious?

Business Intelligence, Data Engineering, Data Mining
PHP, HTML, JavaScript, Bash/KornShell, Python, C#, PL/SQL
MySQL, DB2, Oracle, Snowflake
Pentaho, DataStage, Matillion, Unity3D, Blender
User avatar
Epiales
Posts: 1119
Joined: Thu Aug 15, 2013 1:38 am

Re: Line of Code

Post by Epiales »

MikuzA wrote:
Epiales wrote:Okay, trying to write this code to work in my while loop, but can't get it working right...

Code: Select all

<button class="btn" onClick="$('#atknpc').w2popup()"><img src="images/arena.png" width="30" height="30" title="Attack '.$row['username']. '"></button>
any ideas?

code it needs to be in:

Code: Select all

echo '<td class="arenacharid">'.$row['id'].'</td><td class="arenacharname">'.$row['name'].'</td><td class="arenacharlevel">'.$row['level'].'</td><td class="arenacharhp">'.$row['hpoints'].'</td><td class="arenacharattack">'.$row['attack'].'</td><td class="arenachardefense">'.$row['defense'].'</td><td><center><img src="images/arena.png" width="30" height="30" title="Attack '.$row['name']. '"></center></td>';
I see that you have in your <button>-tag both " and ', and when you are using php to echo you are using '.
So what I suspect here is that it gets broken here>>

Code: Select all

onClick="$('#atknpc').w2popup()"
try this>

Code: Select all

onClick="$(\'#atknpc\').w2popup()"

Great, worked perfectly. I always have issues with trying to do these links lol...Thank you!
Nothing fancy, but a work in progress!

http://gameplaytoday.net
Post Reply

Return to “Advanced Help and Support”