试图在线表格广告,它应该设置为什么? [英] Trying to ad a online table, what should it be set to?

查看:47
本文介绍了试图在线表格广告,它应该设置为什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好的,我正在向用户表中添加一个名为online的表。

因此,当他们登录时,它将设置(在线)为Y,当他们退出时,它将被设置为N.


但是应该创建什么,它会经常更新,我需要能够在会员在线部分从我的php中读取它吗?

varchar( 50),int(10),或文本...


我如何调用它的结果而不是文本Y但总共。

比如让我们说总共有50个用户= Y所以它会打印50个。


我已经尝试了好几次但是我不断得到9empty)或者(Y)不是总数为8


我创建了这样的表:

[PHP] ALTER TABLE用户

ADD online varchar(1)default'' N''; [/ PHP]


并按如下方式调用:

[PHP] $ sql =" SELECT online FROM FROM WHERE online = $ Y" ;;

$ result = mysql_query($ sql,$ db); [/ PHP]


并称之为:

[PHP]<?php printf($ onlin E); ?> [/ PHP]


有一种特殊的方法来计算Y的值并跳过N

Ok, i am adding a table to the users table called online.
So when they login it will set (online) to Y and when they logout it will be set to N.

But what should it be created as, it will be updated often and i need to beable to read it from my php in the Members online section?
varchar(50), int(10), or Text...

And how do i call the results of it not in text Y but in total.
Like lets say there is a total 50 users=Y so it will PRINT 50.

I have tried several times but i keep getting eather 9empty) or (Y) Not the total as 8

I created the table like this:
[PHP]ALTER TABLE users
ADD online varchar(1) default ''N'';[/PHP]

And call it like this:
[PHP]$sql="SELECT online FROM users WHERE online = $Y";
$result = mysql_query($sql ,$db);[/PHP]

And call it:
[PHP]<?php printf($online); ?>[/PHP]

is there a special way to count the value of Y and skip N

推荐答案

sql =" SELECT online FROM users WHERE online =
sql="SELECT online FROM users WHERE online =


Y" ;;
Y";


result = mysql_query(
result = mysql_query(


这篇关于试图在线表格广告,它应该设置为什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