[PHP-DB] Thanks alot Griffiths!=)

2003-12-12 Thread irinchiang


Thanks alot for your help! That was very careless of me..;p I was stil quite a 
newbie to php-db coding...

By the way one last favour to ask of u hope u dun mind...

I have a script which was used to INSERT data into the database:
(See script below):

But everytime when I execute it I got the error DB constraint

I think the problem lies here:

$sql = INSERT INTO tutor (tutor_name, tutor_contact, tutor_email, 
tutor_profile)
VALUES ($tutor_name,$tutor_contact,$tutor_email,$tutor_profile);

Whenever I single quote the string value:
 VALUES ($tutor_name','$tutor_contact','$tutor_email','$tutor_profile');
it actually insert a NULL value into the DB though I did enter values into the 
text field.But if I dun quote it, I got the error:
DB constraint. By right I ought to quote it right??
I have gone thru my code umpteen times but to no avail. 
Where have i gone wrong??? ;(

---

$dsn = mysql://root:[EMAIL PROTECTED]/table1;

$db = DB::connect ($dsn);
   if (DB::isError ($db))
   die ($db-getMessage());

//create variables ready to go into DB

$tutor_name = $db-quote($_POST[tutor_name]);
$tutor_contact = $db-quote($_POST[tutor_contact]);
$tutor_email = $db-quote($_POST[tutor_email]);
$tutor_profile = $db-quote($_POST[tutor_profile]);

$sql = INSERT INTO tutor (tutor_name, tutor_contact, tutor_email, 
tutor_profile)
VALUES ($tutor_name,$tutor_contact,$tutor_email,$tutor_profile);

$result = $db-query($sql);
  if( DB::isError($result) ) {
die ($result-getMessage());
}
?HTML
head
titleAdd Tutor/title

!-- **CSS and HTML** --

/head
body
div align=center
div id=pagecontent5
?php if( $_POST[submit] != Save )
{
?

div align=center
form name=classinfo action=?php echo $_SERVER[PHP_SELF]; ?  
method=post
input type=hidden name=form_submitted value=1

table name=add_tutor  border=0px cellpadding=0 cellspacing=2 
width=900tr
 td class=lighter width=200Name:/td
 td class=lighter width=500Input type=text size=50 
name=tutor_name/td
   /tr
tr
td class=darker width=150Contact No:/td
td class=darker width=150Input type=text size=30 
name=tutor_contact/td
   /tr
tr
td class=lighter width=150Email:/td
 td class=lighter width=150Input type=text size=50 
name=tutor_email/td
   /tr

tr
td class=darker width=150Profile:/td
 td class=darker width=150TEXTAREA class=textarea 
NAME=tutor_profile ROWS=6 COLS=70
/TEXTAREA
/td
/tr
tr
td class=lighter width=150/td
 td class=lighter width=150a href=teacher_summary.php
div align=centerinput type=submit name=submit  
value=Save/div/a/td
   /tr
/table
/form
br


?php } else {?
table border=0
tr
td class=darker width=300Teacher:/td
td class=darker width=600
?
echo $_POST[tutor_name];
?
/td
/tr
trtd class=lighter width=300Contact No:/td
td class=lighter width=600
?
echo $_POST[tutor_contact];
?
/td
/tr
tr
td class=darker width=300E-mail Address:/td
td class=darker width=600
?
echo $_POST[tutor_email];
?
/td
/tr
tr
td class=lighter width=300Profile:/td
td class=lighter width=600
?
echo $_POST[tutor_profile];
?
/td
/tr
/body
/html
/div
/div
?}?

---
(I'm terribly sorry if the code is kinda messy)

All help are greatly appreciated!

Irin.

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



[PHP-DB] Thanks

2003-08-28 Thread Diana Cassady
Hi. Thanks for all your help with the referer and the and, or ||  
subject.

I realize that neither of my questions were database related. I've 
looked again at the email lists offered on the PHP site and see now 
that there is a general user list. I had somehow missed that before and 
felt I had to choose only from Internationalization and the other 
options that also did not apply to me.

I appreciate your help in assisting with these two simple questions. I 
do try to find the answers in the manual before asking on the list. I 
haven't read it cover to cover for a couple years, now (I don't often 
program in PHP - I usually use Lasso), but did review the section on 
control structures before asking about the II and , and read the 
section on variables and constants before asking about the referer. I 
had searched for referer online, but was spelling it referrer, 
instead, which I thought was the proper spelling. Even when I do spell 
it referer, I don't come up with what you have provided, but instead 
session.referer_check which doesn't seem to be the same thing.

Your assistance has been very helpful and I really appreciate it. I 
could never have found what I needed in the manual. I'm sorry to have 
gotten off the subject of databases and will ask future general 
questions where they belong - on the general questions list.

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


[PHP-DB] Thanks peeps ;)

2002-12-10 Thread Hartleigh Burton
John hit the nail right on the head, i was editing the windows\php.ini,
after all thats what the manual said PHP uses. When in actual fact it was
the copy of php.ini I had in my PHP root directory.

Anyways, cheers for the help :)



Hartleigh Burton
www.channel-x.org



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




[PHP-DB] thanks

2002-12-08 Thread Dallas
i've been looking for a good php site

thanks



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




[PHP-DB] Thanks

2002-11-11 Thread milisphp
Thanks for all the help, and sorry, I didn't pay attention that this is
a DB mailing list.
 
Thanks again. It's a huge help!



[PHP-DB] thanks

2002-05-21 Thread cin

i want to express my gratitude towards those who have offered advice into
solving the posts regarding 'adding difficulties with MySQL databases'.
after modifying my php.ini to have globals registered = on, everything is
working now!


thanks.


cin




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




[PHP-DB] thanks

2002-03-31 Thread Matthew Crouch

i think i got this solved; sorry about the non-php question but there
isn't a mysql newsgroup that i know of.

Matthew Crouch wrote:

 Here's an easy one that I can't find laid out for me anywhere:
 I want a self join that pairs up the id numbers of a table in every
 permutation

 e.g. i have id #s 1, 2, and 3
 i need this result:
 1 2
 1 3
 2 1
 2 3
 3 2
 3 1

 clear enough?


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




Re: [PHP-DB] thanks

2002-03-31 Thread Jason Wong

On Sunday 31 March 2002 23:05, Matthew Crouch wrote:
 i think i got this solved; sorry about the non-php question but there
 isn't a mysql newsgroup that i know of.

www.mysql.com ??


-- 
Jason Wong - Gremlins Associates - www.gremlins.com.hk

/*
I don't want people to love me.  It makes for obligations.
-- Jean Anouilh
*/

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