Re: [PHP-DB] Segmentation fault (11) with PHP ODBC

2003-08-22 Thread Sebastian Haag

Tommy Apel said:
 Hi I'm having a little problem ondestanding whats going on
 The problem is that some and only some of my odbc_exec()'s functions while
 others don't and cause an segmentation fault in apache1/2
 My configuration is SuSE 8.1 with Apache2.0.44, PHP4.3.1 --with-iODBC
 after
 that i've added FreeTDS 0.61 as ODBC-driver for MS-SQL2K, now this works
 fine some of the way but not always

 Exampel:
 odbc_exec($conn,select id,name from $user_db.dbo.users); // Works fine
 no
 problem

 odbc_exec($conn,select * from $user_db.dbo.users where (id = '$idz'));
  ^   ^
Are you sure you need those parenthesis???

 //
 Does not work and causes seg fault (11)


 Can anyone maby help me explain this error

 Regards
 Tommy

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




-- 

Once a problem is defined - it is half way solved. (Henry Ford)

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



Re: [PHP-DB] How to do error feedback when adding to indexed table?

2003-08-24 Thread Sebastian Haag
Rene,

-{ Rene Brehmer }- said:
 I'm not sure how to explain this, I'm totally new to MySQL and SQL as a
 whole, this is my first ever code using SQL at all...so plz bare with me
 here...

 I'm working with PHP 4.2.3 and MySQL 4.something (not certain what version
 the end-server runs).

 For a game clan I'm in (MPE 1A in Earth: 2025 - 1a), I'm working on a DB
 to
 store some rather game-specific info. It's only a single table in the DB,
 but the table is indexed by the field 'id'.


Is that your Primary Key? Does this ID have a meaning to you, or is it
random?

 Whenever someone wants to add data to the table, they fill out a form, hit
 submit and either get an error about wrong or missing data, or if ok get a
 preview before being able to finally add it to the table. As the script is
 now, it will attempt to add the data to the table, but if already there,
 nothing happens, and there's no response to the user about it.


Do you mean if the ID is already there?

 I want it to give a feedback message that the data is already in the
 table,
 and bump ppl back to the edit form with that message. For the other things
 the script checks, all it does is load the variable $error with the
 error-message and set a phase-flag to the right value, and then the page
 generation part knows that there's been an error, and regenerates the
 entry
 form with the submitted data. So what I want, is to have the add data part
 to just change the two variables needed for the error system to see
 there's
 something wrong, but I've got no idea what I need to change in the code to
 do that. I've searched google and the archives, but come up with
 nothing...

 Here's the add-data part of the code...the variables in the comment is
 just
 so that I know what kind of data are in each variable, rather than what
 they're actually set to in the DB:

 elseif ($phase == 3) {
 /*
num / id = int
country = string
nw = int
gov = string
strat = string
ally = string
spies = int
totdef = int
totoff = int
owner = string
   */
mysql_connect($host,$username,$password);
@mysql_select_db($database) or die('Unable to select database');
$query = INSERT INTO ally2ally VALUES
 ('.$_POST['num'].','.$_POST['country'].','.$_POST['nw'].','.$_POST['gov'].','.$_POST['strat'].','.$_POST['spies'].','.$_POST['totdef'].','.$_POST['totoff'].','.$_POST['ally'].','.$_POST['owner'].');

mysql_query($query);

mysql_close();
 }

 the error message part is simply this:

 ?php
// if there is an error in the submitted data, display the error
 message
if (isset($error)) {
 ?
 table
tr
  td?php echo($error); ?/td
/tr
 /tablebr
 br
 ?php
}
 ?

 The rest of the code is not essential in this aspect. I just need some
 help
 to figure out how to make the script tell the user that it can't add the
 data because the ID is already in the database...(that's the first field
 btw).

I'm still not sure what exactly you want to do. But usually you make your
ID an AUTO_INCREMENT. That way you don't have to worry about giving the
same ID twice.

Regards,

Sebastian


 TIA

 Rene
 --
 Rene Brehmer
 aka Metalbunny

 http://metalbunny.net/
 References, tools, and other useful stuff...

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




-- 

Once a problem is defined - it is half way solved. (Henry Ford)

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



Re: [PHP-DB] Ifs, ands, or buts

2003-08-27 Thread Sebastian Haag
Diana,

Diana Cassady said:
 Another one that should be easy that I am just not finding anywhere in
 the manual.

 How do I put an 'and' or an 'or' in an if statement?

 I know I could achieve the same results with multiple if statements,
 but that seems so inefficient.

 Lets say I wanted to check a bunch of fields to make sure they weren't
 empty. I can check one field by saying:

 if ($field1) {
 echo Field 1 is not empty;
 }

 Can't I just say:

 if ($field1 and $field2 and $field3 and $field4) {
 echo All four fields are field in;
 }

 Or

 if ($field1 or $field2 or $field3 or $field4) {
 echo At least one of the four fields is filled in;
 }

 ?

 Maybe its not the word and and or but maybe its  or ||

