[PHP-DB] Code problem - need help.

2003-01-12 Thread Ron Clark
Hello all,

I have the following code:

echo td\n;
echo table width=\100%\ border=\0\ align=\center\
cellpadding=\2\\n;
$sql2 = mysql_query(SELECT signature FROM event ORDER BY cid DESC
LIMIT 10);
while ($row = mysql_fetch_array($sql2)) {
// $cid_alert = $row[cid];
$number = $row[signature];
$name = mysql_query(SELECT sig_name FROM signature WHERE sig_id =
$number);
echo trtdp$number/p/tdtdp$name/p/td/tr\n;
}
echo /table\n;
echo /td\n;

When I view on my web page, the $number value comes out fine, but the $name
comes out as Resource ID #x where x is some number. Currently is says
Resource ID #6. I know the SQL syntax is right, I have tested it. But what
is wrong here?

I have tried putting single quotes around $number in my query statement. It
dod not work though. If anyone can help, it is greatly appreciated!!!

Thanks,
R Clark



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




Re: [PHP-DB] Code problem - need help.

2003-01-12 Thread Chase Urich
 When I view on my web page, the $number value comes out fine, but the $name
 comes out as Resource ID #x where x is some number. Currently is says
 Resource ID #6. I know the SQL syntax is right, I have tested it. But what
 is wrong here?

