[PHP-DB] Re: Handling database calculations with a php page

2005-03-14 Thread JeRRy
Hi,

So in other words when we are talking queries anything
before a . for SELECT etc means table name and after
the . means column name within that table?

So...

(table_name).(Column_name) ?

Is that right?

J

Find local movie times and trailers on Yahoo! Movies.
http://au.movies.yahoo.com

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



[PHP-DB] watch and learn

2005-03-14 Thread chintan
hi guys my code is as below just look at that and tell me what should i 
add to have two colomns in my table;
?php
include ('connect.php');

$query = SELECT * FROM stockiestandbookingagents order by 
city,companyname,postalcode;
$result = mysql_query($query) or die(Query failed);

for($e=0;$emysql_num_rows($result);$e++)
if($emysql_num_rows($result))
{
print $e+1;
print table border=1;
for($r=0;$rmysql_num_fields($result);$r++)
if($rmysql_num_fields($result))
{
print trtdb;
echo (mysql_field_name($result, $r));
}
if($line=mysql_fetch_array($result, MYSQL_ASSOC))
{
foreach($line as $col_value)
{
print /b/tdtd$col_value/td/tr;
}
}
print /table;
}
if($_GET[city] ==   $coloumn == )
{
	print a href=StockiestandBookingAgents.php?city=%click here/a to 
see all;
}
else
{
	print a href=serv01.phpclick here/a to becomeone;
}

mysql_free_result($result);
mysql_close($link);
?
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP-DB] redirecting function

2005-03-14 Thread Yemi Obembe
hi folks,
who knows any function that can do this javascript trick
script
window.location='http://somewhere.com/'
/script
tried header(location:http://somewhere.com/) but it gave me an 
errorinclude() on the other hand only includes the url  doest redirect to 
it...
thnx



-

A passion till tomorrow,
Opeyemi Obembe | ng.clawz.com






-
Do you Yahoo!?
 Make Yahoo! your home page   

Re: [PHP-DB] redirecting function

2005-03-14 Thread Ken
you forgot the quotation marks on header i believe

header('location: www.foobar.com');

and also make sure your browser supports header redirects, not all browsers do.


On Mon, 14 Mar 2005 01:43:09 -0800 (PST), Yemi Obembe
[EMAIL PROTECTED] wrote:
 hi folks,
 who knows any function that can do this javascript trick
 script
 window.location='http://somewhere.com/'
 /script
 tried header(location:http://somewhere.com/) but it gave me an 
 errorinclude() on the other hand only includes the url  doest redirect 
 to it...
 thnx
 
 -
 
 A passion till tomorrow,
 Opeyemi Obembe | ng.clawz.com
 
 
 -
 Do you Yahoo!?
  Make Yahoo! your home page


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



[PHP-DB] ways of making access and visib compat with 4 and 5

2005-03-14 Thread tony yau
hi all,

I'm trying to make my classes compat with php4 and php5 is there a way of
doing something like this:

if( version== 4)
define( VISIBILITY,  );
else if (version==5)
define( VISIBILITY, protected );

class Flex
{
 VISIBILITY function CompatFunc();
}
-- 

Tony Yau

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



Re: [PHP-DB] ways of making access and visib compat with 4 and 5

2005-03-14 Thread Jochem Maas
tony yau wrote:
hi all,
I'm trying to make my classes compat with php4 and php5 is there a way of
doing something like this:
if( version== 4)
define( VISIBILITY,  );
else if (version==5)
define( VISIBILITY, protected );
class Flex
{
 VISIBILITY function CompatFunc();
}
this will never work.
the if/else block is run _after_ the code is compiled.
the line 'VISIBILITY function CompatFunc();' will always
fail because php won't recognise the token 'VISIBILITY'.
not that putting a constant where you do (even if it were
defined) would work anyway.
btw: you could/should have asked this question on php-generals
(there's no reference to DB usage/problems in your question)
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DB] ways of making access and visib compat with 4 and 5

2005-03-14 Thread Erwin Kerk
tony yau wrote:
hi all,
I'm trying to make my classes compat with php4 and php5 is there a way of
doing something like this:
if( version== 4)
define( VISIBILITY,  );
else if (version==5)
define( VISIBILITY, protected );
class Flex
{
 VISIBILITY function CompatFunc();
}

No, seems to me this is not possible. A trick i'm using is this:
Class Foo {
 /* protected */ function Bar() {}
}
While I'm running PHP4, the class is as above. As soon as I'm switching 
to PHP5, I do a find and replace and remove the comments


Erwin
P.S. This is a database-related malinglist ;)
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DB] Re: Handling database calculations with a php page

