Re: [PHP-DB] DB-stored images

2002-11-26 Thread Joakim Andersson
Ohlson Stefan wrote:

Hi!

I have a db where we stores images in the database but I haven't figured out how I display
that image after I've selected it from the table.

I've tried with IMG SRC='$data' and IMG SRC=$data but $data just return the Select-query:
htmlheadtitle/title/head
body bgcolor=cc text=00 link=ff vlink=ff
BPicture/BBRUL
IMG SRC='SELECT PICTURE FROM KATALOGUE WHERE ISBN = '91-29-65480-7''
/UL/body/html


I'm not familiar with fetching data from Oracle, but the output you get 
doesn't really look like image data.


Anyone have an idea what I can do?
Thanks!


First of all you should verify that you infact have stored image data in 
your table and it really is that data your fetching.

Then to display the image you need to separate the image output from the 
rest of your script. Something like this:
getimg.php (Just cut'n'pasted'n'edited from your script)
?php
$handle = ORA_LOGON(something/something,) OR DIE(Unable to connect 
to database);
$SqlStatement = SELECT PICTURE FROM KATALOGUE WHERE ISBN = '$isbn';

$csr = ORA_OPEN($handle) OR DIE(Unable to open data database cursor);
ORA_PARSE($csr, $SqlStatement)OR DIE(Unable to parse query);
ORA_EXEC($csr) OR DIE(Unable to run query);

ORA_FETCH($csr)
$data = ORA_GETCOLUMN($csr,0);
header('Content-Type: image/jpeg');
echo $data;
?

Then in your_script.php do something like this:
?php
echo IMG SRC=\getimg.php?isbn=$isbn\;
?

You will probably have to modify it to fit your needs...

Regards
Joakim


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



RE: [PHP-DB] How to Check Directory exist in Specific Folder

2002-11-19 Thread Joakim Andersson
 Dear all
 
 Does php have any script which can check if a directory exist 
 in specific
 folder?
 
 Thx a lot
 
 Jack

if (is_dir (/path/to/your/folder) )
echo Dir exists;
else
echo Dir doesn't exist;

Regards
Joakim
-
This message contains information that may be privileged or confidential and
is the property of Cyber Com and may be exempt from disclosure under
applicable law. It is intended only for the person to whom it is addressed.
If you are not the intended recipient, you are not authorized to read,
print, retain, copy, disseminate, distribute, or use this message or any
part thereof. If you receive this message in error, please notify the sender
immediately and delete all copies of this message.
This agreement shall be governed by the law where the sender has its place
of business. 
Any attachment(s) to this e-mail has been checked for viruses, but please
rely on your own virus-checker and procedures.
-

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




RE: [PHP-DB] MySql security

2002-11-19 Thread Joakim Andersson
 Hi,
 
 Since i dont know any mysql group, i will try here - it is 
 anyway related to
 php.
 When i want to make php/mysql application i have mysql on the 
 server and i
 connect to it with mysql_pconnect(localhost,root,) and it works.
 I assume that any user or hacker could connect to mysql 
 database like this.
 So, i want to create my database and i want to limit access 
 to this database
 for some usernames and passwords. I know MSSQL or Interbase 
 can do it - but
 how i do this in mysql.
 If this is offtopic can someone point me to any mysql newsgroup.

I would say this is very offtopic, but this query should do the trick:
GRANT select, update, insert ON your_db_name.* TO
your_username@localhost IDENTIFIED BY 'your_password'
Take a look in the MySQL manual for more details on GRANT.

To set a password for root you can use the mysqladmin command:
mysqladmin -u root password your_new_pwd
Note that the word password here really is the word password!
Or you could run this query on the mysql db.
SET PASSWORD FOR root@localhost=PASSWORD('your_new_pwd');

 Other question is: if i need to make application which uses 
 credit cards,
 how can i increase security for it. I have heard about https 
 protocol, but
 dont know much about it. Any link would be appreciated.

You have to look in your webserver's manual for this.

Regards
Joakim
-
This message contains information that may be privileged or confidential and
is the property of Cyber Com and may be exempt from disclosure under
applicable law. It is intended only for the person to whom it is addressed.
If you are not the intended recipient, you are not authorized to read,
print, retain, copy, disseminate, distribute, or use this message or any
part thereof. If you receive this message in error, please notify the sender
immediately and delete all copies of this message.
This agreement shall be governed by the law where the sender has its place
of business. 
Any attachment(s) to this e-mail has been checked for viruses, but please
rely on your own virus-checker and procedures.
-

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




