[PHP-DB] Re: Screen size, browser on php

2003-02-28 Thread Bastian Vogt
 Is there a way of getting from php the screen size?

Sorry but as php is only server-side, there is no way to get the screen
size. You have to use javascript and send the result to the page again, as
you suggested yourself.

Regards,
Bastian


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



[PHP-DB] Re: foreach problem

2003-02-07 Thread Bastian Vogt

 $sql2 = INSERT INTO cal_date_map (entry_id, date) VALUES (\$entry_id\,
 \$val\);

Where does $entry_id come from? Maybe it's unique?

Bastian


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




[PHP-DB] Re: vaiable from one page to another

2003-02-05 Thread Bastian Vogt
Hi,

you have to write it exactly like this:

echo $_POST['fname'];

HTH,
Bastian



 echo $_post(fname)


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




[PHP-DB] Re: select from multi tables

2003-02-03 Thread Bastian Vogt
 SELECT SUM(T1.F1) AS C1, SUM(T2.F1) AS C2 FROM T1, T2

Hi,

T1,T2 is a join of the two tables which means that you combine each value of T1 with 
each value of T2. This is why you don't get the result you want. In your case I simply 
would do two querys as it won't make any problems:
SELECT SUM T1.F1 FROM T1;
SELECT SUM T2.F2 FROM T2;

Regards,
Bastian


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




[PHP-DB] Re: Echo with extra characters

2003-01-08 Thread Bastian Vogt
Maybe you want to use urlencode()?!

hth,
Bastian

Alex Francis schrieb:

 I have the following code in my page as a header.
 ?
 if ($mainarea==Language)
 {
 header(Location:add_5-14_material.php?mainarea=$mainarea);
 }
 else
 {
 }
 ?
 When I echo $mainarea I get \'Language\'. I think it is something to do
 with my quotation marks but need some help.

 How do I get rid of the ' and \ so that I am left with my variable?.


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




[PHP-DB] Re: Dumping MySQL rows into a 2D array

2002-12-13 Thread Bastian Vogt
Hi,

first leave out the loop with for ($i...).
then use the loop with while and make sure that you create arrays. you're
currently filling the same variables with different results each time. the last
one always overwrites the ones bevor.
so add those brackets: []:
 $dbRow['ev_id'][]= $row[id];
 $dbRow['ev_uid'][]   = $row[user_id];
  


HTH,
Bastian

George Pitcher schrieb:

 Hi all,

 I want to grab the resul from a db query and store it in an array so that I
 can selectively grab the data later.

 This is what I'm doing:

 $dbRowCount = mysql_num_rows( $result );
 for ($i = 1; $i = $dbRowCount; ++$i) {
 while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
 $dbRow['ev_id']= $row[id];
 $dbRow['ev_uid']   = $row[user_id];
 $dbRow['ev_title'] = $row[name];
 $dbRow['ev_cat']   = $row[category];
 $dbRow['ev_sd']= $row[start_day];
 $dbRow['ev_ed']= $row[end_day];
 }
 }

 In my sample database, I have two records which are both found with the
 query (tested in MySQLFront) but the array ends up with 3 rows each with the
 last record in it.

 Any suggestions?

 George

 ===

 George Pitcher
 HERON Technical Manager
 Ingenta plc
 23-38 Hythe Bridge Street, Oxford, OX1 2ET
 T  +44 (0)1865 799137 direct
 T  +44 (0)1865 799000 switchboard
 F  +44 (0)1865 799134
 E  [EMAIL PROTECTED]

 www.ingenta.com
 Ingenta: Empowering the exchange of academic and professional content
 online.


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




[PHP-DB] Re: Final question of the week :-)

2002-12-11 Thread Bastian Vogt
Hi,

you could use IN in your query:

$sql = select * from. where id in (0// start your query
if (count($selection) = 1) {
for ($i=0;$icount($selection);$i++) {

echo $selection[$i];
$sql .= ,.$selection[$i];// add each ID to your query

}};

$sql .= );  // finish the query, then execute it
$res = mysql_query($sql);


HTH,
Bastian


