RE: [PHP] Re: MySQL QUERY Results Not Appearing[Scanned]

2004-07-02 Thread Michael Egan
Don't know that this will work but it might help isolate the problem:

/* MySQL Connection Variables */
 $host=localhost;
 $user=arras_WebMaster;
 $password=qwerty;
 $dbase=arras_Members;
  
/* MySQL Connection String */
 if(!$dbConnect = @mysql_connect ($host, $user, $password))
 {
echo Couldn't connect to the database server: .mysql_error().br /;
 }

 if(!$dbSelect = @mysql_select_db ($dbase))
 {
echo Couldn't select the database: .mysql_error().br /;
 }

 if(!$query = @mysql_query(SELECT * FROM RegisteredMembers))
 {
echo Couldn't execute query: .mysql_error().br /;
 }
 else
 {
   while($result = mysql_fetch_array($query))
   {
echo $result['UserID'];
   }
 }


HTH,

Michael Egan



-Original Message-
From: Harlequin [mailto:[EMAIL PROTECTED]
Sent: 02 July 2004 09:34
To: [EMAIL PROTECTED]
Subject: [PHP] Re: MySQL QUERY Results Not Appearing[Scanned]


Craig. Thanks for the response and sorry I've been delayed in getting back
to you.

I put a new page together and dropped all the peripheral code and this is
what I ended up with:

?php
/* MySQL Connection Variables */
 $host=localhost;
 $user=arras_WebMaster;
 $password=qwerty;
 $dbase=arras_Members;

/* MySQL Connection String */
 $Connection=mysql_connect ($host, $user, $password)
 or die ('I cannot connect to the database because: ' . mysql_error());
 mysql_select_db ($dbase);

/* Display Current Members */
 echo \n\n\n\n\n;
 echo h3active members should appear here/h3;

$query = mysql_query(SELECT * FROM RegisteredMembers) or die(could not
execute query);
while($result = mysql_fetch_array($query)){
echo $result['UserID'];
}


?

Still no joy though. Any ideas...?

--
-
 Michael Mason
 Arras People
 www.arraspeople.co.uk
- 
The information contained in this email (and in any attachments sent with it) is 
confidential. It is intended for the addressee only. Access to this email by anyone 
else is unintended and unauthorized.  
If you are not the original addressee, 3tc asks you to please maintain 
confidentiality. If you have received this email in error please notify 3tc 
immediately by replying to it, then destroy any copies and delete it from your 
computer system. 
Any use, dissemination, forwarding, printing or copying of this email by anyone except 
the addressee in the normal course of his/her business, is strictly prohibited. 3tc 
owns the copyright in this email and any document created by us and assert the right 
to be identified as the author of it. Copyright has not been transferred to the 
addressee. 
We protect our systems with Sophos Anti-virus -  
www.sophos.com 
 

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Re: MySQL query problems

2003-07-16 Thread Beauford.2005
Not sure what the problem was, but I dug up a similar script I used for
something else and modifed it for this project, and voila. I then put
the two side by side and I still can't see where the problem is. 

Thanks for the input.

-Original Message-
From: Nomadeous [mailto:[EMAIL PROTECTED] 
Sent: July 16, 2003 5:31 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Re: MySQL query problems


But what's your prob ?
When you say the second one seems to never be executed ...
Does the line:
$row = mysql_fetch_array($result2);
launches a Php Error ?

And pay attention, because you're using mysql_fetch_array and
mysql_fetch_row, be sure that you are not treating the result in the
same way ;-)

Beauford.2005 [EMAIL PROTECTED] a écrit dans le message de
news: [EMAIL PROTECTED]
 Hi,

 Not sure if the problem here is PHP or MySQL, but here we go. I am 
 trying to do two queries on a database - one after the other, but the 
 second one never seems to get executed. The two queries are identical 
 except for two variables. I have checked my form and they are correct 
 and are being sent to the PHP script the way they should be.

 The variables are $playerto, $playerfrom, $nameto, $namefrom. The 'TO'

 query is the one that doesn't work.

 Here is my code. Any help is appreciated.

 if ($namefrom != $nameto) {
 if ($playerfrom != $playerto) {

 include(2004server.inc);
 if($error) {
 include(trades-input.php);
 exit;
 }

 $query1 = select manager.idn, manager.total,
 roster.idp, position, points from roster join reference
 join manager where manager.idn=reference.idn and 
 reference.idp=roster.idp and manager.idn like '$namefrom' and 
 roster.idp like '$playerfrom';

 $result1 = mysql_query($query1) or $mysqlerror = mysql_error();
 if ($mysqlerror) {
 $error = $d_base_error$email_error;
 include(trades-input.php);
 exit;
 }

 $line = mysql_fetch_row($result1);

 mysql_free_result($result1);

 $query2 = select manager.idn, manager.total,
 roster.idp, position, points from roster join reference
 join manager where manager.idn=reference.idn and 
 reference.idp=roster.idp and manager.idn like '$nameto' and roster.idp

 like '$playerto';

 $result2 = mysql_query($query2) or $mysqlerror = mysql_error();
 if ($mysqlerror) {
 $error = $d_base_error$email_error;
 include(trades-inputs.php);
 exit;
 }

 $row = mysql_fetch_array($result2);

 mysql_free_result($result2);
 }
 }




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Re: mysql query

2002-09-11 Thread David Buerer

Look into the LIMIT command, it will limit the number of rows in the result
set to the number you specify

-Original Message-
From: bill [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, September 11, 2002 7:10 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Re: mysql query


function mysql_one_element($query, $element) {
  // quickly returns just one element from a query
  $one=mysql_query($query);
  // add error checking here if you wish
  $r=mysql_fetch_array($one);
  $thisvalue=$r[$element];
  return($thisvalue);
}

$row=mysql_one_element(select euro from brandstofprijzen where id=2,
euro);

Chris Schoeman wrote:

 I use the script below to get one value out of a database:

 $result = mysql_query(select euro from brandstofprijzen where id=2)
 or die (mysql_error());
 while ($row = mysql_fetch_array($result))
 {
 $euro = $row[euro];
 }
 mysql_free_result($result);

 This is working fine, but is there an easier (less code) way to do
 this?

 Thankx


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] Re: mysql query

2002-09-11 Thread David Buerer

sorry bill, i misunderstood your question.  I thought you wanted to only
return one row, not just get one value. Given my new understanding, I would
do something like this which is only a slight variant on what you did
 
 $result = mysql_query(select euro from brandstofprijzen where id=2) or
die (mysql_error()); 
$row=mysql_fetch_array($result);
$euro =$row[0]; 

 -Original Message-
From: bill [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, September 11, 2002 7:50 AM
To: David Buerer
Subject: Re: [PHP] Re: mysql query



Maybe I wasn't clear.  The value returned should be called euro not row 

I didn't think I needed LIMIT because the query should be written to only
get one row; at least the function only returns the first row. 


kind regards, 


bill 


David Buerer wrote: 


  

Look into the LIMIT command, it will limit the number of rows in the result
set to the number you specify 


-Original Message- 
From: bill [ mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] ] 
Sent: Wednesday, September 11, 2002 7:10 AM 
To: [EMAIL PROTECTED] 
Subject: [PHP] Re: mysql query 


function mysql_one_element($query, $element) { 
  // quickly returns just one element from a query 
  $one=mysql_query($query); 
  // add error checking here if you wish 
  $r=mysql_fetch_array($one); 
  $thisvalue=$r[$element]; 
  return($thisvalue); 
} 


$row=mysql_one_element(select euro from brandstofprijzen where id=2,
euro); 


Chris Schoeman wrote: 


 I use the script below to get one value out of a database: 
 
 $result = mysql_query(select euro from brandstofprijzen where id=2) 
 or die (mysql_error()); 
 while ($row = mysql_fetch_array($result)) 
 { 
 $euro = $row[euro]; 
 } 
 mysql_free_result($result); 
 
 This is working fine, but is there an easier (less code) way to do 
 this? 
 
 Thankx 


-- 
PHP General Mailing List ( http://www.php.net/ http://www.php.net/ ) 
To unsubscribe, visit: http://www.php.net/unsub.php
http://www.php.net/unsub.php 




RE: [PHP] Re: MySQL query error

2001-09-17 Thread Niklas Lampén

:) It just started to work. World's a strange place. Maybe someone was doing
something to the server/php/mysql, dunno.


Niklas


-Original Message-
From: _lallous [mailto:[EMAIL PROTECTED]]
Sent: 17. syyskuuta 2001 15:03
To: [EMAIL PROTECTED]
Subject: [PHP] Re: MySQL query error


 mysql_quory($Query);
typos

i can't also see more errors...

Niklas lampén [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Code:
 ?
 $Query = UPDATE feRegUsers SET Constructor='2001-09-17',
 Enertec='2001-09-17', Seatec='2001-09-17' WHERE ID LIKE '288';
 mysql_quory($Query);
 print mysql_error();
 ?

 That results
 You have an error in your SQL syntax near 'Constructor='2001-09-17',
 Enertec='2001-09-17', Seatec='2001-09-17'' at line 1.

 What's wrong? I don't see anything that can be wrong! Am I blind once
again?


 Niklas




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Re: mysql query . need help!!!!!

2001-09-04 Thread Jon Farmer

You cant use a select statement withoug using a table name.
check out this
$query = insert into classification(customername) (select customername
from username where username='$username');

Incorrect in mySQL you can do

mysql select 3+5;

returns 8

plus a whole lot of other functions that can be selected without a table
name.


Jon Farmer
Systems Programmer, Entanet www.enta.net
Tel 01952 428969 Mob 07968 524175
PGP Key available, send blank email to [EMAIL PROTECTED]






-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]