SV: [PHP-DB] Find out a pic size?

2002-11-11 Thread joakim . andersson
 -Ursprungligt meddelande-
 Från: Snijders, Mark [mailto:Mark.Snijders;atosorigin.com]
 Skickat: måndag den 11 november 2002 09:03
 Till: '[EMAIL PROTECTED]'; [EMAIL PROTECTED]
 Ämne: RE: [PHP-DB] Find out a pic size?
 
 
 check this out:
 
 http://www.php.net/manual/en/ref.image.php
 
 
 you need de GD limbrary you can check with phpinfo() if 
 you already got
 it
 
 
 good luck

getimagesize(), which is the function he needs, does actually work without
GD.

Joakim

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




SV: [PHP-DB] Find out a pic size?

2002-11-10 Thread joakim . andersson
 Hi, 
  
 I'm working with a lot of picture in a website and the size is not
 always the same.
  
 I need some help on how to find out the size (width and height) of a
 picture. Is there any way to do this (especially with PHP)? 
  
 I need it so I can calculate the width and height to be 
 specified on the
 HTML img tag.
  
 Thanks,
  
 Hansen
 IndoInformatika

Did you try the manual at all?
GetImageSize() is what you're looking for.

Regards
Joakim

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




RE: [PHP-DB] Quarter question..

