Re: [PHP] SQL query to array?

2006-04-26 Thread William Stokes
Ooopps. I just did have array too many. This did the append corretly: $arr["Team$cur"] = array(id => $id, sort => $srt, jnimi => $nimi); -Will ""Joe Wollard"" <[EMAIL PROTECTED]> kirjoitti viestissä:[EMAIL PROTECTED] Will, Seems to me like you've just done it! Here's another way of doing it

Re: [PHP] SQL query to array?

2006-04-25 Thread Joe Wollard
Will, Seems to me like you've just done it! Here's another way of doing it that will utilize mysql_fetch_assoc() to allow your query to dictate the elements of the array. Keep in mind, I haven't tested this, but since I'm not entirely sure what you are asking the list, I'll offer it anyway ;-)

Re: [PHP] SQL query to array?

2006-04-25 Thread Richard Lynch
On Wed, April 26, 2006 1:39 am, William Stokes wrote: > Can someone please help me to put the results of a query to an array. There are only a few thousand tutorials on this on the 'net... > Never > done this before: > > $sql = "SELECT sortteri,jouk_id,jouk_nimi FROM x_table ORDER BY > sortteri >

Re: [PHP] SQL query to array?

2006-04-25 Thread Jim Lucas
William Stokes wrote: Hello, Can someone please help me to put the results of a query to an array. Never done this before: $sql = "SELECT sortteri,jouk_id,jouk_nimi FROM x_table ORDER BY sortteri ASC"; $result = mysql_query($sql); $num = mysql_num_rows($result); $cur = 1; //create empty ar

Re: [PHP] sql query

2005-03-03 Thread Jochem Maas
Jason Petersen wrote: On Wed, 2 Mar 2005 13:02:39 +0200, William Stokes <[EMAIL PROTECTED]> wrote: Hello Can someone explain this to me. I don't know how to read this. if (!$variable = mysql_query("select id,sessid from users where ... What is this "if(!" This is a way to run a SQL query, capture

Re: [PHP] sql query

2005-03-02 Thread William Stokes
OK got that. Thanks... "Jason Petersen" <[EMAIL PROTECTED]> kirjoitti viestissä:[EMAIL PROTECTED] > On Wed, 2 Mar 2005 13:02:39 +0200, William Stokes <[EMAIL PROTECTED]> > wrote: >> Hello >> >> Can someone explain this to me. I don't know how to read this. >> >> if (!$variable = mysql_query("se

Re: [PHP] sql query

2005-03-02 Thread Jason Petersen
On Wed, 2 Mar 2005 13:02:39 +0200, William Stokes <[EMAIL PROTECTED]> wrote: > Hello > > Can someone explain this to me. I don't know how to read this. > > if (!$variable = mysql_query("select id,sessid from users where ... > > What is this "if(!" This is a way to run a SQL query, capture the r

RE: [PHP] SQL Query Statement for MySQL... (DataType --> TEXT vs BLOB)

2004-06-10 Thread Dennis Seavers
Probably a good question for a MySQL e-mail list. > [Original Message] > From: Scott Fletcher <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Date: 06/10/2004 12:49:07 PM > Subject: [PHP] SQL Query Statement for MySQL... (DataType --> TEXT vs BLOB) > > I'm wrestling over deciding on which data t

Re: [PHP] SQL Query Not Kosher?

2004-02-03 Thread Marek Kilimajer
The argument to mysql_affected_rows must be mysql CONNECTION identifier (from mysql_connect), not RESULT identifier (from mysql_query). Removing the argument will work for you. Mr. Austin wrote: Hi all: I am trying to get this to work, but always get the same error: that the resource in mysql_

Re: [PHP] SQL Query Not Kosher?

2004-02-02 Thread Mr. Austin
Message - From: "Jochem Maas" <[EMAIL PROTECTED]> To: "Mr. Austin" <[EMAIL PROTECTED]> Sent: Monday, February 02, 2004 10:41 PM Subject: Re: [PHP] SQL Query Not Kosher? > from the php function manual: > > > Note: When using UPDATE, MySQL will not

RE: [PHP] sql query and some math