The mysql_query command returns a result set, not the 'value' of the
query. Look up the mysql_fetch_array
[http://us2.php.net/manual/en/function.mysql-fetch-array.php] and
mysql_fetch_row commands. There are also several variants of these that
return slightly different formats.

Chase


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




[PHP-DB] - mail() with atachment

2003-01-12 Thread Nikos Gatsis
Hello list!
Does anybody knows how to send a mail through a php page using mail() function 
including an attachment file?
Thanx
Nikos



RE: [PHP-DB] - mail() with atachment

2003-01-12 Thread Rene Groothuis (Aeqis)
Take a look at http://phpmailer.sourceforge.net/ a very usefull php
class for sending e-mail including attachements.

Rene.

-Original Message-
From: Nikos Gatsis [mailto:[EMAIL PROTECTED]] 
Sent: Sunday, January 12, 2003 3:21 AM
To: PHP-mailist
Subject: [PHP-DB] - mail() with atachment


Hello list!
Does anybody knows how to send a mail through a php page using mail()
function including an attachment file? Thanx Nikos



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




Re: [PHP-DB] Re: Session on PHP with MySQL

2003-01-12 Thread Afif

Dear Bayu,

Sunday, January 12, 2003, 10:27:50 AM, you wrote:

BS it seem to me you didn't use session at all,
BS so where is the session problem?
yup now I use seesion,here my script [hope you ca help me]
?
include common.php;
include setup.php;
global $user_name, $user_pass;
banner();

function auth($user_name, $user_pass) {
$sql = select user_name from iduser where user_name='$user_name' and  ;
$sql =  $sql .   user_pass = '$user_pass'  ;

if (! $tampil = mysql_query($sql,$dbh))
   {
   echo mysql_error();
   return 0;
   }
$result  = mysql_query($sql);
if ( mysql_num_rows($result)==0)
{   echo  font face=verdana size=2User ID atau Password yang anda masukkan tidak 
benar /font; }
else
{
echo centerfont face=verdana size=2 Welcome strong$user_name/strong 
/font/centerbr;
}
}

function login_form() {
global $PHP_SELF;
?
html
head
titleLogin Page/title
meta http-equiv=Content-Type content=text/html; charset=iso-8859-1
/head

body background=./image/bg.gif
form method=post action=?echo $PHP_SELF;?
  table width=30% align=center border=0
tr
  td height=40 colspan=2div align=center
  font size=4 face=VerdanastrongLogin Requiredbr
  /strong/font/div/td/tr
tr
  td width=34%font size=2 face=VerdanaNama/font/td
  td width=66%input name=user_name type=text id=user_name/td
/tr
tr
  tdfont size=2 face=VerdanaPassword/font/td
  tdinput name=user_pass type=password id=user_pass/td
/tr
tr
  td colspan=2div align=center
  input type=submit name=Submit value=Login
  input type=reset name=Reset value=Clear
  /div/td/tr
  /table
/form
centerfont size=2 face=verdanaHave No LoginID please
a HREF=./registrasi.phpRegister/font/a/centerbr
/body
/html
?
}

session_start();
if (!isset($user_name)) {
login_form();
exit;
}
else {
session_register(user_name,user_pass);
$name = auth($user_name,$user_pass);
if (!$name) {
echo Wrong Authentication, pls relogin;
exit;
}

  else echo welcome my $user_name;
}

footer();
?


BS it's very helping if you send us the error message,
for error mesage i just tell to user whit this script

session_register(user_name,user_pass);
$name = auth($user_name,$user_pass);
if (!$name) {
echo Wrong Authentication, pls relogin;
exit;
}

BS is it from the mysql,php,or something else?

I use php+mysql, thanks for yr support


-- 
Warm regards,
Afif
mailto:[EMAIL PROTECTED]



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




Re: [PHP-DB] - mail() with atachment

2003-01-12 Thread Manuel Lemos
Hello,

On 01/12/2003 09:21 AM, Nikos Gatsis wrote:

Does anybody knows how to send a mail through a php page using mail() function including an attachment file?


Just try this class that provides exactly what you need and more and is 
very easy:

http://www.phpclasses.org/mimemessage


--

Regards,
Manuel Lemos


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



[PHP-DB] RE: mysql_errno() list?

2003-01-12 Thread James Booker
Thanks for replying Adam,

I know how to trap an error and how to show errors in the document, what i
was aiming for is to build my own system of user-friendly errors into my
database layer of my server application to make the errors nicer, and wanted
to write myself an include file with nicer versions of all the errors in.

It turnsa out the text file I talked about in my original poost actually has
what I need, but thanks anyway

Kind regards
James

-Original Message-
From: Adam Royle
To: James Booker; [EMAIL PROTECTED]
Sent: 10/01/03 22:30
Subject: Re: mysql_errno() list?

Just use a combination of mysql_errno() and mysql_error(): 

 echo mysql_errno() . :  . mysql_error(). \n; 

Adam 

PS. Documentation always rocks! 


Hi guys, 
I've been playing with PHP for a while now, and love the mysql
functions, 
but there's one thing I'd like to know... 

I want to check if a mysql error is a certain number, and thats all
fair 
enough because every time i encounter an error I can write down what
that 
error was. However, it would be handy if I could have my own define
file 
with all the errors in. Can I ask if anyone has a list of errors and
their 
numbers for mysql_errno? I've looked on the web and found a load of
errors 
for the mysql daemon (the page told me to look in 
/usr/share/mysql/mysql_errors.txt) but this isnt the file I want as the

errors there relate to the server and not errors with a query I'm
running 

Thanks in advance for any help 

James Booker 
EMPICS Sports Photo Agency 
http://www.empics.com 




[PHP-DB] php oop books

2003-01-12 Thread Michael Scappa
I know this is a bit off topic, can anyone recommend a good php / oop book? I've been 
through php.net's library and nothing really on there. Thanks

-Mike



Re: [PHP-DB] php oop books

2003-01-12 Thread Pierre-Alain Joye
On Sun, 12 Jan 2003 14:58:36 -0500
Michael Scappa [EMAIL PROTECTED] wrote:

 I know this is a bit off topic, can anyone recommend a good php / oop
 book? I've been through php.net's library and nothing really on there.
 Thanks

I do Not a good book about OOphp, but a good site:

http://www.phppatterns.com/

hth

pierre

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




RE: [PHP-DB] PHP and mySQL help!

2003-01-12 Thread John W. Holmes
It looks like the problems is because $date and $host are in different
form tags. So if one is set, then the other won't be. 

---John W. Holmes...

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/

 -Original Message-
 From: Dzung Nguyen [mailto:[EMAIL PROTECTED]]
 Sent: Friday, January 10, 2003 1:33 PM
 To: [EMAIL PROTECTED]
 Cc: [EMAIL PROTECTED]
 Subject: Re: [PHP-DB] PHP and mySQL help!
 
 Thanks for the quick reply!  Perhaps I should describe my problem more
 specifically so that u could have a better idea:
 
 The code on PHP page to create forms for users to input field names:
 
 $tempdate = $date ;
 $tempselect = $select ;
 echo font size=$fontsize-1Choose datebr/font
 form action=\build_form.php\ target=\_top\ method=get
 input type=hidden name=\select\ value=\$tempselect\
 input type=hidden name=\order\ value=\$order\
 input type=hidden name=\ordertwo\ value=\$ordertwo\
 input type=hidden name=\way\ value=\$way\
 input type=hidden name=\waytwo\ value=\$waytwo\
 input type=\text\ name=\date\ value=\$tempdate\ size=17
 maxlength=10/form ;
 echo /table ;
 
 $temphost = $host;
 echo font size=$fontsize-1Choose hostbr/font
 form action=\build_form.php\ target=\_top\ method=get
 input type=hidden name=\select\ value=\$tempselect\
 input type=hidden name=\order\ value=\$order\
 input type=hidden name=\ordertwo\ value=\$ordertwo\
 input type=hidden name=\way\ value=\$way\
 input type=hidden name=\waytwo\ value=\$waytwo\
 input type=\text\ name=\host\ value=\$temphost\ size=17
 maxlength=10/form ;
 echo /table ;
 
 I then would concat the values to query the database as follow:
 
  echo a

href=\build_form.php?select=alldate=$datehost=$hostorder=$orderorde
rt
 wo=$ordertwoway=$waywaytwo=$waytwo\
 target=\_top\
 
 My problem right now is that I can't seem to keep both values.  If one
 value is update (host for example), the other value (date) is no
longer
 set???
 Thanks again for your help.
 
 
 --
 Dzung V. Nguyen email: [EMAIL PROTECTED]
 Alpha Linux Group   http://linux.iol.unh.edu/clp
 InterOperability Laboratory
 University of New Hampshire phone: (603) - 862 - 0401
 Durham, NH 03824fax  : (603) - 862 - 4181
 
 




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




[PHP-DB] php-mysql connect

2003-01-12 Thread Jared Price
I've setup a form to submit data into my MySQL database and it appears to
connect properly and whatnot but when I check to see that the data has been
inserted properly using phpMyAdmin, the table refelcts a new row entry but
the fields are empty. ??? Anyone have this problem before?? Any help is
greatly appreciated.



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




Re: [PHP-DB] php-mysql connect

2003-01-12 Thread Jeffrey_N_Dyke

does this have anything to do with register_globals being off.  are you
using $_POST['var_name']?  or $_GET['var_name']?

can you send some code?

jeff


   
 
Jared Price  
 
defdynamo@hot   To: [EMAIL PROTECTED]  
 
mail.comcc:   
 
 Subject: [PHP-DB] php-mysql connect   
 
01/12/2003 
 
04:47 PM   
 
   
 
   
 




I've setup a form to submit data into my MySQL database and it appears to
connect properly and whatnot but when I check to see that the data has been
inserted properly using phpMyAdmin, the table refelcts a new row entry but
the fields are empty. ??? Anyone have this problem before?? Any help is
greatly appreciated.



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

2003-01-12 Thread Larry E. Ullman
I've setup a form to submit data into my MySQL database and it appears 
to
connect properly and whatnot but when I check to see that the data has 
been
inserted properly using phpMyAdmin, the table refelcts a new row entry 
but
the fields are empty. ???

I suspect this is a register_globals problem (the values from the form 
which are to be inserted into the database aren't being passed to the 
script as you'd expected). I'd echo the generated SQL to the browser to 
see what PHP thinks the query is. Then, if necessary, change which 
variables you use accordingly.

Larry


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



[PHP-DB] Insertion upon upload

2003-01-12 Thread Bruce Levick
Hi all, 
I have a simple upload form. 

/// upload.php ## 

form enctype=multipart/form-data method=post
action=process.php?tsk=?php echo $tsk; ? 
pstrongFile to Upload:/strongbr 
input type=file name=img1 size=30/p 
Pinput type=submit name=submit value=Upload File/p 
/form 

//# 

Which loads up a process page. 

//## process.php ### 


?php 
if (is_uploaded_file($_FILES['img1']['tmp_name'])) 
{ 
$filename = $_FILES['img1']['tmp_name']; 
print $filename was uploaded successfuly; 
$realname = $_FILES['img1']['name']; 
$fnme = $realname; 
copy($_FILES['img1']['tmp_name'], /Inetpub/wwwroot/_tasks/images/ .
$realname); 
$flctn = /Inetpub/wwwroot/_tasks/images/; 
$fid = $tsk; 
} 
else 
{ 
echo Possible file upload attack: filename . 
$_FILES['img1']['name'] . .; 
} 

? 

// 

The upload works great. But I need to pass the three variables created
in the above code to a table files in the database. 

$fnme 
$fid 
$flctn 

Any ideas on how to incorporate an insertion method into the code
above?? 

Cheers

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




[PHP-DB] Re: Array printing

2003-01-12 Thread V.Y.JR
Much simpler:

foreach ($arrText as $text)
{
  print $text;
}

Use that code. Just add in your HTML tags and it will be much cleaner and
faster.

Michael Conway [EMAIL PROTECTED] wrote in message
news:!~!UENERkVCMDkAAQACABgAeI4MkiQKXEijmrrs5/EPIcKA
[EMAIL PROTECTED]
 I am using an array to return the contents of a file. The file root is
 located on the db and the file content is correctly rendered using the
 following code:



 echo \n\ttd ALIGN=LEFT bgcolor = \silver\ .

 $arrText= file($row[description]);

 for ($i=0; $icount($arrText); $i++)

 {

echo(P ALIGN=LEFTPREb$arrText[$i]/b/PRE/P);

 }



 Everything works fine except that the paragraph is led off by the pesky
 Array tag, such as:



 Array

 File contents here..



 Is there a way to suppress or hide the Array tag?  I realize that there
 probably is an excruciatingly simple solution, but I have not found it
 yet.



 Thanks.



 Michael Conway

 [EMAIL PROTECTED]

 (703) 968-8875







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




[PHP-DB] inserting spaces in the select combo box

2003-01-12 Thread Rajesh Fowkar
Hi,

I am trying to align the three values in the select combo box but it is
not working. The code is below :

for($nRow=0; $nRow  $nNumRows; $nRow++)
{
$aAns = pg_fetch_array($lResult, $nRow, PGSQL_ASSOC);

$JoinedValue = $aAns[location_code] . $aAns[section_code] .
   $aAns[part_number] .
   $aAns[uom] . $aAns[item_short_description];
echo option value='$JoinedValue' .
str_pad(trim($aAns[item_short_description]),25,'-') .
| . $aAns[location_code]. / . $aAns[section_code] . / .
$aAns[part_number] .
 /option;
};

The size of item_short_description is 25. But when it is retrieved from
the database it is of the actual size of the description. Due to this
everything in the select box looks zigzag. str_pad though puts spaces
those are not considered spaces in html. I think I will have to put
something like nbsp;. 

Can anybody help me in the above problem.

Thanks in advance.

Peace 

--
Rajesh
:
[ GNU/Linux One Stanza Tip (LOST) ]###

Sub : bash keystrokes (#4)   LOST #337

C-l : clear screen  [C = Ctrl key]
C-_ : undo last action
C-r : reverse search in history with completion as you type 
  (even searches through different arguments)

[EMAIL PROTECTED]##
:

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




Re: [PHP-DB] Insertion upon upload

2003-01-12 Thread Jason Wong
On Monday 13 January 2003 06:23, Bruce Levick wrote:

[snip]

 The upload works great. But I need to pass the three variables created
 in the above code to a table files in the database.

 $fnme
 $fid
 $flctn

 Any ideas on how to incorporate an insertion method into the code
 above??

If you're new to databases then check out some php/database tutorials (there 
are _plenty_ out there).

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *


/*
Our business is run on trust.  We trust you will pay in advance.
*/


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