Chris Payne schrieb:

 Hi there everyone,

 I use the following code to collect date from multiple tickboxes on my form:

 if (count($selection) = 1) {
 for ($i=0;$icount($selection);$i++) {

 echo $selection[$i];

 }};

 $selection is the ID number and passes fine, but what I need it to do is
 query my DB via the above query displaying the results from the multiple
 ID's, how can I do this from this array?  I know from a single ID / string
 but not this way.

 Please help, i'm almost totally bald from frustration :-)

 Chris




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




[PHP-DB] Re: adding in array

2002-12-10 Thread Bastian Vogt
Hi,

I'ld suggest this:

// inside your loop
$array[$year] += $value;

HTH,
Bastian



Martin Allan Jensen schrieb:

 Hi all,

 I have a problem i know you can help me with.

 I have this flushet out from a loop command:
 Year: 2000  ID: 14  Value: 300
 Year: 2002  ID: 11  Value: 640
 Year: 2002  ID: 10  Value: 100
 Year: 2003  ID: 11  Value: 200
 Year: 2004  ID: 11  Value: 150
 Year: 2005  ID: 11  Value: 250

 I need PHP to put it into an array, but if it's the same YEAR the it's supposed to 
add the two values, so if i made a flush of the arrayt it would say somthing like:
 Array( [0] = Array ( [2000] = 300) [1] = Array( [2002] = 740 ) [2] = Array( 
[2003]  = 200)  [4] = Array( [2004]  = 150) [5] = Array( [2005]  = 250))

 So here is the little plan,
 I only got the values in a variable in a loop, so i guess firstly putting it into an 
array could be a good idea, then add it and put it into an array again so i can flush 
the output, but i'm really bad at array (and english) so i really hope that you will 
help me.

 I hope you get it, Thanks A lot for your help !!

 BEST Regards,
 Martin Allan Jensen


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




[PHP-DB] Re: adding in array

2002-12-10 Thread Bastian Vogt
 Lets say $year is 2000
 There is not defined index 2000 at $array.
 It is going to be undefined offset.

Hm... I think it's gonna work, but if it's one of the don'ts in
progamming style, could you tell me why you shouldn't do this and how to
make it better (and nice)?

Regards,
Bastian


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




[PHP-DB] Re: Fw: Insert strtoupper

2002-12-09 Thread Bastian Vogt
Hi,

in your query strtoupper is treated as a string and not as a function.
You have to write this:

