本文整理汇总了PHP中mysql_fetch_object函数的典型用法代码示例。如果您正苦于以下问题:PHP mysql_fetch_object函数的具体用法?PHP mysql_fetch_object怎么用?PHP mysql_fetch_object使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了mysql_fetch_object函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Html
public function Html()
{
//$disabled = ($this->disabled) ? "disabled='disabled'" : "";
$surveid = $_SESSION['surveyid'];
if ($this->Label) {
$this->element = "<label for='{$this->id}' class='label_{$this->class_name}'>{$this->Label}</label>";
}
$this->element .= "<div name='{$this->name}' id='{$this->id}' class='{$this->class_name}' >";
$result = mysql_query("SELECT * FROM survey_options WHERE `surveyid` = {$surveid} ORDER BY `optionid` ASC");
$iter = 0;
while ($Item = mysql_fetch_object($result)) {
$iter++;
$id = 'field_' . $iter;
$name_id_RO = 'optionRO' + $iter;
$name_id_RU = 'optionRU' + $iter;
$label_text_RO = 'Optiune RO ' . $iter;
$label_text_RU = 'Optiune RU ' . $iter;
$label_RO = '<label for="' . $name_id_RO . '">' . $label_text_RO . '</label>';
$label_RU = '<label for="' . $name_id_RU . '">' . $label_text_RU . '</label>';
$this->element .= '<p>' . $label_RO . '<input id="' . $name_id_RO . '" name="optionsRO[]" type="text" class="large_width" value="' . $Item->option_RO . '"/></p>';
$this->element .= '<p>' . $label_RU . '<input id="' . $name_id_RU . '" name="optionsRU[]" type="text" class="large_width bottom" value="' . $Item->option_RU . '"/></p>';
//$this->element .= 'test';
}
$this->element .= "{$this->Value}</div>";
return $this->element;
}
示例2: search_other_function_filters
function search_other_function_filters()
{
global $recherche_loc;
global $charset;
global $msg, $dbh;
// mettre par défaut la localisation du lecteur
if (!isset($recherche_loc) && $_SESSION["empr_location"]) {
$recherche_loc = $_SESSION["empr_location"];
}
$r .= "<select name='recherche_loc'>";
$r .= "<option value='0'>" . htmlentities($msg["search_loc_all_site"], ENT_QUOTES, $charset) . "</option>";
$requete = "select location_libelle,idlocation from docs_location where location_visible_opac=1";
$result = mysql_query($requete, $dbh);
if (mysql_numrows($result)) {
while ($loc = mysql_fetch_object($result)) {
$selected = "";
if ($recherche_loc == $loc->idlocation) {
$selected = "selected";
}
$r .= "<option value='{$loc->idlocation}' {$selected}>{$loc->location_libelle}</option>";
}
}
$r .= "</select>";
return $r;
}
示例3: login
function login($clave)
{
$sqllogin = "SELECT idalumno, numcontrol,nombre FROM talumnos WHERE numcontrol = '" . $_POST["numcontrol"] . "'";
$qConsulta = mysql_query($sqllogin);
if ($fila = mysql_fetch_object($qConsulta)) {
$idalumno = $fila->idalumno;
mysql_free_result($qConsulta);
$sqllogin = "SELECT idexamen FROM texamenes WHERE claveexamen = '" . $_POST["idexamen"] . "'";
$qConsulta = mysql_query($sqllogin) or die("error: " . $sqllogin);
if ($fila2 = mysql_fetch_object($qConsulta)) {
$idexamen = $fila2->idexamen;
$sExam = "SELECT idexamen FROM tans1 WHERE idalumno= " . $idalumno . " AND idexamen = " . $idexamen;
$req = mysql_query($sExam) or die("error: " . $sExam);
if (mysql_fetch_object($req)) {
return $this->login_form(traducir_cadena("already_registered"));
exit;
}
setcookie("logged", $_POST["sessionid"]);
session_start();
$_SESSION['usuario'] = 'alumno';
$_SESSION['sessionid'] = $_POST["sessionid"];
$_SESSION['numcontrol'] = $_POST["numcontrol"];
$_SESSION['idexamen'] = $_POST["idexamen"];
header("Location: exam.php");
} else {
return $this->login_form(traducir_cadena(FORM_ERROR), $clave);
}
} else {
return $this->login_form(traducir_cadena(FORM_ERROR), $clave);
}
}
示例4: section_jointeam_doJoin
function section_jointeam_doJoin($id, $invite)
{
// Try to add player to team
$obj = mysql_fetch_object(mysql_query("select l_team.id, l_team.name, l_team.leader, count(callsign) nump\n from l_team left join l_player on l_team.id = l_player.team\n where l_team.id = " . $id . "\n group by l_team.id, l_team.name, l_team.leader"));
if ($obj->nump == $TEAMSIZE) {
// Team full
echo "<center>Sorry, this team is full. Probably someone was joining it at the same time...</center>";
} else {
// Okay, let's do the update
mysql_query("update l_player set team=" . $id . " where id=" . $_SESSION['playerid']);
// Close team if it's full
if ($obj->nump == $TEAMSIZE - 1) {
mysql_query("update l_team set status='closed' where id=" . $id);
}
// Close team if it has 3 players and is adminclosed
if ($obj->nump == 2) {
mysql_query("update l_team set status='closed' where adminclosed='yes' and id=" . $id);
}
echo '<center>You are now a member of the ' . teamLink($obj->name, $obj->id, false) . ' team.<BR>
A message has been sent to the team leader.</center>';
session_refresh();
// Send a message to the team leader
$player = playerLink($_SESSION['playerid'], $_SESSION['callsign']);
if ($invite) {
$msg = "{$player} has accepted your invitation, and has joined your team!<BR>";
sqlQuery("DELETE FROM bzl_invites WHERE teamid={$obj->id} AND \n playerid={$_SESSION['playerid']}");
} else {
$msg = "A new player just joined your team: {$player}";
}
sendBzMail(0, $obj->leader, $_SESSION['callsign'] . ' joined your team!', $msg);
}
}
示例5: loadContent
public function loadContent($content_id)
{
$this->addLog("<" . __LINE__ . "> " . __METHOD__);
if (!is_numeric($content_id) || $content_id <= 0) {
throw new Exception("<" . __LINE__ . "> " . __METHOD__ . "ERROR: content_id no valido");
} else {
$this->contentId = $content_id;
}
$sql = "SELECT c.*, cp.nombre as provider, cc.descripcion nombreCat, ft.al_titulo album, ft.al_artista artista, ft.al_id, ft.tr_archivo, ft.tr_archivo_preview, cc.xxx\n FROM Web.contenidos c INNER JOIN Web.contenidos_cat cc ON (cc.id=c.categoria)\n INNER JOIN Web.fulltracks ft ON (ft.contenido=c.id)\n INNER JOIN Web.contenidos_proveedores cp ON (c.proveedor = cp.id)\n WHERE c.id={$this->contentId}\n AND c.tipo='" . WAZZUP_FULLTRACK . "'";
$this->addLog("SQL: " . $sql);
$rs = mysql_query($sql, $this->dbc->db);
if (!$rs) {
throw new Exception("ERROR: no se pueden obtener datos del contenido {$this->contentId} ");
} else {
$obj = mysql_fetch_object($rs);
}
$this->contentType = $obj->tipo;
$this->adult = $obj->xxx == "0" ? "false" : "true";
$this->artist = konvert($obj->artista);
$this->provider = konvert($obj->provider);
$this->album = konvert($obj->album);
$this->title = konvert("{$obj->nombre}");
$this->description = konvert(getContentDescription($this->contentId, $this->contentType, $obj->categoria));
$this->publicationYear = date("Y");
// v1.3
$this->archivo = trim("/contenido/fulltracks/" . $obj->archivo);
$this->preview = trim("/contenido/fulltracks/" . $obj->referencia);
}
示例6: Argument
public function Argument($argumentId, $row = false, $parent = false)
{
global $sDB, $sQuery;
if (!$row) {
$res = $sDB->exec("SELECT * FROM `arguments` WHERE `argumentId` = '" . i($argumentId) . "' LIMIT 1;");
$row = mysql_fetch_object($res);
}
if (!$row) {
$this->argumentId = -1;
return;
}
$this->argumentId = $argumentId;
$this->questionId = $row->questionId;
$this->parentId = $row->parentId;
$this->parent = $parent;
$this->userId = $row->userId;
$this->username = $sQuery->getUsernameById($row->userId);
$this->headline = $row->headline;
$this->abstract = $row->abstract;
$this->details = $row->details;
$this->dateAdded = $row->dateAdded;
$this->type = $row->type;
$this->score = $row->score;
$this->url = $row->url;
$this->timeSince = timeSinceString($row->dateAdded);
$this->arguments = array();
}
示例7: getRecentEvents
public static function getRecentEvents($event, $node, $node_id, $N)
{
global $mv_keys;
$events = array();
$_COMMON_COLS__T_PLAYER = "players.name, players.value, players.f_pos_name, players.owned_by_team_id AS 'f_tid', players.f_tname AS 'tname', players.f_rid, f_rname AS 'rname'";
switch ($event) {
case self::T_PLAYER_DEAD:
if (!isset($col)) {
$col = 'date_died';
}
case self::T_PLAYER_SOLD:
if (!isset($col)) {
$col = 'date_sold';
}
case self::T_PLAYER_HIRED:
if (!isset($col)) {
$col = 'date_bought';
}
$_query = "SELECT DISTINCT player_id AS 'pid', %COL AS 'date', {$_COMMON_COLS__T_PLAYER} FROM players, mv_players WHERE players.player_id = mv_players.f_pid AND players.type = " . PLAYER_TYPE_NORMAL . " AND %NODE = {$node_id} AND %COL IS NOT NULL ORDER BY %COL DESC LIMIT {$N}";
$query = str_replace(array('%COL', '%NODE'), array($col, $mv_keys[$node]), $_query);
$result = mysql_query($query);
while ($row = mysql_fetch_object($result)) {
$events[] = $row;
}
break;
case self::T_PLAYER_SKILLS:
$query = "SELECT player_id AS 'pid', game_data_skills.skill_id AS 'skill_id', game_data_skills.cat AS 'cat', game_data_skills.name AS 'skill_name', CONCAT(game_data_skills.name,' (',game_data_skills.cat,')') AS 'skill', {$_COMMON_COLS__T_PLAYER} FROM players, mv_players, players_skills, game_data_skills WHERE \n players.player_id = mv_players.f_pid AND \n mv_players.f_pid = players_skills.f_pid AND\n players_skills.f_skill_id = game_data_skills.skill_id AND \n " . $mv_keys[$node] . " = {$node_id} \n GROUP BY player_id, f_skill_id ORDER BY players_skills.id DESC LIMIT {$N}";
$result = mysql_query($query);
while ($row = mysql_fetch_object($result)) {
$events[] = $row;
}
break;
}
return $events;
}
示例8: relacionar_campos_id
function relacionar_campos_id()
{
$sql = "SELECT `TABLE_SCHEMA`,`TABLE_NAME`, `COLUMN_NAME`, `ORDINAL_POSITION`,\n\t\t\t\t\t`COLUMN_DEFAULT`, `IS_NULLABLE`, `DATA_TYPE`, `CHARACTER_MAXIMUM_LENGTH`,\n\t\t\t\t\t`CHARACTER_SET_NAME`, `COLLATION_NAME`, `COLUMN_TYPE`, `COLUMN_KEY`\n\t\t\t\tFROM INFORMATION_SCHEMA.COLUMNS where TABLE_SCHEMA='" . DB_NAME . "'\n\t\t\t\tORDER BY `TABLE_SCHEMA`,`TABLE_NAME`,`ORDINAL_POSITION` ASC;";
mysql_select_db(DB_NAME) or die;
$result = mysql_query($sql);
$current_schema = '';
$current_table = '';
while ($row = mysql_fetch_object($result)) {
$current_schema = $row->TABLE_SCHEMA;
$current_table = $row->TABLE_NAME;
$estructura[$row->TABLE_NAME][] = $row->COLUMN_NAME;
if ($row->COLUMN_KEY == "PRI") {
$estructura[$row->TABLE_NAME]["llave"] = $row->COLUMN_NAME;
}
}
foreach ($estructura as $tabla => $campo) {
if (in_array("NOMBRE", $campo)) {
$MOSTRAR = "NOMBRE";
} elseif (in_array("DESCRIPCION", $campo)) {
$MOSTRAR = "DESCRIPCION";
} elseif (in_array("TITULO", $campo)) {
$MOSTRAR = "TITULO";
} else {
$MOSTRAR = "";
}
//echo $this->fields[$estructura[$tabla]["llave"]]['input'];
if ($this->fields[$estructura[$tabla]["llave"]]['input'] != "select" && $_GET["table"] != $tabla) {
$this->setInputType($estructura[$tabla]["llave"], 'select');
$this->setValuesFromQuery($estructura[$tabla]["llave"], "SELECT " . $estructura[$tabla]["llave"] . ", {$MOSTRAR} FROM {$tabla} order by {$MOSTRAR}");
}
}
}
示例9: pesquisar
public function pesquisar($id)
{
$query = "select * from usuario where idusuario={$id}";
$result = mysql_query($query);
$obj = mysql_fetch_object($result);
return $obj;
}
示例10: delete
public function delete()
{
if (!empty($_POST['del'])) {
// Nuke departments..
mysql_query("DELETE FROM `" . DB_PREFIX . "departments`\n WHERE `id` IN(" . implode(',', $_POST['del']) . ")\n\t") or die(mswMysqlErrMsg(mysql_errno(), mysql_error(), __LINE__, __FILE__));
$rows = mysql_affected_rows();
// Nuke user department association..
mysql_query("DELETE FROM `" . DB_PREFIX . "userdepts`\n WHERE `deptID` IN(" . implode(',', $_POST['del']) . ")\n ") or die(mswMysqlErrMsg(mysql_errno(), mysql_error(), __LINE__, __FILE__));
if (mswRowCount('departments') == 0) {
@mysql_query("TRUNCATE TABLE `" . DB_PREFIX . "departments`");
}
if (mswRowCount('userdepts') == 0) {
@mysql_query("TRUNCATE TABLE `" . DB_PREFIX . "userdepts`");
}
// Rebuild order sequence..
$seq = 0;
$q = mysql_query("SELECT `id` FROM `" . DB_PREFIX . "departments` ORDER BY `orderBy`");
while ($RB = mysql_fetch_object($q)) {
$n = ++$seq;
mysql_query("UPDATE `" . DB_PREFIX . "departments` SET\n\t `orderBy` = '{$n}'\n WHERE `id` = '{$RB->id}'\n ") or die(mswMysqlErrMsg(mysql_errno(), mysql_error(), __LINE__, __FILE__));
}
return $rows;
}
return '0';
}
示例11: login_student
public function login_student($student_id, $student_password)
{
if (empty($student_id) || empty($student_password)) {
echo "Username or Password is invalid";
return false;
}
$student_id = stripslashes($student_id);
$student_password = stripslashes($student_password);
$student_id = mysql_real_escape_string($student_id);
$student_password = mysql_real_escape_string($student_password);
$student_password = sha1($student_password);
$students_rec = mysql_query("SELECT * FROM " . $this->students_table . " where student_id = {$student_id};");
if (($obj = mysql_fetch_object($students_rec)) != NULL) {
$student = new student($obj->student_id, $obj->user_name, $obj->user_password, $obj->change_password);
if ($student->getUser_password() == $student_password) {
echo "welcome " . $student->getUser_name();
return true;
} else {
echo "Wrong password";
return false;
}
} else {
echo "No such user!";
return false;
}
}
示例12: listCalendarByRange
function listCalendarByRange($sd, $ed)
{
$ret = array();
$ret['events'] = array();
$ret["issort"] = true;
$ret["start"] = php2JsTime($sd);
$ret["end"] = php2JsTime($ed);
$ret['error'] = null;
try {
$db = new DBConnection();
$db->getConnection();
$sql = "select * from `jqcalendar` where `starttime` between '" . php2MySqlTime($sd) . "' and '" . php2MySqlTime($ed) . "'";
$handle = mysql_query($sql);
//echo $sql;
while ($row = mysql_fetch_object($handle)) {
//$ret['events'][] = $row;
//$attends = $row->AttendeeNames;
//if($row->OtherAttendee){
// $attends .= $row->OtherAttendee;
//}
//echo $row->StartTime;
$ret['events'][] = array($row->Id, $row->Subject, php2JsTime(mySql2PhpTime($row->StartTime)), php2JsTime(mySql2PhpTime($row->EndTime)), $row->IsAllDayEvent, 0, 0, $row->Color, 1, $row->Location, '');
}
} catch (Exception $e) {
$ret['error'] = $e->getMessage();
}
return $ret;
}
示例13: dropdown
function dropdown($tabel, $fieldforval, $fieldforname = '', $where = '', $pilih = '', $bariskosong = true, $sparator = ' - ')
{
if ($bariskosong == true) {
echo "<option value=''> </option>";
}
$dst = explode(" as ", $fieldforval);
if ($fieldforname != '') {
$dst2 = explode("+", $fieldforname);
}
$fieldforname == '' ? $sql = "select {$fieldforval} from {$tabel} {$where}" : count($dst2) > 1 ? $sql = "select * from {$tabel} {$where}" : ($sql = "select {$fieldforval},{$fieldforname} from {$tabel} {$where}");
//echo $sql;
$rs = mysql_query($sql) or die(mysql_error());
while ($rw = mysql_fetch_object($rs)) {
count($dst) > 1 ? $valu = $rw->{$dst}[1] : ($valu = $rw->{$dst}[0]);
$sparator == ' [' ? $sp_end = ' ]' : ($sp_end = '');
if ($fieldforname != '') {
count($dst2) > 1 ? $addnm = $rw->{$dst2}[0] . $sparator . $rw->{$dst2}[1] . $sp_end : ($addnm = $rw->{$dst2}[0]);
}
echo "<option value='" . $valu . "'";
if ($pilih == $valu) {
echo " selected";
}
echo " >";
echo $fieldforname == '' ? $rw->{$dst}[1] : $addnm . "</option>";
}
}
示例14: setContent
/**
* Inenhåller menun som passar till Art
* subkategprierna ordnas efter orderNo i matrushkan.
*/
public function setContent()
{
$q = new Query("matruschkaShowAtPlaces");
$q->showAt($this->title, $this->m->lang, "msapOrderNo", "ASC", 100);
$i = 1;
while ($row = mysql_fetch_object($q->getResult())) {
$this->content .= '<div class="leftMenu">';
$this->content .= '<span class="subSecTitle">' . $row->mButtonTitle . '</span>';
$qq = new Query("matruschka");
$qq->whereCustom("mButtonTitle, mRowid", "mParent = '" . $row->mRowid . "' AND mPublished='1' AND mLang='" . $this->m->lang . "' ", "mOrderNo", "ASC", 0);
if ($qq->getNumRows()) {
// om det finns nån som har denna som parent
$this->content .= '<div class="subSection">';
while ($row2 = mysql_fetch_object($qq->getResult())) {
/** Svart om aktiv **/
if ($this->getActive($this->m->ID, $row2->mRowid) == 1) {
$this->content .= '<span class="sideMenuActive"><a href="?ID=' . $row2->mRowid . '">' . $row2->mButtonTitle . '</a></span><br/>';
} else {
$this->content .= '<a href="?ID=' . $row2->mRowid . '">' . $row2->mButtonTitle . '</a><br/>';
}
}
$this->content .= '</div>';
}
$this->content .= '</div>';
if ($i != $q->getNumRows()) {
$this->content .= '<img src="' . Settings::$graphics . 'stripes.gif" />' . "\n";
}
$i++;
}
}
示例15: show_lost_status_form
function show_lost_status_form()
{
global $dbh, $msg, $charset;
global $finance_statut_perdu, $finance_recouvrement_lecteur_statut;
$result = "\n\t<form method='POST' action='admin.php?categ=finance&sub=amendes_relance&action=updateloststatus'>\n\t<h3>" . $msg["finance_statut_perdu_expl_empr"] . "</h3>\t\n\t\t<div class='form-contenu'>\t\t\n\t\t\t<div class='row'> \n\t\t\t\t<div class='colonne2'>\n\t\t\t\t\t" . $msg["finance_statut_expl_perdu"] . ":\n\t\t\t\t</div>\t\t\n\t\t\t\t<div class='colonne_suite'>\n\t\t\t\t\t!!statut_expl!!\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t<div class='row'> \n\t\t\t\t<div class='colonne2'>\n\t\t\t\t\t" . $msg["finance_statut_lecteur_en_recouvrement"] . ":\n\t\t\t\t</div>\t\t\n\t\t\t\t<div class='colonne_suite'>\n\t\t\t\t\t!!statut_empr!!\n\t\t\t\t</div>\t\t\t\t\n\t\t\t</div>\t\n\t\t\t<div class='row'>\t\n\t\t\t</div>\t\n\t\t</div>\t\n\t\t<div class='row'>\t\n\t\t\t<input type='submit' class='bouton' value='" . $msg["finance_amende_modifier"] . "'\">\t\t\t\n\t\t</div>\t\n\t</form>\t\n\t";
$requete = "select idstatut,statut_libelle from docs_statut";
$resultat = mysql_query($requete, $dbh);
$list_statut = "<select name='statut_perdu' id='statut_perdu'>\n";
while ($r = mysql_fetch_object($resultat)) {
$list_statut .= "<option value='" . $r->idstatut . "' ";
if ($r->idstatut == $finance_statut_perdu) {
$list_statut .= "selected='selected' ";
}
$list_statut .= ">" . htmlentities($r->statut_libelle, ENT_QUOTES, $charset) . "</option>\n";
}
$list_statut .= "</select>\n";
$result = str_replace("!!statut_expl!!", $list_statut, $result);
$requete = "select idstatut,statut_libelle from empr_statut";
$resultat = mysql_query($requete, $dbh);
$list_statut = "<select name='statut_empr' id='statut_empr'>\n<option value='0' ";
if (!$finance_recouvrement_lecteur_statut) {
$list_statut .= "selected='selected' ";
}
$list_statut .= ">" . htmlentities($msg["finance_statut_lecteur_no_change"], ENT_QUOTES, $charset) . "</option>\n";
while ($r = mysql_fetch_object($resultat)) {
$list_statut .= "<option value='" . $r->idstatut . "' ";
if ($r->idstatut == $finance_recouvrement_lecteur_statut) {
$list_statut .= "selected='selected' ";
}
$list_statut .= ">" . htmlentities($r->statut_libelle, ENT_QUOTES, $charset) . "</option>\n";
}
$list_statut .= "</select>\n";
$result = str_replace("!!statut_empr!!", $list_statut, $result);
echo $result;
}