2005-03-14 Thread Miles Thompson
That's the convention. You HAVE TO:
- read and use the manual, the rest of us do
- dig out and follow a tutorial on working with PHP and databases
If you do not, you will have no real knowledge of what you're doing, only a 
piecemeal Someone said to do it this way.

Do this BEFORE you get too deeply into your project.
I'd also recommend that you Google for tutorial database normalization 
and take to heart what you read on normalization. It is v. simple, usually 
one of the early chapters of almost any book on databases, but will keep 
your project and structure on focus.

Future queries of this nature will be answered: RTFM, 'cause you have to.
If you are just starting in on this, and about to say But I don't know 
what questions to ask, or how to ask, that's why it is strongly 
recommended you dig out a tutorial and work through it, break the provided 
code and see what happens - error codes, etc., how fixing it works, and so 
forth.

These are NECESSARY first steps. You *cannot* skip the basics.
I can *promise* you these results:
1. The fuzzy maze of functions, use of symbols, obscurity, and the 
seeming magic will disappear and be replaced by confidence and the 
ability to ask sound questions.
2. You will point to your completed pages glowing on on monitor 
and proudly proclaim I did that! Wanna know how it works? (At which point 
your companion's eyes will glaze over and you will look like the 
magic-wielding wizard.)

Cheers - Miles
At 04:46 AM 3/14/2005, JeRRy wrote:
Hi,
So in other words when we are talking queries anything
before a . for SELECT etc means table name and after
the . means column name within that table?
So...
(table_name).(Column_name) ?
Is that right?
J
Find local movie times and trailers on Yahoo! Movies.
http://au.movies.yahoo.com
--
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] PHP MSSQL bug

2005-03-14 Thread Bastien Koert
Do you have permissions to run the query as the php/webserver user?
Bastien
From: Raul IONESCU [EMAIL PROTECTED]
Reply-To: Raul IONESCU [EMAIL PROTECTED]
To: php-db php-db@lists.php.net
Subject: [PHP-DB] PHP MSSQL bug
Date: Mon, 14 Mar 2005 09:16:40 +0200
I have created a stored procedure wich is accessing an remote linked MSSQL
2000 server and works perfectly from Querry Analyzer. The problem occurs
when I try to execute the stored procedure from php 5.0.3 (by using 
mssql_bind
or mssql_query); I've got no error but no result either. It seems that php
doesn't allows to access remote linked servers!
--
Raul IONESCU

--
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] Re: Handling database calculations with a php page

2005-03-14 Thread Bastien Koert
Yes, the 'a' value can also be a table alias name.
Bastien
From: JeRRy [EMAIL PROTECTED]
To: php-db@lists.php.net
Subject: [PHP-DB] Re: Handling database calculations with a php page
Date: Mon, 14 Mar 2005 19:46:46 +1100 (EST)
Hi,
So in other words when we are talking queries anything
before a . for SELECT etc means table name and after
the . means column name within that table?
So...
(table_name).(Column_name) ?
Is that right?
J
Find local movie times and trailers on Yahoo! Movies.
http://au.movies.yahoo.com
--
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] PHP MSSQL bug

2005-03-14 Thread Raul IONESCU
Yes, of course; I'm running under sa credentials so that's not the problem.


On Mon, 14 Mar 2005 09:28:15 -0500, Bastien Koert [EMAIL PROTECTED] wrote:
 Do you have permissions to run the query as the php/webserver user?
 
 Bastien
 
 From: Raul IONESCU [EMAIL PROTECTED]
 Reply-To: Raul IONESCU [EMAIL PROTECTED]
 To: php-db php-db@lists.php.net
 Subject: [PHP-DB] PHP MSSQL bug
 Date: Mon, 14 Mar 2005 09:16:40 +0200
 
 I have created a stored procedure wich is accessing an remote linked MSSQL
 2000 server and works perfectly from Querry Analyzer. The problem occurs
 when I try to execute the stored procedure from php 5.0.3 (by using
 mssql_bind
 or mssql_query); I've got no error but no result either. It seems that php
 doesn't allows to access remote linked servers!
 --
 Raul IONESCU
 
 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 


-- 
Raul IONESCU

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



Re: [PHP-DB] redirecting function

