[PHP-DB] Row count in a query
Hi, Is it possible to have an incrementing row count in my query that is not part of the table data? i.e. 1 data data 2 data data 3 data data ... This has to be done in the query not the PHP!! Thanks for your help -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Row count in a query
The best way I can think of is: - create a temporary table T with an autoincrement field + desired output column structure - perform a INSERT INTO T SELECT 0, desired output in the temp table - you now have the desired result in your temp table HTH Ignatius _ - Original Message - From: Shaun [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Saturday, January 31, 2004 11:44 Subject: [PHP-DB] Row count in a query Hi, Is it possible to have an incrementing row count in my query that is not part of the table data? i.e. 1 data data 2 data data 3 data data ... This has to be done in the query not the PHP!! Thanks for your help -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: Subject: getting font size from browser
Read this then go away, this is not a CSS or javascript list. http://www.alistapart.com/articles/elastic/ At 13:23 30/01/2004 +, you wrote: Message-ID: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Reply-To: Roy G. Vervoort [EMAIL PROTECTED] From: Roy G. Vervoort [EMAIL PROTECTED] Date: Fri, 30 Jan 2004 11:14:22 +0100 Subject: getting font size from browser Is it possible to retreive the font size or view size from the browser. In the browser it is possible to change the screenview (make it larger or smaller for people with a visual aid). I would like to ineract my stylesheet with these default settings. thans Roy CaptionKit http://www.captionkit.com : Production tools for accessible subtitled internet media, transcripts and searchable video. Supports Real Player, Quicktime and Windows Media Player. VideoChat with friends online, get Freshly Toasted every day at http://www.fresh-toast.net : NetMeeting solutions for a connected world. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Row count in a query
Shaun wrote: Is it possible to have an incrementing row count in my query that is not part of the table data? i.e. 1 data data 2 data data 3 data data ... This has to be done in the query not the PHP!! If you _have_ to get this in your query I'd say you have a flaw in your logic somewhere. However, you can do it in MySQL using these two queries. SELECT @a:=0; SELECT @a:[EMAIL PROTECTED], * FROM table; -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals www.phparch.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Problema con MySQL
Buenos días a todos: Espero que alguno de ustedes hable español y me pueda ayudar a descubrir qué está mal en el siguiente código: El objetivo de la función es acceder a una base de Datos (MySQL) y mostrar los registros que cumplan cierta condición. Si no existe ningún registro que cumpla la condición, despliega un mensaje informa al usuario de la situación, de lo contrario, muestra en una tabla cada uno de los registro encontrados acompañados de las opciones Eliminar y Editar. Por lo menos esto debería hacer. El problema es que no muestra el primero de los registros que cumplen la condición. Le he dado mil vueltas y no he logrado encontrar el error. function mostrar_articulos_admin($boletin) { if (!$boletin == NULL) { $conn = db_connect(); $query = select id_articulo, titulo_articulo, autor_articulo from articulo_boletin where id_boletin=$boletin; $result = mysql_query($query, $conn); $row = 0; $hay_arts = mysql_fetch_row ($result); if ($hay_arts) { echo h1Artículos correspondientes al Boletín $boletin/h1; echo p\n table width=\70%\ align=\center\ cellspacing=0\n tr\n tdbDetalle Artículo/b/td\n td align=\center\bEliminar/b/td\n td align=\center\bEditar/b/td\n /tr; while ($fila = mysql_fetch_array($result, MYSQL_NUM)) { $row++; echo tr bgcolor=\.color_fila($row).\\n; echo tdpb$fila[2]/bbri$fila[3]/i/p/td\n; echo td align=\center\a href=\proces.php?action=delartarticulo=$fila[0]\ img src=\../boletines/ima/eliminar.gif\ border=0/a/td\n; echo td align=\center\a href=\proces.php?action=editartarticulo=$fila[0]\ img src=\../boletines/ima/editar.gif\ border=0/a/td\n; echo /tr\n; } echo /tablebr/p; } else { echo pNo existe ningún Artìculo asociado a este Boletín.brbr/p; } } else { echo pNo ha indicado un número de Boletin Válido, verifique la información e intente de nuevo./p; } } -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Row count in a query
El Dom 01 Feb 2004 12:54, John W. Holmes escribi: Shaun wrote: Is it possible to have an incrementing row count in my query that is not part of the table data? i.e. 1 data data 2 data data 3 data data ... This has to be done in the query not the PHP!! If you _have_ to get this in your query I'd say you have a flaw in your logic somewhere. However, you can do it in MySQL using these two queries. SELECT @a:=0; SELECT @a:[EMAIL PROTECTED], * FROM table; This isn't very good SQL coding. If you use a database with sequences, built a temptable to put the data in temporarly, with an INT field at the begining, and a sequence to have the autoincremental. Very easy, and compatile with any relational DB. :-) -- select 'mmarques' || '@' || 'unl.edu.ar' AS email; - Martn Marqus | Programador, DBA Centro de Telemtica| Administrador Universidad Nacional del Litoral - -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Row count in a query
Hmmm... I would not bet money on John Holmes bad coding. (disclaimer: I have no financial stake in PHP|A, other than being a happy subscriber) More likely the original question was not well formulated. cheers Ignatius _ - Original Message - From: Martn Marqus [EMAIL PROTECTED] To: [EMAIL PROTECTED]; Shaun [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Saturday, January 31, 2004 18:00 Subject: Re: [PHP-DB] Row count in a query El Dom 01 Feb 2004 12:54, John W. Holmes escribi: Shaun wrote: Is it possible to have an incrementing row count in my query that is not part of the table data? i.e. 1 data data 2 data data 3 data data ... This has to be done in the query not the PHP!! If you _have_ to get this in your query I'd say you have a flaw in your logic somewhere. However, you can do it in MySQL using these two queries. SELECT @a:=0; SELECT @a:[EMAIL PROTECTED], * FROM table; This isn't very good SQL coding. If you use a database with sequences, built a temptable to put the data in temporarly, with an INT field at the begining, and a sequence to have the autoincremental. Very easy, and compatile with any relational DB. :-) -- select 'mmarques' || '@' || 'unl.edu.ar' AS email; - Martn Marqus | Programador, DBA Centro de Telemtica | Administrador Universidad Nacional del Litoral - -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] getting font size from browser
thanks, wil use a java group next time, did not know that roy Miles Thompson [EMAIL PROTECTED] schreef in bericht news:[EMAIL PROTECTED] PHP is SERVER side, not browser side. That's a Javascript question. Miles At 11:14 AM 1/30/2004 +0100, Roy G. Vervoort wrote: Is it possible to retreive the font size or view size from the browser. In the browser it is possible to change the screenview (make it larger or smaller for people with a visual aid). I would like to ineract my stylesheet with these default settings. thans Roy -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] mysql date/time question
ok, 2 questions. first, how do i do a mysql query that orders by date? like, say i want to have 5 newest members who have signed up? i want it to display only 5 also. how do i do that? like this? $newestquery = SELECT artid,title,artdate,artauthor FROM article WHERE artdate = $today ORDER BY artdate DESC LIMIT 5; and also, my next question is how do i format the display of date and time from how MySQL stores it to where i want it displayed differently in PHP? like, mysql will store it as -DD-MM and i want it displayed in php as date(n.j.y.) and time displayed as $time = date(g:ia); my time and date columns are 2 different columns in my TABLE, and i want to know how to format the date to enter into mysql and how to format it when i retrive it from mysql. thanks for your help. -james (im a newbie programmer)
Re: [PHP-DB] mysql date/time question
js wrote: ok, 2 questions. first, how do i do a mysql query that orders by date? like this? $newestquery = SELECT artid,title,artdate,artauthor FROM article WHERE artdate = $today ORDER BY artdate DESC LIMIT 5; Honestly, you could have taken the two seconds to try that and see if it worked instead of asking and waiting for an answer from a mailing list. and also, my next question is how do i format the display of date and time from how MySQL stores it Use DATE_FORMAT() in your query. It's a MySQL function, so see the manual for the syntax. It's in chapter... crap.. they changed the chapter numbers recently... chapter 12.4. Either that or use strtotime() on the MySQL date format to convert it into a unix timestamp and use the PHP date() function. -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals www.phparch.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Row count in a query
Martn Marqus wrote: El Dom 01 Feb 2004 12:54, John W. Holmes escribi: Shaun wrote: Is it possible to have an incrementing row count in my query that is not part of the table data? If you _have_ to get this in your query I'd say you have a flaw in your logic somewhere. However, you can do it in MySQL using these two queries. SELECT @a:=0; SELECT @a:[EMAIL PROTECTED], * FROM table; This isn't very good SQL coding. Sure it is. It's the question that's not very good. If you use a database with sequences, built a temptable to put the data in temporarly, with an INT field at the begining, and a sequence to have the autoincremental. Very easy, and compatile with any relational DB. :-) Exactly. That's why I gave a solution for MySQL. -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals www.phparch.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] [Resolved] Unable to connect to MSSQL with PHP through a firewall
Okay, the problem was the MSSQL Client Tools wasn't installed. Once it was installed script connected perfectly. What I had done prior to installing the MSSQL Client Tools was copied ntwdblib.dll from the SQL Server to the Web Server. According the the PHP documentation for Microsoft SQL Server functions http://php.net/mssql this was one of two ways of getting mssql functions to work, the other being installing the Client Tools. I had not installed it initially due to the shear size of the installer I was required to upload to the server, so I opted for just the DLL. Apparently I was wrong, but perhaps the documentation needs to be reworded to reflect that the Client Tools is the only way to get these functions to work properly. Thanks for the help. :) -- Ricky Boone [EMAIL PROTECTED] Planetfurry.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php