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
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 ;-)
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
>
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
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 array that contains an array
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
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
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
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(!"
I mean the ! sign.
Thanks
-Will
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
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
I'm wrestling over deciding on which data type to go with, TEXT or BLOB. I
have one table with one column of 400 characters, I was thinking that TEXT
may be the way to go for that one.
I also have another table that use 4 columns of 800 characters along with 5
columns that use 250 characters. I'
hi
if i have new car and i want to search
each word in description
can i do
SELECT * FROM table WHERE
descript = "new" OR descript ="car"??
any help is appreciated
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
On 03 February 2004 13:45, Alessandro Vitale contributed these pearls of
wisdom:
> try removing curly braces as follows:
>
> $query = mysql_query("UPDATE stories SET status='approved'
>WHERE story_id={$id}"); |
Nothing wrong with the above, it's perfectly valid -- just a slightly
different w
ilto:[EMAIL PROTECTED]
Inviato: martedì 3 febbraio 2004 5.35
A: [EMAIL PROTECTED]
Oggetto: [PHP] SQL Query Not Kosher?
Hi all:
I am trying to get this to work, but always get the same error: that the
resource in mysql_affected_rows() is not valid. Anyone see why this would
be? All variables ha
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_
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
Hi all:
I am trying to get this to work, but always get the same error: that the resource in
mysql_affected_rows() is not valid. Anyone see why this would be? All variables have
been tested for accuracy.
$query = mysql_query("UPDATE stories SET status='approved' WHERE story_id={$id}");
if(m
[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
Hi,
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";
the problem is that i got alot of
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
I have a php page I am writing with an SQL query. I am going to query the
database for a couple of fields. One of the fields I am querying is the
title oh the document someone is searching for. The title will be used at
the top of the html page and will say:
"you are searching for document n
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
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
Hi,
I have a client with a database of around 17k entries. Now due to powers out
of my control the table structure looks like:
CREATE TABLE londonhotelsallphotos (
HotelID double default NULL,
active_hotel_photo_Name varchar(255) default NULL,
URL varchar(255) default NULL,
Number varchar(
[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
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 there. I
I noticed that database are very quick with the SQL Query string such as
Insert, Delete and Update. But with Select, it become very slow. I noticed
that I can do the INT() or DOUBLE() for one of the field when using Select
and it become very quick. But I am unable to make it work for CHAR() or
v
2003 11:18 PM
To: [EMAIL PROTECTED]
Subject: [PHP] SQL Query
I have a problem writing a query that can select a Interest for a specific
user... There are tvo tables, IList and IIndex...
IList contains this :
ID SubID Interest Valid
Edit Delete 1 0 Datorer 0
Edit Delete 2 1
I have a problem writing a query that can select a Interest for a specific
user... There are tvo tables, IList and IIndex...
IList contains this :
ID SubID Interest Valid
Edit Delete 1 0 Datorer 0
Edit Delete 2 1 Spel 0
Edit Delete 3 2 Strategi 0
Edit Delete
Hi,
This is more a SQL question that a php one, but here goes:
I have a table with 3 fields, Date, IP, ISP.
Basically I have written some php to store the following in the table each time
someone hits a page on my site. Now I want to display some info about the users
currently on my site, but I
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
Hi,
This isn't a php question, more of a SQL question, but I don't know any where better
to send it, and I guess its trival enough for someone here to answer.
Anyway, I have a list of members each with a score field. How can I say that Member 3
is ranked 10 out of 100 members for example.
Here
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
Hello,
Here are 2 tables:
airport
-
airport_id
name
code
city_id
destination
---
destination_id
dest_name
airport_dep_id // using airport.airport_id (departure)
airport_arr_id // using airport.airport_id has well (arrival)
I have 2 columns in the second table that uses the
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 succ
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
> -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.
>
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
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";
>
> -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
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
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
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
> -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
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","password")) {
print "Successful connection":
}
else {
print "No
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
Developer
> PHPBeginner.com (Where PHP Begins)
> [EMAIL PROTECTED]
> www.phpbeginner.com
>
>
>
>
> -Original Message-
> From: James, Yz [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, April 26, 2001 5:17 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP] SQL Query time?
>
m Maletsky
Founder, Chief Developer
PHPBeginner.com (Where PHP Begins)
[EMAIL PROTECTED]
www.phpbeginner.com
-Original Message-
From: James, Yz [mailto:[EMAIL PROTECTED]]
Sent: Thursday, April 26, 2001 5:17 AM
To: [EMAIL PROTECTED]
Subject: [PHP] SQL Query time?
Hi all,
I have seen a
s
not in proper math form.
Just call it before a block of code or query, then call it after and
subtract the second one from the first.
SL.
- Original Message -
From: "James, Yz" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, April 25, 2001 2:17 PM
Subjec
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
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? My more-than-useless-ISP seems to have taken an aversio
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
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
ents.
chris
www.variancecreations.net
-Original Message-----
From: Scott VanCaster [mailto:[EMAIL PROTECTED]]
Sent: Sunday, April 15, 2001 5:20 PM
To: [EMAIL PROTECTED]
Subject: [PHP] SQL Query syntax error... Help?
I've only been trying to learn this stuff for a few days and thought
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
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
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
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
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
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
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
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 my script
I have the following sql query and am receiving the following error when it
executes "You have an error in your SQL syntax near '' at line 1."
An
62 matches
Mail list logo