mysql_query (INSERT INTO anagrafe (codice,nome, cognome, codicefiscale)
VALUES
('.strtoupper($codicefiscale).','$NOME','.strtoupper($cognome).','.strtoupper($codicefiscale).',
...

Regards,
Bastian


Antonio Bernabei schrieb:

  Hi,
 
  I want to insert the upper case of the strings written in the forn, so I
 put
  on the php file called these lines
 
  $NOME=strtoupper($nome);
 
  mysql_query (INSERT INTO anagrafe (codice,nome, cognome, codicefiscale)
 
  VALUES
 
 ('strtoupper($codicefiscale)','$NOME','strtoupper($cognome)','strtoupper($co
  dicefiscale)', ...
 
  but if $codice if for example abc in field codice I don't get ABC but
  uppercase(abc)
  while if $nome is mario in the filed nome I get MARIO
 
  Can I avoid to write extra lines for the conversion?
  Thanks
  Antonio
 
 


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




[PHP-DB] Re: displaying duplicate records...

2002-12-04 Thread Bastian Vogt
Hi,

there's an elegant way to stop people from uploading the infos more than one
time.
And it's easy to do. You just have to figure out which fields are not allowed to
have the same values and put those fields into an unique key.
ALTER TABLE projekt ADD UNIQUE(voornaam, achternaam, email)
would just allow one entry with the same names and email.

The query you're searching may be like this:
$query=SELECT COUNT(email) as cnt, voornaam,achternaam,leeftijd,ID,email FROM
modellen GROUP BY email HAVING cnt 1;

HTH,
Bastian


Marco Alting schrieb:

 I have a database which allows people to upload info and foto's. There's a
 unique ID field, but some people tend to upload their info more than once
 (its a contest site). What I'm able to do is to see how may duplicates there
 are using the following statement:

 $query=SELECT COUNT(*) as cnt, voornaam,achternaam,leeftijd,ID,email FROM
 modellen GROUP BY email HAVING cnt 1;

 But this only gives me numbers. Does anyone know how to display every record
 that has multiple duplicate ?

 Or is there an elegant way to stop people from entering their info more than
 once?


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




[PHP-DB] Re: displaying duplicate records...

2002-12-04 Thread Bastian Vogt


Marco Alting schrieb:

 Ok I see, and how would you catch the error people get, when they send it
 again ?


Well, there will be no error-message... if you use mysql (do you?) ;-)
If you want a message you will have to select all rows from your table where the
values the user wants to insert are already inserted. If you find some - error,
if not - put them in.

Ignatius is right: I forgot to mention that there mustn't be any duplicates in
the fields you want to add to the unique key.

HTH,
Bastian



 Bastian Vogt [EMAIL PROTECTED] wrote in message
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
  Hi,
 
  there's an elegant way to stop people from uploading the infos more than
 one
  time.
  And it's easy to do. You just have to figure out which fields are not
 allowed to
  have the same values and put those fields into an unique key.
  ALTER TABLE projekt ADD UNIQUE(voornaam, achternaam, email)
  would just allow one entry with the same names and email.
 
  The query you're searching may be like this:
  $query=SELECT COUNT(email) as cnt, voornaam,achternaam,leeftijd,ID,email
 FROM
  modellen GROUP BY email HAVING cnt 1;
 
  HTH,
  Bastian
 
 
  Marco Alting schrieb:
 
   I have a database which allows people to upload info and foto's. There's
 a
   unique ID field, but some people tend to upload their info more than
 once
   (its a contest site). What I'm able to do is to see how may duplicates
 there
   are using the following statement:
  
   $query=SELECT COUNT(*) as cnt, voornaam,achternaam,leeftijd,ID,email
 FROM
   modellen GROUP BY email HAVING cnt 1;
  
   But this only gives me numbers. Does anyone know how to display every
 record
   that has multiple duplicate ?
  
   Or is there an elegant way to stop people from entering their info more
 than
   once?
 


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




[PHP-DB] mysql - enum

2002-12-02 Thread Bastian Vogt
Hi,

is it possible to get all possible values of an enum-field from a
mysql-table in php?
The values might be changed in the database. Now I've got an
select-field in my php-app where the user can select each value of the
enum-field for a new record befor saving...

Thanks for any reply,
Bastian


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




Re: [PHP-DB] Connecting to remote db securely

2002-11-25 Thread Bastian Vogt
Hi,

why don't you write a script which simply gets all the data you need out of their
database and puts it into some arrays. then include the page on your website and
then you can work with the arrays as if they were on your server

HTH,
Bastian


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




[PHP-DB] Re: help w/Multiple Joins

2002-11-21 Thread Bastian Vogt
hi,

you have to create aliases for every column you want to fetch results from.
you have to change your query like this:
SELECT i1.img_path AS i1_path, i2.img_path AS i2_path, i3.
you can leave out the AS if you want to..

hth, bastian

 $result = mysql_query(SELECT * FROM photo_album as p INNER JOIN images
 AS i1 ON p.img_1=i1.img_id
 INNER JOIN images AS i2 ON p.img_2=i2.img_id
 INNER JOIN images AS i3 ON p.img_3=i3.img_id
 INNER JOIN images AS i4 ON p.img_4=i4.img_id,$db)or
 die(mysql_error());


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




[PHP-DB] Re: right join

2002-11-21 Thread Bastian Vogt
hi,

did you try
...FROM labor RIGHT JOIN works_orders ON labor_ord_no =
works_orders_ord_no WHERE labor_qty='' ORDER BY labor_qty,$link);
?
i think that should do it

regards,
bastian

 How do I get the following select to exclude records where labor_qty from
 labor does not have a record?

 $result = mysql_query(SELECT
 labor_ord_no,works_orders_ord_no,works_orders_part_no,works_orders_qty,labor
 _qty FROM labor RIGHT JOIN works_orders ON labor_ord_no =
 works_orders_ord_no ORDER BY labor_qty,$link);


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