Re: [PHP-DB] basic form entry

2007-10-07 Thread T K
 mysql_query (INSERT INTO users (First,Last,Phone,Mobile,Email,Web) VALUES
 ('$first_name','$last','$phone,'$mobile','$email','$web') );

 echo('$username','$last')

This doesn't work. You need to make a variable for the executed query, like,

$query = mysql_query(.);

After that, you get $query. But this is not the data you want. You can
`echo` $query if you want to. What you get there is called resource
id.

So, you need to extract the data using mysql_fetch_something.

Look up mysql_fetch_array or mysql_fetch_assoc for that infomation.
You might wanna recheck mysql_query to know what you are really doing.




On 10/7/07, sm [EMAIL PROTECTED] wrote:
 I have been racking my brains trying to figure out what I am doing wrong. i
 have created a basic form that calls requests user information...the form
 then runs insert.php.  No errors are returned, however, my database does not
 update.  Any suggestions? thanks

 The field names in the table are correct (case).


 SUBMIT.HTML:

 form action=insert.php method=post
 First Name: input type=text name=firstbr
 Last Name: input type=text name=lastbr
 Phone: input type=text name=phonebr
 Mobile: input type=text name=mobilebr
 E-mail: input type=text name=emailbr
 Web: input type=text name=webbr

 input type=Submit value=click para enviar

 /form


 INSERT.PHP

 ? php
 echohello
 $username = guest;
 $psswd = password;
 $db = contacts;
 $host = localhost;

 $first_name = $_POST['first'];
 $last = $_POST['last'];
 $phone = $_POST['phone'];
 $mobile = $_POST['mobile'];
 $email = $_POST['email'];
 $web = $_POST['web'];

 mysql_connect($host,$username,$psswd) or die (errror in access db);
 mysql_select_db($db);




 mysql_query (INSERT INTO users (First,Last,Phone,Mobile,Email,Web) VALUES
 ('$first_name','$last','$phone,'$mobile','$email','$web') );

 echo('$username','$last')

 echo mysql_error(mysql_connect($host,$username,$psswd));

 ?

 --
 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] Prevention for multiple submissions from the same form

2007-10-04 Thread T K
Hi,

I have a form with a button, which adds user inputted data into
database. I've been looking for a way to prevent users from pressing
the same button twice mistakingly.

I've learned that this is possible to make and send a unique id in
hidden input, and check if the id is used before database query is
issued. (PHP Cookbook [O'reilly]).

But, is there a way to make this happen without using database? It
would cool if I could only use HTML/JavaScript/CSS.

Tek.

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



Re: [PHP-DB] Prevention for multiple submissions from the same form

2007-10-04 Thread T K
Thank you for answering my question. Can anybody explain a simple
JavaScript only solution? I haven't used JavaScript except for some
copy-and-paste jobs.

Tek

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



[PHP-DB] Preparing SQL insert statements from CSV files

2007-10-04 Thread T K
Hi,

I have to parse csv files and put them into database. I was able to
parse the files by fgetcsv() and made an HTML table. But, when it
comes to parse more closely and make INSERT INTO statement, then I'm
having problems with, probably for-loop.

For example, how do you do this task with the simple csv file shown at
https://admin.easymail.rmplc.co.uk/admin_help/csv.htm .

T

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



[PHP-DB] PHP4 and Constructor

2007-10-03 Thread T K
Hi,

I would like to use constructor in PHP4, but how do you make a constructor?
In PHP5, I do like

class ClassName {
   function __construct() {

}
}

But PHP4 doesn't have such a thing as __construct()... Reading the
official manual didn't make me understood. Does this mean the very
first `function` in class is always the constructor for the Class?

Tek

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



Re: [PHP-DB] PHP4 and Constructor

2007-10-03 Thread T K
Thanks guys!

I got the same name trick for PHP 4 class constructor.

All the best,

T

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



[PHP-DB] Re: Looking for a small open-source PHP-DB app that utilize OOP.

2007-09-29 Thread T K
Thanks all. Looks like some tutorials and the survey system look a very good
start to me.
Especially the code of UCCASS looks very readable.

Thanks a bunch.




[PHP-DB] Looking for a small open-source PHP-DB app that utilize OOP.

2007-09-27 Thread T K
Hi,
For a study purpose, I'm looking for a small open source program that works
in PHP-MySQL. In particular, I would like to see some examples with PHP 5
and Object-Oriented Programming (such as class, objects, and so on).

I'm looking for a small program, possibly like blog, wiki, forum and so on.
I've downloaded several programs, but most of them don't use
classes/objects.

I'm using PHP without OOP, but recently set out to learn OOP.

Any suggestions would be appreciated.

Tek