2002-11-04 Thread joakim . andersson
 $sql = select quarter($qdate) or die(not work #3);
change to
$sql = select quarter($qdate) as my_quarter; //Added an alias to
quarter($qdate). Easier to access that way...
And there's no need for an 'or die()' here. You're just assigning a variable
and most likely this will allways work!


 $yyy = mysql_query ($sql) or die(not work #4);
change to
$yyy = mysql_query ($sql) or die(not work #4:  . mysql_error());
//Standard MySQL trouble-shooting...


 printf(tda href=\%s?id=%sdelete=yes\Delete/a/td, 
 $PHP_SELF, 
 $myrow[id]);
 printf(tda 
 href=\%s?id=%ssubmit=yes\Update/tdtd%s/tdtd  
 %s/tdtd  %s/td/a/tr, 
   update-inv.php, $myrow[id], $myrow[name], 
 $myrow[details], $yyy);
and here you actually echo out the resource id instead of it's value...
change $yyy to $yyy[my_quarter]

HTH
Joakim

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




RE: [PHP-DB] Quarter question..

2002-11-04 Thread joakim . andersson
  printf(tda href=\%s?id=%sdelete=yes\Delete/a/td, 
  $PHP_SELF, 
  $myrow[id]);
  printf(tda 
  href=\%s?id=%ssubmit=yes\Update/tdtd%s/tdtd  
  %s/tdtd  %s/td/a/tr, 
  update-inv.php, $myrow[id], $myrow[name], 
  $myrow[details], $yyy);

My bad.
Before this printf statement you need
$my_var = mysql_fetch_array($yyy);

and then in the printf statement change $yyy to $my_var[my_quarter]

That should work...

Regards
Joakim

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




RE: [PHP-DB] Quarter question..

2002-11-04 Thread joakim . andersson
 On Monday 04 November 2002 19:58, [EMAIL PROTECTED] wrote:
   $sql = select quarter($qdate) or die(not work #3);
 
  change to
  $sql = select quarter($qdate) as my_quarter; //Added an alias to
  quarter($qdate). Easier to access that way...
  And there's no need for an 'or die()' here. You're just assigning a
  variable and most likely this will allways work!
 
 On the contrary. If you've made a mistake in your query you 
 wouldn't know 
 what's happening. So having the below is a very good idea.
 
  $yyy = mysql_query ($sql) or die(not work #4:  . mysql_error());
  //Standard MySQL trouble-shooting...

Hi Jason,

I might have been unclear in my reply.
The original code had an 'or die()' on $sql = select... aswell and that
is, in my opinion, rather unnecessary.
Using 'or die(mysql_error())' on mysql_query should be mandatory. At least
during development.

Regards
Joakim

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




RE: [PHP-DB] group by day (unix timestamp provided)

2002-10-25 Thread joakim . andersson
 How can I get mySQL to group stuff by the day? my date 
 coloumn is a UNIX
 timestamp.

SELECT whatever FROM my_table GROUP BY FROM_UNIXTIME(timestamp_col,
'%Y-%m-%d')

Regards
Joakim

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




RE: [PHP-DB] From address in mail() header not working - ideas?

2002-10-25 Thread joakim . andersson
 Hi Guys,
 
 I did try that but I will try it again.
 
 Also, I have echo'd the data and it does appear as I expect.
 
 Any other thoughts while I try this?

Don't know if this has anything to do with your problem, but
 $headers = Return-Path: $support_email\r\n;
should be
 $headers .= Return-Path: $support_email\r\n;

I'm also courious if this is correct:
 $headers .= Content-disposition: attachment;
filename=\$attach_name\\n\r\n;
Look at the end and you see \n\r\n. Shouldn't it be just \r\n?

And as others already have suggested, move the From-part up a bit...

Also you should try to echo $headers and see if it is what you expect.

Regards
Joakim

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




RE: [PHP-DB] Broken Links 2

2002-10-24 Thread joakim . andersson
Hi,

I think you need to remove echo $src_img; from your non working code as this
is not what you want to do. 
And do you have support for GIF compiled in?

Regards
Joakim

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




RE: [PHP-DB] Variable won't be passed from HTTP address bar

2002-10-24 Thread joakim . andersson
 Try instead:
 
 if( $_POST['action'] ==test ){ echo Test;}
 
 HTH
 Ignatius

This should really be

if( $_GET['action'] ==test ){ echo Test;}

since it's a get-request we're dealing with...

Regards
Joakim

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




RE: [PHP-DB] It counts everything not a specific day..

2002-10-24 Thread joakim . andersson
 OK,
 
 Looks like there are two options
 
 I can either convert the unix timestamp colomn to a mysql 
 time one *OR*
 someone can tell me how to use unix timestamps in this query...
 

Try something like this:

SELECT
CONCAT(extract(year FROM FROM_UNIXTIME(time)),
extract(month FROM FROM_UNIXTIME(time)))

MAX(COUNT(*)) as max_monthly_views,
  time
FROM
tececo_stats
group by
   CONCAT(extract(year FROM FROM_UNIXTIME(time)),
   extract(month FROM FROM_UNIXTIME(time)))

Regards
Joakim

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




RE: [PHP-DB] DB Print Columns and Rows

2002-10-24 Thread joakim . andersson
 
Hello PHP people. I was wondering if I could get a 
 question answered?
 
How would I print a Database Table into a table when 
 the DB Table 
 has 4 columns, AND 4 rows.
 
See I only know how to print one column.

?php
// Your dB-stuff here...
$separator = ;
echo tabletr;
while($row = mysql_fetch_array($result));
{
echo $separator;
echo td . $row[0] . /td;
echo td . $row[1] . /td;
echo td . $row[2] . /td;
echo td . $row[3] . /td;
$separator = /trtr;
}
echo /tr/table;
?

Regards
Joakim

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




RE: [PHP-DB] Help MySQL server has gone away

2002-10-01 Thread joakim . andersson

I do not think php is the problem here.
Take a look here
http://www.mysql.com/documentation/mysql/bychapter/manual_Problems.html#Gone
_away
There are some good pointers on what to do...

Regards
Joakim

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




RE: [PHP-DB] INSERTing INTO Multiple Tables with MySQL PHP

2002-09-10 Thread joakim . andersson

Something like this, perhaps?
?
// your INSERT to first table here.

$insert_id = mysql_insert_id();

$sql = SELECT MAX(SecondID) FROM LookupTable WHERE FirstID = $insert_id;
$result = mysql_query($sql);
$row = mysql_fetch_array($result);
$max_second_id = $row[0];

$sql = INSERT INTO LookupTable VALUES ($insert_id, $max_second_id + 1);
$result = mysql_query($sql);
?

Might be some errors in it, but you get the idea.

Regards
Joakim Andersson


 -Original Message-
 From: Graeme McLaren [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, September 03, 2002 5:42 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] INSERTing INTO Multiple Tables with MySQL  PHP
 
 
 Hi there, I've been hunting thru the net trying to find some info on
 inserting data to multiple tables.
 
 I have two tables (LookupTable and MainTable):
 
 LookupTable(
 FirstID
 SecondID
 )
 
 MainTable(
 ID
 Name
 Address
 etc
 etc
 )
 
 Once I insert data into the MainTable I want to also insert 
 the ID from the
 MainTable to the LookupTable as the FirstID. Then I want to 
 check for the
 highest ID number in the SecondID field that is associated 
 with the First ID
 then add one to the highest value and insert that to the SecondID.
 FirstID SecondID
 1 1
 1 2
 1 3
 1 4
 
 In the above table I would want to insert 1 to the FirstID 
 then find the
 highest number in the SecondID associated with the FirstID 
 1 then add one
 to it so that my next row in the table would be:
 
 FirstID SecondID
 1 5
 
 How would I go about doing this? I've been looking thru Kevin 
 Yank's book
 Build Your Own Database Driven Website Using PHP  MySQL, 
 its pretty good
 on the whole but updating two tables simultaneously seems to 
 be lacking
 detail.
 
 I hope I've made this clear enough, I may have repeated 
 myself there but I
 was wanted to make sure that what I've written is cleary understood.
 
 Thank you in advance for any help - I'm lost!
 
 Graeme :)
 
 
 Public Sub House()
 
 On Error Resume drink
 
  If Pint.empty = True Then
  Pint.refill
Else
  Pint.drink
  End if
 
 stomach.add Pint
 
 MsgBox  I've had    stomach.count   Pints
 MsgBox VERY DRUNK
 
 End Sub
 
 
 
 -- 
 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] next prev links for search result

2002-08-27 Thread joakim . andersson

 -Original Message-
 From: Smita Manohar [mailto:[EMAIL PROTECTED]]
 Sent: Monday, August 26, 2002 8:26 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] next prev links for search result
 
 
 hiii..
 
 i want page no. and next prev links while displaying search 
 result. the 
 script which im using presently, needs to run the search 
 query 2 times for 
 each search operation.
 
 first time it finds all the records matching the query string,
 

Change this query:
 ie, select * from table where field like '%$search_string %'
 
To
SELECT COUNT(*) AS num_hits FROM table WHERE field LIKE '%$search_string%'
and let your MySQL-server do the counting. No need to transfer all data to
PHP just to count the rows.

You still have to run two queries, but I don't think you need to worry too
much about performance issues, unless you have a really, really huge table.

Regards
Joakim Andersson

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




RE: [PHP-DB] Problem with retrieving Data with MySQL

2002-07-19 Thread joakim . andersson

 From: Blaine D. Dinsmore [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, July 18, 2002 8:18 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] Problem with retrieving Data with MySQL
 
 
 Can somone tell me what is wrong with my code here?
 My e-mail does not mail me the results from the the latest 
 database entry:

I assume you actually have made a function named mysqlconn() and that it
returns a result-set.
It looks like you run the query but you don't assign the result to
anything...

Change this:
 mysqlconn($dbase,$sql);
To this:
 $result = mysqlconn($dbase,$sql);

If this doesn't help we need to know if you have made this function and if
so we probably need to see the function aswell. 

Regards
Joakim Andersson

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




RE: [PHP-DB] Select a subset?

2002-07-17 Thread joakim . andersson

 From: Clive Bruton [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, July 16, 2002 10:24 PM

 Joakim, thanks, that sorted it. Just one note, numrows in 
 the sql query 
 should be num_rows? That's how I got it to work anyway.

Yes, that's totally correct. Just a typo.

Joakim

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




RE: [PHP-DB] Select a subset?

2002-07-16 Thread joakim . andersson

 From: Clive Bruton [mailto:[EMAIL PROTECTED]]
 Sent: Monday, July 15, 2002 5:01 PM
 
 How do I get both the number of rows found (5,000) and get a 
 subset of 
 the records (ie 0-9, 10-19, 20-29...) so that a user can 
 browse through 
 the records rather than getting 5,000 at a time (but still 
 know that a 
 total of 5,000 were found).

I think you need to do two querys. At least that's how I do it...
First SELECT COUNT(*) FROM table
and then SELECT whatever FROM table LIMIT 0,10

list.php:
?php
  $rows_to_list = 10; // Number of rows per page
  if(isset($_GET['offset'])) // Find out which row to start with
  $offset = $_GET['offset'];
  else
  $offset = 0;

  $result = mysql_query(SELECT COUNT(*) as numrows FROM
table,$db);
  $row = mysql_fetch_array($result);
  $num_rows = $row['num_rows'];

  echo Displaying rows  . $offset + 1 .  to $rows_to_list (total
$num_rows rows)\n;

  $result = mysql_query(SELECT * FROM table LIMIT $offset,
$rows_to_list,$db);

  echo table border=1;
  echo trtdName/tdtdPosition/tr\n;

  while ($myrow = mysql_fetch_row($result)) {

   printf(trtd%s %s/tdtd%s/tr\n, $myrow[1], 
$myrow[2], $myrow[3]);
   }

  echo /table\n;
?
a href=list.php?offset=?php echo $offset - $rows_to_list; ?Previous
?php echo $rows_to_list ?/abr
a href=list.php?offset=?php echo $offset + $rows_to_list; ?Next ?php
echo $rows_to_list ?/a

This oughta do it...
Regards
Joakim Andersson

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




RE: [PHP-DB] escaping line brakes

2002-07-16 Thread joakim . andersson

 From: Andy [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, July 16, 2002 2:45 PM

 Hi there,
 
 I am putting text into a mysql db from a form field. I do include the
 linebrakes with line2br.
 
 Now I would like to create an interface where I could load 
 the text into the
 form again to edit it. Unfortunatelly it includes some wired 
 chars like \br
 into the text. How can I get rid of that?

When did you use nl2br() (which I assume you mean)? Before you store the the
data in the database or when you retrive it?

If before then use echo str_replace(br /, \n, $your_string)
If when you retrieve the data for output to the form, then just don't use
nl2br().

Regards
Joakim Andersson

 
 Thanx for any help,
 
 Andy

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




RE: [PHP-DB] Date comparison problem

2002-07-11 Thread joakim . andersson

Hi,

Assuming your dates have the format you specified and that you only want to
compare dates, not time aswell.

$str_sql = SELECT something FROM mytable WHERE LEFT(my_datetime, 10) = ' .
str_replace(/,  , $form_date) . ';
or if day / month is reversed in MSSQL
$str_sql = SELECT something FROM mytable WHERE LEFT(my_datetime, 10) = ' .
substr($form_date, 3, 2) .   . substr($form_date, 0, 2) .   .
substr($form_date, 6, 4) . ';

Regards
Joakim Andersson


 -Original Message-
 From: Gabor Niederlaender [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, July 11, 2002 8:36 AM
 To: [EMAIL PROTECTED]
 Cc: [EMAIL PROTECTED]
 Subject: RE: [PHP-DB] Date comparison problem
 
 
 But I would like to do it the other way round. I mean for the solution
 you have mentioned, I have to make the query on the whole record, then
 compare the two dates and filter the right ones. I'd like to make the
 query look like:
 
 SELECT something FROM table WHERE datetime  $form_date
 
 So I think I have to adjust the form of my $form_date.
 
 Or am I making a mistake somewhere?
 
 Thanx
 Gabor
 
 ---
  This is how I do it:
  
  date(m/d/Y,strtotime(odbc_result($rs,ts)))
  
  where $rs is the result set and ts is the name of the field
 containing the datetime.
  
   Ryan
  
  -Original Message-
  From: Gabor Niederlaender [mailto:[EMAIL PROTECTED]]
  Sent: Wednesday, July 10, 2002 8:21 AM
  To: [EMAIL PROTECTED]
  Subject: [PHP-DB] Date comparison problem
  
  
  Hi all!
  
  I have got a datetime field in a MS-SQL DB, and I have a date
  field in my html-form with the format: DD/MM/.
  
  I would like to compare the two, but I think the two formats are a
 bit
  different and they do not really want to be compared:)
  
  If I write a query to write out the datetime field from the DB, I
  get the form :
  
  02 05 2002 12:25 
  
  In the HTML-form it looks a bit different: 12/10/2000
  
  I do not really want to explode the form-data and than build a new
  timestamp, it has to be a more simple way.
  
  Thanks, best regards
  
  Gabor
  
  -- 
  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 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: Getting Percentage of coloumn value

2002-07-10 Thread joakim . andersson

?php
include includes/required.php;
do_html_header('Name Here');
$query = select count(id) as num_rows from tececo_stats;
$result = mysql_query($query) or die(Query failed: $querybr .
mysql_error());
$row = mysql_fetch_array($result);

$query = select referer,(count(referer) / {$row['num_rows']} * 100) as
total_in_percentage from tececo_stats group
by referer;
$result = mysql_query($query) or die(Query failed: $querybr .
mysql_error());
?

table width=500

?php
while($row = mysql_fetch_array($result))
{
echo
trtd{$row['referer']}/tdtd{$row['total_in_percentage']}/td/tr;
}
?

/table

?php
do_html_footer();
?

Regards
Joakim Andersson

 -Original Message-
 From: JJ Harrison [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, July 10, 2002 8:30 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] Re: Getting Percentage of coloumn value
 
 
 Here is my script:
 
 ?
 include includes/required.php;
 do_html_header('Name Here');
 
 $query = select @total_items=count(id) from tececo_stats;
 $query1= select referer,count(referer)/@total_items from 
 tececo_stats group
 by referer;
 $result = mysql_query($query) or die(Query failed: $querybr .
 mysql_error());
 $result1 = mysql_query($query1) or die(Query failed: $query1br .
 mysql_error());
 $num_results = mysql_num_rows($result);
 ?
 table width=500
 ?
 for ($i=0; $i  $num_results; $i++)
   {
  $row = mysql_fetch_array($result1);
  echo
 'trtd'.$row['referer'].'/tdtd'.$row['count(referer)'].
 '/td/tr';
  }
  ?
  /table
  ?
 
 
 do_html_footer();
 ?
 
 How can I echo count(referer) ?
 
 I currently get this error
 
 Warning: Undefined index: count(referer) in
 C:\Inetpub\TecEco_PHP\stats_interface\referer_base.php on line 16
 
 
 --
 JJ Harrison
 [EMAIL PROTECTED]
 www.tececo.com
 
 Jj Harrison [EMAIL PROTECTED] wrote in message
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
  Could some one give me an idea as to what I SQL query could 
 use to get the
  percentages of each differant colomn value.
 
  ie if this was my table:
  +---+---+
  | name   | id |
  +---+---+
  | foobar  | 1 |
  | foobar  | 2 |
  | foobar  | 3 |
  | barfoo  | 4 |
  +---+---+
 
  I would get this result(Then later do stuff with it in PHP):
 
  +---++
  | name  | percent |
  +---++
  | foobar | 75|
  | barfoo | 25|
  +---++
 
  Thanks in advance,
 
 
  --
  JJ Harrison
  [EMAIL PROTECTED]
  www.tececo.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 problem passing variables

2002-07-10 Thread joakim . andersson

This doesn't look like a database question to me...

Anyway, try $_POST['variable_name'] if the variable comes from a form with
the POST-method
$_GET['variable_name'] - Form using GET-method or passing variables in the
URI (mypage.php?variable_name=42)

Regards
Joakim Andersson


 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, July 10, 2002 9:32 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] php problem passing variables
 
 
 hi, 
 
 i've tryed to install php 4.2.1 with apache 1.3.24
 php works, but i can't pass any variables. 
 
 is it in php.ini that i have to change something ?
 or is the installation of php not correct ??.. 
 
 thanks in advance, 
 
 Richard Pijnenburg
 The netherlands
 
 -- 
 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] MSSQL_connect() won't work

2002-07-09 Thread joakim . andersson

Does the user 'gn' exist?
Are you using the correct password?
Does that user have permissions on the database?

Hint: Login failed for user 'gn' suggests that there is something wrong
with that account...

Regards
Joakim Andersson

 -Original Message-
 From: Gabor Niederlaender [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, July 09, 2002 12:26 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] MSSQL_connect() won't work
 
 
 Hello all!
 
 I am desperately trying to connect to a Win2000 SQL-Server, but I
 always get the error message:
 
 
 Warning: MS SQL message: Login failed for user 'gn'. (severity 14) in
 c:\inetpub\wwwroot\test.php on line 11
 
 Warning: MS SQL: Unable to connect to server: SERVER1 in
 c:\inetpub\wwwroot\test.php on line 11
 DATABASE FAILED TO RESPOND.
 
 
 Please help me, because I really don`t know what to do!
 
 Best regards,
 Gabor
 
 -- 
 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