You solved it yourself.  means 'AND' , || means 'OR'

 respectively? That's what I've seen in other languages that let you do
 this. I'm sure there must be a way to do this with PHP, too.

 Thanks for your help.

 Diana
 [EMAIL PROTECTED] Will Work for Chocolate
 http://www.vivaladata.com   (and its worth every byte!)

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




-- 

Once a problem is defined - it is half way solved. (Henry Ford)

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



Re: [PHP-DB] Simple Referrer

2003-08-27 Thread Sebastian Haag
Diana,

Diana Cassady said:
 Hi. This seems like it should be simple. I've had no problem doing this
 in other languages, but can find no reference to this function in the
 PHP manual.

 How can I get PHP to return the referring URL?

 Thanks.

 Diana
 [EMAIL PROTECTED] Will Work for Chocolate
 http://www.vivaladata.com   (and its worth every byte!)

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



$_SERVER('HTTP_REFERER')

[from the php-online documentaion]
The address of the page (if any) which referred the user agent to the
current page. This is set by the user agent. Not all user agents will set
this, and some provide the ability to modify HTTP_REFERER as a feature. In
short, it cannot really be trusted.
[/end]

Is that what you are looking for?!

http://de3.php.net/reserved.variables

You have to check on your PHP-Version if it supports this type of global
variables.



-- 

Once a problem is defined - it is half way solved. (Henry Ford)

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



Re: [PHP-DB] i am so Lost with Php

2003-08-28 Thread Sebastian Haag
Marion,

marionh said:
 I bought my own domain and have Php on it and Myslq..i have no idea what
 these are or how to use the php to set up a guestbook, etc..Is there any
 sites that would tell me how step by step..My host would do it for a fee
 and
 I want to do it myself
 thanks
 marion

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



Take a look at these manuals. They don't tell you how to set up your own
guestbook but they give you all the information you need.

http://www.mysql.com/documentation/mysql/bychapter/index.html

http://de3.php.net/manual/en/

-- 

Once a problem is defined - it is half way solved. (Henry Ford)

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



Re: [PHP-DB] Calculations

2003-08-30 Thread Sebastian Haag
Hi Jerry,

JeRRy said:
 Hi,

 I am not sure if this is possible or not or in what
 format etc.  Maybe it's a PHP, mysql or even a
 JavaScript thing.  But thought I'd post here and see
 if people are aware if it is possible for what I want
 to do.  I have searched alot on the net and yet have
 not come accross what I am looking for, so posting
 here may get me pointed in the right direction.  Okay
 here is what I wanna do. :)

 I have a list of users in multiple tables in the one
 database.  Each user has a field named 'score'.  As
 the table numbers go higher generally the score goes
 higher but never lower than the previous table.  There
 are 22 tables named 1 to 22.  So an example is below:

First of all, why do you have 22 tables???

It would be much more efficient using only ONE.
It would include the fields:

1) ID
2) user
3) score

or something like that. MySQL can easily order them by score.

SELECT user, score
FROM your_table
ORDER BY score

MySQL can also get the total score.

SELECT sum(score)
FROM your_table

So, I would call this a MySQL subject. Think over your database design.

Regards,
Sebastian




-- 

Once a problem is defined - it is half way solved. (Henry Ford)

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



[PHP-DB] Browser-Trouble with Query

2003-09-03 Thread Sebastian Haag
Hi everyone,

I have trouble with a PHP-script querying a MySQL-database. Actually my
Opera-Browser has trouble (version 7.11 on a Win2000 machine). It outputs
a parse error when i enter that page.

  Parse error: parse error in /var/www/mypage.php on line 156

After checking all parenthesis over and over, I decided to enter that page
with the InternetExplorer (version 5.50). And it worked.

What gives me a headache is that I tried commenting out that specific part
of the script. Still parse error on the same line. I inserted a bunch of
empty lines around line # 156 and I still got the same error at the same
line.

I don't have any more ideas. I hope you may have a hint.

Thank you very much. I appreciate your help!

Greetings, Sebastian

P.S. PHP version 4.1.2


-- 

Once a problem is defined - it is half way solved. (Henry Ford)

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



RE: [PHP-DB] Browser-Trouble with Query

2003-09-03 Thread Sebastian Haag
Hi guys,

Hutchins, Richard said:
 Two things:

 First, a copy of your code would help, with line 156 clearly identified.


Sure,

[...more code goes here...]

$query .= $and;