2005-03-14 Thread Ben Galin
On Mar 14, 2005, at 2:26 AM, Ken wrote:
On Mon, 14 Mar 2005 01:43:09 -0800 (PST), Yemi Obembe
[EMAIL PROTECTED] wrote:
hi folks,
who knows any function that can do this javascript trick
script
window.location='http://somewhere.com/'
/script
tried header(location:http://somewhere.com/) but it gave me an 
errorinclude() on the other hand only includes the url  doest 
redirect to it...

you forgot the quotation marks on header i believe
header('location: www.foobar.com');
and also make sure your browser supports header redirects, not all 
browsers do.
Also, from http://us4.php.net/header:
Remember that header() must be called before any actual output is 
sent, either by normal HTML tags, blank lines in a file, or from PHP. 
It is a very common error to read code with include(), or require(), 
functions, or another file access function, and have spaces or empty 
lines that are output before header() is called. The same problem 
exists when using a single PHP/HTML file.

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


Re: [PHP-DB] PHP MSSQL bug

2005-03-14 Thread Robert Twitty
Then, is it safe to assume that you can run stored procedures and queries
that don't use a remote linked server?  Fundamentally, I don't know why
PHP would be the problem, since the remote link is established within the
stored procedure. To make sure that it is not a problem with the mssql
extension, you should see if the same problem occurs with the odbc or
odbtp extensions.

-- bob

On Mon, 14 Mar 2005, Raul IONESCU wrote:

 Yes, of course; I'm running under sa credentials so that's not the problem.


 On Mon, 14 Mar 2005 09:28:15 -0500, Bastien Koert [EMAIL PROTECTED] wrote:
  Do you have permissions to run the query as the php/webserver user?
 
  Bastien
 
  From: Raul IONESCU [EMAIL PROTECTED]
  Reply-To: Raul IONESCU [EMAIL PROTECTED]
  To: php-db php-db@lists.php.net
  Subject: [PHP-DB] PHP MSSQL bug
  Date: Mon, 14 Mar 2005 09:16:40 +0200
  
  I have created a stored procedure wich is accessing an remote linked MSSQL
  2000 server and works perfectly from Querry Analyzer. The problem occurs
  when I try to execute the stored procedure from php 5.0.3 (by using
  mssql_bind
  or mssql_query); I've got no error but no result either. It seems that php
  doesn't allows to access remote linked servers!
  --
  Raul IONESCU
  
  --
  PHP Database Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
  
 
 


 --
 Raul IONESCU

 --
 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] Queries close session

2005-03-14 Thread Adept-Hosting.Net Administration
I am using the following script to maintain a login session on some
pages:

