Forums

Unfortunately no one can be told what FluxBB is - you have to see it for yourself.

You are not logged in.

#1 2015-04-09 11:18:25

joel
Member
Registered: 2014-07-04
Posts: 440

what is wrong with this javascript code

what is wrong with this code?

?>
  <tr class="<?php echo $class; ?>"> 
   <td><?php echo $fname .' '.$lname; ?></td>
   <td><?php echo $acc_no; ?></td>
   <td><a href="<?php echo WEB_ROOT; ?>admin/user/?view=email&userId=<?php echo $id; ?>"><?php echo $email; ?></a>&nbsp;/&nbsp;<?php echo $phone; ?></td>
   <td width="120" align="center"><?php echo $bdate; ?></td>
   <td width="80" align="center"><a href="javascript:changeUserStatus(<?php echo $id; ?>, '<?php echo $is_active; ?>');"><?php echo $is_active == 'FALSE'? 'Inactive' : 'Active'; ?></td>
   <td width="70" align="center"><a href="javascript:deleteUser(<?php echo $id; ?>);">Delete</a></td>
  </tr>
<?php

the inactive/activation and delete button is not working

full php code

<?php
if (!defined('WEB_ROOT')) {
	exit;
}

$sql = "SELECT u.id, u.fname, u.lname, u.bdate, u.is_active, u.email, u.phone, a.acc_no
        FROM tbl_users u, tbl_accounts a
		WHERE u.id = a.user_id
		ORDER BY id DESC LIMIT 20";
$result = dbQuery($sql);

?> 

<p align="center" id="mainHead">User Details List</p>
<p style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:14px; margin-bottom:40px;">
View account details, credit, debit funds from the acount or activate, de-activate them.</p>

<form action="processUser.php?action=addUser" method="post"  name="frmListUser" id="frmListUser">
 <table width="100%" border="0" align="center" cellpadding="2" cellspacing="1" class="text">
  <tr align="center" id="listTableHeader"> 
   <td>User Name</td>
   <td>Account No.</td>
   <td>Email / Phone</td>
   <td width="120">Register Date</td>
   <td width="80">User status</td>
   <td width="70">Delete</td>
  </tr>
<?php
while($row = dbFetchAssoc($result)) {
	extract($row);
	
	if ($i%2) {
		$class = 'row1';
	} else {
		$class = 'row2';
	}
	
	$i += 1;
?>
  <tr class="<?php echo $class; ?>"> 
   <td><?php echo $fname .' '.$lname; ?></td>
   <td><?php echo $acc_no; ?></td>
   <td><a href="<?php echo WEB_ROOT; ?>admin/user/?view=email&userId=<?php echo $id; ?>"><?php echo $email; ?></a>&nbsp;/&nbsp;<?php echo $phone; ?></td>
   <td width="120" align="center"><?php echo $bdate; ?></td>
   <td width="80" align="center"><a href="javascript:changeUserStatus(<?php echo $id; ?>, '<?php echo $is_active; ?>');"><?php echo $is_active == 'FALSE'? 'Inactive' : 'Active'; ?></td>
   <td width="70" align="center"><a href="javascript:deleteUser(<?php echo $id; ?>);">Delete</a></td>
  </tr>
<?php
} // end while

?>
  <tr> 
   <td colspan="5">&nbsp;</td>
  </tr>
  <tr> 
   <td colspan="5" align="right"></td>
  </tr>
 </table>
 <p>&nbsp;</p>
</form>

Last edited by joel (2015-04-09 11:19:29)


Warning! be informed and be forewarned. <p>
<?php
I'm not a native English Man. So my comments might contain some grammatical explosive (ELD), missapropreation of words (dinamyt), The use of wrong words (missiles), & mis spelling of words (war drones). Any of the occurrence can cause havoc. So be warned
?>

Offline

#2 2015-04-09 11:19:25

Franz
Lead developer
From: Germany
Registered: 2008-05-13
Posts: 6,639
Website

Re: what is wrong with this javascript code

Well, what does "not working" mean? Do you get an error message?


fluxbb.de | develoPHP

"As code is more often read than written it's really important to write clean code."

Offline

#3 2015-04-09 11:25:28

joel
Member
Registered: 2014-07-04
Posts: 440

Re: what is wrong with this javascript code

Franz wrote:

Well, what does "not working" mean? Do you get an error message?

the two button does not work.


Warning! be informed and be forewarned. <p>
<?php
I'm not a native English Man. So my comments might contain some grammatical explosive (ELD), missapropreation of words (dinamyt), The use of wrong words (missiles), & mis spelling of words (war drones). Any of the occurrence can cause havoc. So be warned
?>

Offline

#4 2015-04-09 15:26:01

Franz
Lead developer
From: Germany
Registered: 2008-05-13
Posts: 6,639
Website

Re: what is wrong with this javascript code

This does not help at all, you can not expect to get help like that, sorry.


fluxbb.de | develoPHP

"As code is more often read than written it's really important to write clean code."

Offline

#5 2015-04-09 16:26:59

joel
Member
Registered: 2014-07-04
Posts: 440

Re: what is wrong with this javascript code

Franz wrote:

This does not help at all, you can not expect to get help like that, sorry.

look a the java part too see if there is error there?


Warning! be informed and be forewarned. <p>
<?php
I'm not a native English Man. So my comments might contain some grammatical explosive (ELD), missapropreation of words (dinamyt), The use of wrong words (missiles), & mis spelling of words (war drones). Any of the occurrence can cause havoc. So be warned
?>

Offline

#6 2015-04-09 16:56:36

joel
Member
Registered: 2014-07-04
Posts: 440

Re: what is wrong with this javascript code

Franz wrote:

This does not help at all, you can not expect to get help like that, sorry.

look a the java part too see if there is error there?


Warning! be informed and be forewarned. <p>
<?php
I'm not a native English Man. So my comments might contain some grammatical explosive (ELD), missapropreation of words (dinamyt), The use of wrong words (missiles), & mis spelling of words (war drones). Any of the occurrence can cause havoc. So be warned
?>

Offline

#7 2015-04-10 06:04:12

GWR
Member
From: Germany
Registered: 2010-08-06
Posts: 194

Re: what is wrong with this javascript code

Open up your browsers dev-console (F12 ? or right-click + "inspect element") and check for console-output, there you will find information about js-errors.

If you have further questions regarding the errors stated there: use google as this will save you much time waiting for responses here.


bye
Ron

Offline

#8 2015-04-10 07:49:06

chris98
Member
From: England, United Kingdom
Registered: 2013-05-31
Posts: 1,292
Website

Re: what is wrong with this javascript code

As Franz said, what is not working? What happens when you run the code? You need to be more precise when you're telling us stuff. Read this: http://www.dreamincode.net/forums/blog/ … od-enough/

Other issues with the code:

$is_active == 'FALSE'? 'Inactive' : 'Active'

- You're checking if it is equal to the string FALSE, not if it's Boolean false - which is what I'm guessing you're trying to do.

You shouldn't be using inline CSS. Use this to link to an external stylesheet in the head of your document and use CSS classes instead.

<link rel="stylesheet" type="text/css" href="style.css">

Your query should fail because the id in the ORDER BY clause is ambiguous. It's not possible to tell with so little code what the issue is. You've probably not declared the correct function name of it's not included. Another possibility is there is a JavaScript syntax error which is stopping it from running.

Offline

Board footer

Powered by FluxBB