$result = @mysql_query($query)
or die(Game ID:  . mysql_error());
$i = 0;
while($row = @mysql_fetch_row($result))
{
$game_id[$i] = $row[0];
$i++;
}

if($game_id  $def_id)
#156-- {
if($choice == 1)
 frontsDnDst($script, $game_id, $def_id);  /*user defined 
functions
are included in an include file at the beginning of the script*/
elseif($choice == 2)
 coversDnDst($script, $game_id, $def_id);
elseif($choice == 3)
 frontCoverDnDst($script, $game_id, $def_id);
}
else
{
 echo br/br/Sorry, no matching results found.br/;
 echo br/A HREF='erase.php'[Zuruuml;ck]/a;
 exit;
}

[more code goes here...]


 Second, usually there's more information with the parse error. Something
 like expected ',' or ';' that will give you more of a hint. Although,
 I'm

That's all there is. And I have had the ones you are talking about. But
not this time.

 not sure if the PHP.INI file has a setting for displaying that
 information.

 At the very least, the code though.
 -Original Message-
 From: Sebastian Haag [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, September 03, 2003 4:12 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] Browser-Trouble with Query


 Hi everyone,

 I have trouble with a PHP-script querying a MySQL-database.
 Actually my
 Opera-Browser has trouble (version 7.11 on a Win2000
 machine). It outputs
 a parse error when i enter that page.

   Parse error: parse error in /var/www/mypage.php on line 156

 After checking all parenthesis over and over, I decided to
 enter that page
 with the InternetExplorer (version 5.50). And it worked.

 What gives me a headache is that I tried commenting out that
 specific part
 of the script. Still parse error on the same line. I inserted
 a bunch of
 empty lines around line # 156 and I still got the same error
 at the same
 line.

 I don't have any more ideas. I hope you may have a hint.

 Thank you very much. I appreciate your help!

 Greetings, Sebastian

 P.S. PHP version 4.1.2


 --

 Once a problem is defined - it is half way solved. (Henry Ford)

 --
 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




-- 

Once a problem is defined - it is half way solved. (Henry Ford)

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



RE: [PHP-DB] Browser-Trouble with Query

2003-09-03 Thread Sebastian Haag
Hi,

the problem is solved ... but the solution is searched.

I renamed the file to mypage2.php and the script works fine. Puzzles me
quite a bit. So, if anyone has an idea... I'm thankful for any comments.

Thanks to you guys who replied.

Sebastian Haag said:
 Hi guys,

 Hutchins, Richard said:
 Two things:

 First, a copy of your code would help, with line 156 clearly identified.


 Sure,

 [...more code goes here...]

 $query .= $and;

   $result = @mysql_query($query)
   or die(Game ID:  . mysql_error());
   $i = 0;
   while($row = @mysql_fetch_row($result))
   {
   $game_id[$i] = $row[0];
   $i++;
   }

   if($game_id  $def_id)
 #156--   {
   if($choice == 1)
frontsDnDst($script, $game_id, $def_id);  /*user defined 
 functions
 are included in an include file at the beginning of the script*/
   elseif($choice == 2)
coversDnDst($script, $game_id, $def_id);
   elseif($choice == 3)
frontCoverDnDst($script, $game_id, $def_id);
   }
   else
   {
echo br/br/Sorry, no matching results found.br/;
echo br/A HREF='erase.php'[Zuruuml;ck]/a;
exit;
 }

 [more code goes here...]


 Second, usually there's more information with the parse error. Something
 like expected ',' or ';' that will give you more of a hint. Although,
 I'm

 That's all there is. And I have had the ones you are talking about. But
 not this time.

 not sure if the PHP.INI file has a setting for displaying that
 information.

 At the very least, the code though.
 -Original Message-
 From: Sebastian Haag [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, September 03, 2003 4:12 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] Browser-Trouble with Query


 Hi everyone,

 I have trouble with a PHP-script querying a MySQL-database.
 Actually my
 Opera-Browser has trouble (version 7.11 on a Win2000
 machine). It outputs
 a parse error when i enter that page.

   Parse error: parse error in /var/www/mypage.php on line 156

 After checking all parenthesis over and over, I decided to
 enter that page
 with the InternetExplorer (version 5.50). And it worked.

 What gives me a headache is that I tried commenting out that
 specific part
 of the script. Still parse error on the same line. I inserted
 a bunch of
 empty lines around line # 156 and I still got the same error
 at the same
 line.

 I don't have any more ideas. I hope you may have a hint.

 Thank you very much. I appreciate your help!

 Greetings, Sebastian

 P.S. PHP version 4.1.2


 --

 Once a problem is defined - it is half way solved. (Henry Ford)

 --
 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




 --

 Once a problem is defined - it is half way solved. (Henry Ford)

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




-- 

Once a problem is defined - it is half way solved. (Henry Ford)

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