?php
session_start();
if(empty($_SESSION['username'])) {
 die('An error has ocurred. It may be that you have not
logged in,
  or that your session has expired.
  Please try a href=index.phplogging in/a again 
  or contact the 
  a href=mailto:[EMAIL PROTECTED]system
administrator/a');
}
?

The sessions are stable and work fine EXCEPT when I run another PHP
script on the web page such as:

?php
// Make a MySQL Connection
require db_connect.inc;

// Retrieve all the data from the example table
$result = mysql_query(SELECT * FROM members WHERE Status='Inactive') 
or die(mysql_error()); 

echo table border='1' cellpadding='0' cellspacing='1'
align='center';
echo tr thCertificate #/ththDan rank/ththFirst Name/th
thLast Name/th /tr;
// keeps getting the next row until there are no more to get
while($row = mysql_fetch_array( $result )) {
// Print out the contents of each row into a table
echo trtd; 
echo $row['Cert_number'];
echo /tdtd; 
echo $row['Dan_rank'];
echo /tdtd; 
echo $row['First'];
echo /tdtd; 
echo $row['Last'];
echo /td/tr; 
} 
echo /table;

? 

I'm assuming that I am either not maintaining the session properly or
not linking the scripts to the session.

Any pointers on how to accomplish what I'm trying to do?

Thanks,

- Ken

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



Re: [PHP-DB] Queries close session

2005-03-14 Thread Calvin Lough
Because the session you are using probably uses a cookie to remember
the session, it is required that you call session_start before you
output anything to the screen(aka: send any headers). So if you place
the session start at the very top of your page before you include any
files or output anything, the session should work.  Beware of any
whitespace before the ?php  tags because that will also send headers.

Calvin

On Mon, 14 Mar 2005 14:55:53 -0700, Adept-Hosting.Net Administration
[EMAIL PROTECTED] wrote:
 I am using the following script to maintain a login session on some
 pages:
 
 ?php
 session_start();
 if(empty($_SESSION['username'])) {
  die('An error has ocurred. It may be that you have not
 logged in,
   or that your session has expired.
   Please try a href=index.phplogging in/a again
   or contact the
   a href=mailto:[EMAIL PROTECTED]system
 administrator/a');
 }
 ?
 
 The sessions are stable and work fine EXCEPT when I run another PHP
 script on the web page such as:
 
 ?php
 // Make a MySQL Connection
 require db_connect.inc;
 
 // Retrieve all the data from the example table
 $result = mysql_query(SELECT * FROM members WHERE Status='Inactive')
 or die(mysql_error());
 
 echo table border='1' cellpadding='0' cellspacing='1'
 align='center';
 echo tr thCertificate #/ththDan rank/ththFirst Name/th
 thLast Name/th /tr;
 // keeps getting the next row until there are no more to get
 while($row = mysql_fetch_array( $result )) {
 // Print out the contents of each row into a table
 echo trtd;
 echo $row['Cert_number'];
 echo /tdtd;
 echo $row['Dan_rank'];
 echo /tdtd;
 echo $row['First'];
 echo /tdtd;
 echo $row['Last'];
 echo /td/tr;
 }
 echo /table;
 
 ?
 
 I'm assuming that I am either not maintaining the session properly or
 not linking the scripts to the session.
 
 Any pointers on how to accomplish what I'm trying to do?
 
 Thanks,
 
 - Ken
 
 --
 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] Queries close session

2005-03-14 Thread Adept-Hosting.Net Administration
Thanks for the quick reply. That doesn't seem to be the problem, though,
as I can't seem to find any additional spaces being sent in the headers.

 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of Calvin Lough
 Sent: March 14, 2005 3:07 PM
 To: Adept-Hosting.Net Administration; php-db@lists.php.net
 Subject: Re: [PHP-DB] Queries close session
 
 
 Because the session you are using probably uses a cookie to remember
 the session, it is required that you call session_start before you
 output anything to the screen(aka: send any headers). So if you place
 the session start at the very top of your page before you include any
 files or output anything, the session should work.  Beware of any
 whitespace before the ?php  tags because that will also send headers.
 
 Calvin
 
 On Mon, 14 Mar 2005 14:55:53 -0700, Adept-Hosting.Net Administration
 [EMAIL PROTECTED] wrote:
  I am using the following script to maintain a login session on some
  pages:
  
  ?php
  session_start();
  if(empty($_SESSION['username'])) {
   die('An error has ocurred. It may be that you have not
  logged in,
or that your session has expired.
Please try a href=index.phplogging 
 in/a again
or contact the
a href=mailto:[EMAIL PROTECTED]system
  administrator/a');
  }
  ?
  
  The sessions are stable and work fine EXCEPT when I run another PHP
  script on the web page such as:
  
  ?php
  // Make a MySQL Connection
  require db_connect.inc;
  
  // Retrieve all the data from the example table
  $result = mysql_query(SELECT * FROM members WHERE 
 Status='Inactive')
  or die(mysql_error());
  
  echo table border='1' cellpadding='0' cellspacing='1'
  align='center';
  echo tr thCertificate #/ththDan rank/ththFirst 
 Name/th
  thLast Name/th /tr;
  // keeps getting the next row until there are no more to get
  while($row = mysql_fetch_array( $result )) {
  // Print out the contents of each row into a table
  echo trtd;
  echo $row['Cert_number'];
  echo /tdtd;
  echo $row['Dan_rank'];
  echo /tdtd;
  echo $row['First'];
  echo /tdtd;
  echo $row['Last'];
  echo /td/tr;
  }
  echo /table;
  
  ?
  
  I'm assuming that I am either not maintaining the session 
 properly or
  not linking the scripts to the session.
  
  Any pointers on how to accomplish what I'm trying to do?
  
  Thanks,
  
  - Ken
  
  --
  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] Error with Where Clause

2005-03-14 Thread kc68
I get only the table headings and text before and after the table, but not  
the table, when I add the where clause as below.  Without the where  
clause, the table does come up but (as expected) is repetitive and very  
long.  I'm using a template that I've used many times.  I've tried  
changing the $sort_field at the beginning with no success.  Any ideas as  
to a solution?

Ken
$get_data_query = select concat(1091vote038.fn, ' ', 1091vote038.ln),  
1091vote038.vote, 109caucuses1.party,
1091vote038.state, 1091vote038.cd, 109caucuses1.cbc, 109caucuses1.chc,  
109caucuses1.prog, 109caucuses1.bdog,
109caucuses1.rsc
from 1091vote038, 109caucuses1
where
1091vote038.state = 109caucuses1.state
and
1091vote038.cd = 109caucuses1.cd
order by $sort_field $sort_order;

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


[PHP-DB] variable and MySQL

2005-03-14 Thread simon
Hi, I'm trying to make a script but have a problem ...

How could I do this:

I'd like to use   $get_question_data[xxx_name_en]

where xxx would be a variable variable according to the situation where the 
script is called... how would I do this?

tried :

$get_question_data[$test_name_en]
$get_question_data[{$test}_name_en]
${get_question_data[$test_name_en]}

but nothing works  any help would be appreciated. 

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



[PHP-DB] Re: variable and MySQL

2005-03-14 Thread Nadim Attari
 I'd like to use   $get_question_data[xxx_name_en]

 $get_question_data[$test_name_en]
 $get_question_data[{$test}_name_en]
 ${get_question_data[$test_name_en]}

try this ... $get_question_data[{$test}_name_en]

Hope it works...

Nadim Attari

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