AW PHP/MySQL Problem?
AW rocks! but i am getting an error which says 'UNDEFINED' along
i need to pass userid for the hyperlink. grateful for any future help! its for a school project...
$userid = @mysql_fetch_assoc($data);
i need to pass userid for the hyperlink. grateful for any future help! its for a school project...
<link href="includes/grid.css" rel="stylesheet" type="text/css" >
</link>
<script src="includes/grid.js"></script>
view users
<div class="reports">
<?php
include("includes/set_grid.php");
function activewidgets_grid($name, &$data){
$row_count = @mysql_num_rows($data);
$column_count = @mysql_num_fields($data);
// im getting an error here
$userid = @mysql_fetch_assoc($data);
$columns_viewusers = "var ".$name."_columns = ['', '', 'id', 'username', 'firstname','lastname', 'email address','st.#', 'bldg','street', 'city', 'province', 'mobile', 'branch'];\n";
$rows = "var ".$name."_data = [\n";
while ($result = @mysql_fetch_array($data)) {
$rows .= "[";
$rows .= "\"". "<a href='admin_home.php?do=edit_user&uid=". $userid ."'>edit</a>" ."\", ";
$rows .= "\"". "<a href='admin_home.php?do=delete_user&uid='>delete</a>" ."\", ";
for ($i=0; $i < $column_count; $i++) {
$rows .= "\"". activewidgets_html($result[$i])."\", ";
}
$rows .= "],\n";
}
$rows .= "];\n";
$html = "<"."script".">\n";
$html .= $columns_viewusers;
$html .= $rows;
$html .= "try {\n";
$html .= " var $name = new Active.Controls.Grid;\n";
$html .= " $name.setRowCount($row_count);\n";
$html .= " $name.setColumnCount($column_count);\n";
$html .= " $name.setDataText(function(i, j){return ".$name."_data[i][j]});\n";
$html .= " $name.setColumnText(function(i){return ".$name."_columns[i]});\n";
$html .= " document.write($name);\n";
$html .= "}\n";
$html .= "catch (error){\n";
$html .= " document.write(error.description);\n";
$html .= "}\n";
$html .= "</"."script".">\n";
return $html;
}
require_once('../*****/dbconnection.php');
$query_adminu = "SELECT adminuserid, adminusername, adminuser_firstname, adminuser_lastname, adminuser_email, adminuser_streetnumber, adminuser_bldg, adminuser_street, adminuser_city, adminuser_province, adminuser_mobile, branchid FROM admin_users";
$adminu = mysql_query($query_adminu, $dbconnection);
// grid object name
$name = "obj";
// SQL query
$query = $query_adminu;
mysql_select_db("thesis");
// query results
$data = $adminu;
// add grid to the page
echo activewidgets_grid($name, $data);
?>
</div>
anarcho
September 6,