2003-12-17 Thread Jay Blanchard
[snip] q1) i got a database with 2 diffrent tables, i want to take out all the information that arent duplicated from on of the tables, like this: $sql = "SELECT t1.rubrik, t1.info, t2.priser FROM table1 AS t1, table2 AS t2 WHERE t1.arkiv = '0' ORDER BY t1.rubrik"; [/snip] It's a SQL question, bu

Re: [PHP] sql query/displaying results question

2003-10-23 Thread Jason Wong
On Thursday 23 October 2003 22:06, Adam Williams wrote: > So I will have 1 query that needs to print the document $title at the top > of the page and then when it starts showing results. I won't know what > the document title is until the database is queried (because they are > doing a query for

Re: [PHP] SQL Query OT question for the experts :)

2003-10-17 Thread Nicholas Robinson
The following works in MySQL, but obviously (and unlike your client!) you'll want to do this on a copy of the table first... update londonhotelsallphotos set Number = ( if (@hi != HotelID, @line := 1, @line := @line + 1)), HotelID = (@hi := HotelID) Note that if you run this query more than onc

Re: [PHP] SQL Query OT question for the experts :)

2003-10-17 Thread Marek Kilimajer
I think you (or me) will make some php code out of kindness. Order the rows by the id (still there should be some REALLY uniq id) ad then update the same row with a variable that you reset each time that you encounter new id. $i=0; while($row=...) { if($prev != $row['HotelID']) { $i=0; $pr

RE: [PHP] SQL Query request is just hanging.

2003-08-27 Thread Jay Blanchard
[snip] I'm using IIS5.0 on W2k. I have upgraded w2k to sp4 and ms sql server to sp3. I created a new table and just do a simple query in php program. But it seems sql server doesn't return any query result. I'm using mssql_fetch_array() function, but no any return. PHP program is just pending t

RE: [PHP] SQL Query

2003-02-14 Thread Dennis Cole
There is a nice piece of software that you should get, http://ems-hitech.com/mymanager/! It's not free, but you can download a trial. (I would get it) It is great for building querys across tables. -Original Message- From: Zydox [mailto:[EMAIL PROTECTED]] Sent: Friday, February 14, 2003 11

Re: [PHP] SQL Query Question

2001-12-08 Thread Jason G.
Assuming you have the variable member_id (for the member in question)... Get the score for that member and store it to $score... "SELECT score FROM members WHERE id=$member_id" Then to determine rank, just do this... SELECT COUNT(*)+1 as rank FROM members WHERE SCORE>$score; -Jason Garber IonZ

Re: [PHP] sql query with join and same column twice...

2001-08-30 Thread ERISEN, Mehmet Kamil
Please try select dest.dest_name, air.name as airport1, air2.name as airport2 from destination, airport air, airport air2 where dest.airport_dep_id_id=air.airport_id and dest.airport_arr_id=air2.airport_id; you can use the same table as manu times as you like in sql. I

Re: [PHP] sql query successful

2001-07-18 Thread Dave Freeman
On 18 Jul 01, at 13:24, Tyler Longren wrote: From: "Tyler Longren" <[EMAIL PROTECTED]> To: "php-general" <[EMAIL PROTECTED]> Date sent: Wed, 18 Jul 2001 13:24:32 -0500 Subject:[PHP] sql query successful > if ($sql = mysql_query("

Re: [PHP] sql query successful

2001-07-18 Thread David Robley
On Thu, 19 Jul 2001 03:54, Tyler Longren wrote: > Hello everyone, > > I've been writing database enabled site for quite a while now. One > thing I have never figured out it how to determine if a sql query is > successful. > > This works: > if ($connection = mysql_connect("host","username","passwo

RE: [PHP] sql query successful

2001-07-18 Thread Mark Roedel
> -Original Message- > From: Tyler Longren [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, July 18, 2001 1:36 PM > To: Mark Roedel; php-general > Subject: Re: [PHP] sql query successful > > > What about when DELETING from a table??? It always returns true. >

RE: [PHP] sql query successful

2001-07-18 Thread Christopher Ostmo
Mark Roedel pressed the little lettered thingies in this order... > > -Original Message- > > From: Christopher Ostmo [mailto:[EMAIL PROTECTED]] > > Sent: Wednesday, July 18, 2001 2:43 PM > > To: [EMAIL PROTECTED] > > Subject: Re: [PHP] sql query successfu

Re: [PHP] sql query successful

2001-07-18 Thread Christopher Ostmo
Tyler Longren pressed the little lettered thingies in this order... > What about when DELETING from a table??? It always returns true. > Example...the highest ID in this table is 10: > > if ($connection = mysql_connect("localhost","mysql","mysql")) { > print "Connection established"; >

RE: [PHP] sql query successful

2001-07-18 Thread Mark Roedel
> -Original Message- > From: Christopher Ostmo [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, July 18, 2001 2:43 PM > To: [EMAIL PROTECTED] > Subject: Re: [PHP] sql query successful > > > Your statement above is checking to see if the fact that $sql > is e

Re: [PHP] sql query successful

2001-07-18 Thread Christopher Ostmo
Tyler Longren pressed the little lettered thingies in this order... > Hello everyone, > > I've been writing database enabled site for quite a while now. One thing I > have never figured out it how to determine if a sql query is successful. > > This works: > if ($connection = mysql_connect("hos

Re: [PHP] sql query successful

2001-07-18 Thread Tyler Longren
x27;t this work??? Tyler - Original Message - From: "Mark Roedel" <[EMAIL PROTECTED]> To: "Tyler Longren" <[EMAIL PROTECTED]>; "php-general" <[EMAIL PROTECTED]> Sent: Wednesday, July 18, 2001 1:30 PM Subject: RE: [PHP] sql query successf

RE: [PHP] sql query successful

2001-07-18 Thread Hoover, Josh
I believe you should use the error function for the database you're using to check for failed queries. If you're using MySQL (which it appears that you are), you would do something like this: $sql = mysql_query("SELECT * FROM table ORDER BY rand()"); if(mysql_error()) echo "SQL not exec

RE: [PHP] sql query successful

2001-07-18 Thread Mark Roedel
> -Original Message- > From: Tyler Longren [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, July 18, 2001 1:25 PM > To: php-general > Subject: [PHP] sql query successful > > > I've been writing database enabled site for quite a while > now. One thing I have never figured out it how to det

RE: [PHP] SQL Query time?

2001-05-02 Thread PHPBeginner.com
EMAIL PROTECTED] Subject: RE: [PHP] SQL Query time? I wonder if using microtime() gives _actual_ time spent for the query while explain gives _processor_ time. Anuradha On Thu, 26 Apr 2001, Maxim Maletsky wrote: > what about microtime() ? > > you can do it your self: > > $star

RE: [PHP] SQL Query time?

2001-05-02 Thread Anuradha Ratnaweera
I wonder if using microtime() gives _actual_ time spent for the query while explain gives _processor_ time. Anuradha On Thu, 26 Apr 2001, Maxim Maletsky wrote: > what about microtime() ? > > you can do it your self: > > $start = microtime(); > mysql_query()... > $stop = microtime(); > > $to

RE: [PHP] SQL Query time?

2001-04-25 Thread Maxim Maletsky
what about microtime() ? you can do it your self: $start = microtime(); mysql_query()... $stop = microtime(); $token = round($stop-$start, 3); echo "Query took $token seconds"; I mean this is not as precise as SQL would do itself, but will work approximately. Sincerely, Maxim Maletsky Fo

Re: [PHP] SQL Query time?

2001-04-25 Thread Steve Lawson
Sup, Adding "explain" before the select query will show you how long it will take, along with some other info, but it won't actually give you the results. I use a the function microtime (http://php.net/microtime) to figure execution time. When called, microtime will return a string with mili

Re: [PHP] SQL Query time?

2001-04-25 Thread Martín Marqués
On Mié 25 Abr 2001 23:17, James, Yz wrote: > Hi all, > > I have seen a few pages that echo the time it's taken to execute an SQL > query, like "The results in the database were returned in 0.3 seconds." > Anyone know if there's a built in function to display this, and if there > is, what it is? M

Re: [PHP] SQL Query syntax error... Help?

2001-04-15 Thread Plutarck
In the future, to make things easier on yourself, when you get a query syntax error add an "echo $sql;" line right before your query. Almost every time I have a query problem, that solves it. -- Plutarck Should be working on something... ...but forgot what it was. ""Scott VanCaster"" <[EMAIL

RE: [PHP] SQL Query syntax error... Help?

2001-04-15 Thread Chris Cocuzzo
NEVERMIND! :) -Original Message- From: Scott VanCaster [mailto:[EMAIL PROTECTED]] Sent: Sunday, April 15, 2001 6:05 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] SQL Query syntax error... Help? Nevermind everyone, I'm an idiot :) I had the case wrong. I needed $ID, no

RE: [PHP] SQL Query syntax error... Help?

2001-04-15 Thread Chris Cocuzzo
scott, try the entire SQL statement without single quotes around those variables. except for when your setting the WHERE part. Try: $sql ="UPDATE members SET ". "name=$name, ". "email=$email, ". "icq=$icq, ". "password=$password, ". "loginid=$loginid, ". "countryid=$countryid, ". "

Re: [PHP] SQL Query syntax error... Help?

2001-04-15 Thread Scott VanCaster
Nevermind everyone, I'm an idiot :) I had the case wrong. I needed $ID, not $id ! Thanks for the assistance though. Nice to know ya'll are here. Scott ""Scott VanCaster"" <[EMAIL PROTECTED]> wrote in message 9bd394$ikn$[EMAIL PROTECTED]">news:9bd394$ikn$[EMAIL PROTECTED]... > I've only

Re: [PHP] SQL Query syntax error... Help?

2001-04-15 Thread Scott VanCaster
Well, I added the echo($id); back in and am just getting $id printed, so it looks like I have another problem :( Now to see if I can find it and figure it out. ""Scott VanCaster"" <[EMAIL PROTECTED]> wrote in message 9bd3pv$qbd$[EMAIL PROTECTED]">news:9bd3pv$qbd$[EMAIL PROTECTED]... > id is the

Re: [PHP] SQL Query syntax error... Help?

2001-04-15 Thread Scott VanCaster
I changed $id to '$id' No more error, but nothing updates. Assuming it's because with the single quotes nothing in the table matches? "Felix Kronlage" <[EMAIL PROTECTED]> wrote in message 20010415232649.A11407@mad">news:20010415232649.A11407@mad... > On Sun, Apr 15, 2001 at 04:20:07PM -0500, Sc

Re: [PHP] SQL Query syntax error... Help?

2001-04-15 Thread Scott VanCaster
I "think" I tried that. Let me go try that again to be sure. Oh, and what's STDOUT ? I'm just getting started here and haven't even seen that yet :) I can't believe how fast the responses are either. Thanks to all for helping others out so quickly :) "Felix Kronlage" <[EMAIL PROTECTED]> wrot

Re: [PHP] SQL Query syntax error... Help?

2001-04-15 Thread Scott VanCaster
id is the primary key for the table. If I add echo ($id); before the query it echos a 15, which is correct. Well, it's the right id for the test person I'm logged into the site as anyway. I'm missing something here :) "Augusto Cesar Castoldi" <[EMAIL PROTECTED]> wrote in message Pine.A41.4.32

Re: [PHP] SQL Query syntax error... Help?

2001-04-15 Thread Felix Kronlage
On Sun, Apr 15, 2001 at 04:20:07PM -0500, Scott VanCaster wrote: > Any idea what my problem is? I removed the WHERE id=$id and it works, but > updates every record of course :( Have you tried putting the $id in quotes too? | WHERE = '$id' if that doesn't help, print the sql-statement to STDO

Re: [PHP] SQL Query syntax error... Help?

2001-04-15 Thread Augusto Cesar Castoldi
What do you have in the id variable? It's contents can be the problem. regards, Augusto Cesar Castoldi On Sun, 15 Apr 2001, Scott VanCaster wrote: > I've only been trying to learn this stuff for a few days and thought I was > on a roll, but now have run into a problem I don't get at all. In