Login
...or Sign up
Home
Search
Search Code Snippets
Search People
Search
Code Snippets
People
64 Code Snippets found matching while
<?php //hacemos la conexion a la base de datos include ("conexion.php"); $link = Conectarse(); //funcion que devuelve la conexion //selecciona todos los campos de la tabla usuarios $result = mysql_query("select * from usuarios",$link); //almacena los datos en un array $row while($row = mysql_fetch_array($result)) { //muestra por pantalla los nombres de los usuarios echo $row[nombre]; } ?>
Recogida de datos desde MySql con PHP
Uploaded on
5/11/2007 12:00:00 AM
Programming Language:
PHP
By:
rosele
See more code snippets of
rosele
base de datos
consultas
php
sql
require 'rexml/document' require 'date' require 'net/http' Net::HTTP.version_1_2 class Twitter @@URL = {:host=>"twitter.com", :status=>"/statuses"} @@URL.merge!({ :user_timeline => @@URL[:status]+"/user_timeline", :friends_timeline => @@URL[:status]+"/friends_timeline", :public_timeline => @@URL[:status]+"/public_timeline" }) def initialize(user, pass) @user, @pass = user, pass end def get(target, options={}) endpoint_url = @@URL[target] + (options["type"] ? options["type"] : ".xml") + "?hoge=hoge" options.each do |key, value| endpoint_url += "&"+URI.encode(key)+"="+URI.encode(value) end result=nil req = Net::HTTP::Get.new(endpoint_url) req.basic_auth @user, @pass Net::HTTP.start(@@URL[:host], 80){|http| res = http.request(req) result = parse(res.body) if res["status"]=="200 OK" } result end def parse(body) doc = REXML::Document.new(body) results = [] doc.each_element('/statuses/status') do |elem| id = elem.elements['id'].text.to_i time = DateTime.parse(elem.elements['created_at'].text) text = elem.elements['text'].text results << {:id=>id, :time=>time, :text=>text} end results end end class TwittimeSheet def initialize(twitter) @twitter = twitter end def get_date(date) work_time = {} max_date = date statuses = @twitter.get(:user_timeline, {"since"=> date.strftime("%a, %d %b %Y %X GMT+900") }) if(statuses) then statuses.each do |status| max_date = status[:time] if status[:time] > max_date work_time[status[:time].strftime("%Y-%m-%d")] ||= {} work_time[status[:time].strftime("%Y-%m-%d")][:start] = status[:time] if status[:text] =~ /.*??????.*/ work_time[status[:time].strftime("%Y-%m-%d")][:end] = status[:time] if status[:text] =~ /.*??????.*/ end end return work_time,max_date end def get_month(date_string) result = {} date = Date.parse(date_string) end_date = date while((date.month == end_date.month) && (date < Date.today)) do p "Now get..." + date.to_s work,max_date = get_date(date) result.merge!( work ) date = max_date.next sleep(1) end result end end user, pass, date = ARGV.shift, ARGV.shift, ARGV.shift unless date then p "ENTER!! user password date" else twitter = Twitter.new(user, pass) twittimeSheet = TwittimeSheet.new(twitter) result = twittimeSheet.get_month(date) work_csv = "date,start,end\n" result.each{|k,v| work_csv += "#{k},#{ v[:start].to_s },#{ v[:end].to_s }\n" } File.open("work_sheet_#{date}.csv","w") do |file| file.puts work_csv end p "output end work_sheet_#{date}.csv" end
twittimesheet
Uploaded on
5/12/2007 12:00:00 AM
Programming Language:
ruby
By:
tkmr2000
See more code snippets of
tkmr2000
twitter time
private void getFicheroAudio(Int64 idaudio) { long datos_restantes; MemoryStream ms; int longitud; byte[] buffer = new Byte[10000]; String fichero; MySqlCommand cm = new MySqlCommand(); cm.CommandText += "SELECT bin,filename "; cm.CommandText += "FROM audios "; cm.CommandText += "WHERE id=?idaudio "; cm.Parameters.Add("?idaudio", MySqlDbType.Int64); cm.Parameters["?idaudio"].Value = idaudio; DataSet ds = new DataSet(); ds = new DataSet(); ds = b.getDS(cm); ms = new MemoryStream((byte[])ds.Tables[0].Rows[0]["bin"]); //Response.; datos_restantes = ms.Length; fichero = ds.Tables[0].Rows[0]["filename"].ToString(); Response.ContentType = "application/octet-stream"; Response.AddHeader("Content-Disposition", "attachment; filename=" + fichero); while (datos_restantes > 0) { // Comprobar que el cliente está conectado. if (Response.IsClientConnected) { longitud = ms.Read(buffer, 0, 10000); Response.OutputStream.Write(buffer, 0, longitud); // Vaciar los datos en la salida HTML. Response.Flush(); buffer = new Byte[10000]; datos_restantes = datos_restantes - longitud; } else { //impedir un bucle infinito si el usuario se desconecta datos_restantes = -1; } } }
Descargar un fichero de audio almacenado en un campo BLOB de una base de datos MySql
Uploaded on
5/13/2007 12:00:00 AM
Programming Language:
c#
By:
vela
See more code snippets of
vela
.net
asp.net
blob
database
download
mysql
DECLARE Var1 <data_type> DECLARE Var2 <data_type> DECLARE <cursor_name> CURSOR FOR SELECT <select_statement> OPEN <cursor_name> FETCH NEXT FROM <cursor_name> INTO @Var1, @Var2 WHILE @@FETCH_STATUS = 0 BEGIN FETCH NEXT FROM <cursor_name> INTO @Var1, @Var2 END CLOSE <cursor_name> DEALLOCATE <cursor_name>
SQL DECLARE CURSOR
Uploaded on
5/14/2007 12:00:00 AM
Programming Language:
By:
rcalduch
See more code snippets of
rcalduch
cursor
DECLARE @Var1 Integer DECLARE @Var2 Integer DECLARE myCursor CURSOR FOR SELECT Column1, Column2, FROM myTable WHERE Column1= @Param1 OPEN myCursor FETCH NEXT FROM myCursor INTO @Var1,@Var2 WHILE @@FETCH_STATUS = 0 BEGIN /* DO SOMETHING WITH @Var1 And @Var2 */ FETCH NEXT FROM myCursor INTO @Var1,@Var2 END
SQL Cursor
Uploaded on
5/14/2007 12:00:00 AM
Programming Language:
SQL
By:
Carlos
See more code snippets of
Carlos
CURSOR
SQL
T-SQL
1
2
3
4
...
Help
Help by email
What is Naslu?
|
About Naslu
|
Contact
|
Terms of Use
|
Downloads
|
Webprogramacion.com
|
Blog
|
Top
Links
Select language:
Español
|
English
© 2009 naslu.com