Re: [PHP] still learning php
$sql = " select firstname, lastname, address etc from TABLE"; execute sql statement; while fetching records { $firstname = stripslashes( $firstname); $lastname = stripslashes ( $lastname); // "O\' Reily" now becomes "O' Reily" } that's all - Original Message - From: "Caleb Carvalho" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Monday, October 01, 2001 4:32 PM Subject: Re: [PHP] still learning php > thank you s much that was much much better indeed :), > > i am assuming that i need to use the same for sql_quey sql_display > is that correct? > > > Caleb Carvalho > Application Engineer > LoadRunner/APM > -- --- > Enterprise Testing and Performance Management Solutions > -- --- > Mercury Interactive > 410 Frimley Business Park > Frimley, Surrey. GU16 7ST > United Kingdom > Telephone : +44 (0)1276 808300 > > > > >From: "Dimitris Kossikidis" <[EMAIL PROTECTED]> > >To: "Caleb Carvalho" <[EMAIL PROTECTED]> > >CC: <[EMAIL PROTECTED]> > >Subject: Re: [PHP] still learning php > >Date: Mon, 1 Oct 2001 15:52:23 +0300 > > > >Use addslashes() to escape single quotes or double quotes. It 's in the > >manual > > > >// giving some values > >$firstname ="Bob"; > >$lastname = "O' Reily"; // This could cause an error if not use addslashes > >$address = "Somewhere"; > >$age= 19; > > > >// adding slashes to quotes > >$firstname = addslashes($firstname); > >$lastname = addslashes($lastname); > >$address = addslashes($address); > > > >$sql = " insert into TABLE values ( '$firstname', '$lastname', '$address', > >$age) "; > > > >- Original Message - > >From: "Caleb Carvalho" <[EMAIL PROTECTED]> > >To: <[EMAIL PROTECTED]> > >Cc: <[EMAIL PROTECTED]> > >Sent: Monday, October 01, 2001 3:36 PM > >Subject: Re: [PHP] still learning php > > > > > > > Hi Dimitris, > > > > > > thanks, but what if I have 5 fields to add into ie > >name,surname,comments? > > > > > > > > > > > > Caleb Carvalho > > > Application Engineer > > > LoadRunner/APM > > > > >-------------- > >--- > > > Enterprise Testing and Performance Management Solutions > > > > >-- > >--- > > > Mercury Interactive > > > 410 Frimley Business Park > > > Frimley, Surrey. GU16 7ST > > > United Kingdom > > > Telephone : +44 (0)1276 808300 > > > > > > > > > > > > >From: "Dimitris Kossikidis" <[EMAIL PROTECTED]> > > > >To: "Caleb Carvalho" <[EMAIL PROTECTED]> > > > >CC: <[EMAIL PROTECTED]> > > > >Subject: Re: [PHP] still learning php > > > >Date: Mon, 1 Oct 2001 14:29:14 +0300 > > > > > > > >$field_value = "I 'm bla bla"; > > > >$field_value = addslashes($field_value); > > > > > > > >$sql = "Insert into TABLE values('$field_value'); > > > > > > > > > > > >- Original Message - > > > >From: "Caleb Carvalho" <[EMAIL PROTECTED]> > > > >To: <[EMAIL PROTECTED]> > > > >Sent: Monday, October 01, 2001 2:05 PM > > > >Subject: [PHP] still learning php > > > > > > > > > > > > > I posted a msg earlier on regarding error when adding text with > >quotes > >' > > > > > .. > > > > > I have just found out thar I need to use addslash() function, > > > > > > > > > > my q's is > > > > > > > > > > where do i put this function? > > > > > > > > > > > > > > > > > > > > Caleb Carvalho > > > > > Application Engineer > > > > > LoadRunner/APM > > > > > > > > > > >-- > > > >--- > > > >
Re: [PHP] still learning php
thank you s much that was much much better indeed :), i am assuming that i need to use the same for sql_quey sql_display is that correct? Caleb Carvalho Application Engineer LoadRunner/APM - Enterprise Testing and Performance Management Solutions - Mercury Interactive 410 Frimley Business Park Frimley, Surrey. GU16 7ST United Kingdom Telephone : +44 (0)1276 808300 >From: "Dimitris Kossikidis" <[EMAIL PROTECTED]> >To: "Caleb Carvalho" <[EMAIL PROTECTED]> >CC: <[EMAIL PROTECTED]> >Subject: Re: [PHP] still learning php >Date: Mon, 1 Oct 2001 15:52:23 +0300 > >Use addslashes() to escape single quotes or double quotes. It 's in the >manual > >// giving some values >$firstname ="Bob"; >$lastname = "O' Reily"; // This could cause an error if not use addslashes >$address = "Somewhere"; >$age= 19; > >// adding slashes to quotes >$firstname = addslashes($firstname); >$lastname = addslashes($lastname); >$address = addslashes($address); > >$sql = " insert into TABLE values ( '$firstname', '$lastname', '$address', >$age) "; > >- Original Message - >From: "Caleb Carvalho" <[EMAIL PROTECTED]> >To: <[EMAIL PROTECTED]> >Cc: <[EMAIL PROTECTED]> >Sent: Monday, October 01, 2001 3:36 PM >Subject: Re: [PHP] still learning php > > > > Hi Dimitris, > > > > thanks, but what if I have 5 fields to add into ie >name,surname,comments? > > > > > > > > Caleb Carvalho > > Application Engineer > > LoadRunner/APM > > >-- >--- > > Enterprise Testing and Performance Management Solutions > > >------ >------- > > Mercury Interactive > > 410 Frimley Business Park > > Frimley, Surrey. GU16 7ST > > United Kingdom > > Telephone : +44 (0)1276 808300 > > > > > > > > >From: "Dimitris Kossikidis" <[EMAIL PROTECTED]> > > >To: "Caleb Carvalho" <[EMAIL PROTECTED]> > > >CC: <[EMAIL PROTECTED]> > > >Subject: Re: [PHP] still learning php > > >Date: Mon, 1 Oct 2001 14:29:14 +0300 > > > > > >$field_value = "I 'm bla bla"; > > >$field_value = addslashes($field_value); > > > > > >$sql = "Insert into TABLE values('$field_value'); > > > > > > > > >- Original Message - > > >From: "Caleb Carvalho" <[EMAIL PROTECTED]> > > >To: <[EMAIL PROTECTED]> > > >Sent: Monday, October 01, 2001 2:05 PM > > >Subject: [PHP] still learning php > > > > > > > > > > I posted a msg earlier on regarding error when adding text with >quotes >' > > > > .. > > > > I have just found out thar I need to use addslash() function, > > > > > > > > my q's is > > > > > > > > where do i put this function? > > > > > > > > > > > > > > > > Caleb Carvalho > > > > Application Engineer > > > > LoadRunner/APM > > > > > > > >-- > > >--- > > > > Enterprise Testing and Performance Management Solutions > > > > > > > >-- > > >--- > > > > Mercury Interactive > > > > 410 Frimley Business Park > > > > Frimley, Surrey. GU16 7ST > > > > United Kingdom > > > > Telephone : +44 (0)1276 808300 > > > > > > > > > > > > _ > > > > Get your FREE download of MSN Explorer at > > >http://explorer.msn.com/intl.asp > > > > > > > > > > > > -- > > > > PHP General Mailing List (http://www.php.net/) > > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > To contact the list administrators, e-mail: >[EMAIL PROTECTED] > > > > > > > > > > > > > > > > >-- >
Re: [PHP] still learning php
You just add more fields: $sql = "Insert into TABLE values('$name', $surname, $comments); that's assuming that the order of the data exactly matches the order of the fields in the table. Take the time to work through a couple of MySQL tutorials(assuming that's what you're using), and have a look at the tutorials Julie Meloni has on her http://www.thickbook.com site. Miles At 12:36 PM 10/1/01 +, Caleb Carvalho wrote: >Hi Dimitris, > >thanks, but what if I have 5 fields to add into ie name,surname,comments? > > > >Caleb Carvalho >Application Engineer >LoadRunner/APM >- >Enterprise Testing and Performance Management Solutions >- >Mercury Interactive >410 Frimley Business Park >Frimley, Surrey. GU16 7ST >United Kingdom >Telephone : +44 (0)1276 808300 > > > >>From: "Dimitris Kossikidis" <[EMAIL PROTECTED]> >>To: "Caleb Carvalho" <[EMAIL PROTECTED]> >>CC: <[EMAIL PROTECTED]> >>Subject: Re: [PHP] still learning php >>Date: Mon, 1 Oct 2001 14:29:14 +0300 >> >>$field_value = "I 'm bla bla"; >>$field_value = addslashes($field_value); >> >>$sql = "Insert into TABLE values('$field_value'); >> >> >>- Original Message - >>From: "Caleb Carvalho" <[EMAIL PROTECTED]> >>To: <[EMAIL PROTECTED]> >>Sent: Monday, October 01, 2001 2:05 PM >>Subject: [PHP] still learning php >> >> >> > I posted a msg earlier on regarding error when adding text with quotes ' >> > .. >> > I have just found out thar I need to use addslash() function, >> > >> > my q's is >> > >> > where do i put this function? >> > >> > >> > >> > Caleb Carvalho >> > Application Engineer >> > LoadRunner/APM >> > -- >>--- >> > Enterprise Testing and Performance Management Solutions >> > -- >>--- >> > Mercury Interactive >> > 410 Frimley Business Park >> > Frimley, Surrey. GU16 7ST >> > United Kingdom >> > Telephone : +44 (0)1276 808300 >> > >> > >> > _ >> > Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp >> > >> > >> > -- >> > PHP General Mailing List (http://www.php.net/) >> > To unsubscribe, e-mail: [EMAIL PROTECTED] >> > For additional commands, e-mail: [EMAIL PROTECTED] >> > To contact the list administrators, e-mail: [EMAIL PROTECTED] >> > >> > >> >> >>-- >>PHP General Mailing List (http://www.php.net/) >>To unsubscribe, e-mail: [EMAIL PROTECTED] >>For additional commands, e-mail: [EMAIL PROTECTED] >>To contact the list administrators, e-mail: [EMAIL PROTECTED] > > >_ >Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp > > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] >To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] still learning php
Use addslashes() to escape single quotes or double quotes. It 's in the manual // giving some values $firstname ="Bob"; $lastname = "O' Reily"; // This could cause an error if not use addslashes $address = "Somewhere"; $age= 19; // adding slashes to quotes $firstname = addslashes($firstname); $lastname = addslashes($lastname); $address = addslashes($address); $sql = " insert into TABLE values ( '$firstname', '$lastname', '$address', $age) "; - Original Message - From: "Caleb Carvalho" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Monday, October 01, 2001 3:36 PM Subject: Re: [PHP] still learning php > Hi Dimitris, > > thanks, but what if I have 5 fields to add into ie name,surname,comments? > > > > Caleb Carvalho > Application Engineer > LoadRunner/APM > -- --- > Enterprise Testing and Performance Management Solutions > -- --- > Mercury Interactive > 410 Frimley Business Park > Frimley, Surrey. GU16 7ST > United Kingdom > Telephone : +44 (0)1276 808300 > > > > >From: "Dimitris Kossikidis" <[EMAIL PROTECTED]> > >To: "Caleb Carvalho" <[EMAIL PROTECTED]> > >CC: <[EMAIL PROTECTED]> > >Subject: Re: [PHP] still learning php > >Date: Mon, 1 Oct 2001 14:29:14 +0300 > > > >$field_value = "I 'm bla bla"; > >$field_value = addslashes($field_value); > > > >$sql = "Insert into TABLE values('$field_value'); > > > > > >- Original Message - > >From: "Caleb Carvalho" <[EMAIL PROTECTED]> > >To: <[EMAIL PROTECTED]> > >Sent: Monday, October 01, 2001 2:05 PM > >Subject: [PHP] still learning php > > > > > > > I posted a msg earlier on regarding error when adding text with quotes ' > > > .. > > > I have just found out thar I need to use addslash() function, > > > > > > my q's is > > > > > > where do i put this function? > > > > > > > > > > > > Caleb Carvalho > > > Application Engineer > > > LoadRunner/APM > > > > >-- > >--- > > > Enterprise Testing and Performance Management Solutions > > > > >-- > >--- > > > Mercury Interactive > > > 410 Frimley Business Park > > > Frimley, Surrey. GU16 7ST > > > United Kingdom > > > Telephone : +44 (0)1276 808300 > > > > > > > > > _ > > > Get your FREE download of MSN Explorer at > >http://explorer.msn.com/intl.asp > > > > > > > > > -- > > > PHP General Mailing List (http://www.php.net/) > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > > For additional commands, e-mail: [EMAIL PROTECTED] > > > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > > > > > > > > > > >-- > >PHP General Mailing List (http://www.php.net/) > >To unsubscribe, e-mail: [EMAIL PROTECTED] > >For additional commands, e-mail: [EMAIL PROTECTED] > >To contact the list administrators, e-mail: [EMAIL PROTECTED] > > > > > _ > Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] still learning php
Hi Dimitris, thanks, but what if I have 5 fields to add into ie name,surname,comments? Caleb Carvalho Application Engineer LoadRunner/APM - Enterprise Testing and Performance Management Solutions - Mercury Interactive 410 Frimley Business Park Frimley, Surrey. GU16 7ST United Kingdom Telephone : +44 (0)1276 808300 >From: "Dimitris Kossikidis" <[EMAIL PROTECTED]> >To: "Caleb Carvalho" <[EMAIL PROTECTED]> >CC: <[EMAIL PROTECTED]> >Subject: Re: [PHP] still learning php >Date: Mon, 1 Oct 2001 14:29:14 +0300 > >$field_value = "I 'm bla bla"; >$field_value = addslashes($field_value); > >$sql = "Insert into TABLE values('$field_value'); > > >- Original Message - >From: "Caleb Carvalho" <[EMAIL PROTECTED]> >To: <[EMAIL PROTECTED]> >Sent: Monday, October 01, 2001 2:05 PM >Subject: [PHP] still learning php > > > > I posted a msg earlier on regarding error when adding text with quotes ' > > .. > > I have just found out thar I need to use addslash() function, > > > > my q's is > > > > where do i put this function? > > > > > > > > Caleb Carvalho > > Application Engineer > > LoadRunner/APM > > >-- >--- > > Enterprise Testing and Performance Management Solutions > > >-- >--- > > Mercury Interactive > > 410 Frimley Business Park > > Frimley, Surrey. GU16 7ST > > United Kingdom > > Telephone : +44 (0)1276 808300 > > > > > > _ > > Get your FREE download of MSN Explorer at >http://explorer.msn.com/intl.asp > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > > > > > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] >To contact the list administrators, e-mail: [EMAIL PROTECTED] > _ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] still learning php
$field_value = "I 'm bla bla"; $field_value = addslashes($field_value); $sql = "Insert into TABLE values('$field_value'); - Original Message - From: "Caleb Carvalho" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, October 01, 2001 2:05 PM Subject: [PHP] still learning php > I posted a msg earlier on regarding error when adding text with quotes ' > .. > I have just found out thar I need to use addslash() function, > > my q's is > > where do i put this function? > > > > Caleb Carvalho > Application Engineer > LoadRunner/APM > -- --- > Enterprise Testing and Performance Management Solutions > -- --- > Mercury Interactive > 410 Frimley Business Park > Frimley, Surrey. GU16 7ST > United Kingdom > Telephone : +44 (0)1276 808300 > > > _ > Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] still learning php
I posted a msg earlier on regarding error when adding text with quotes ' .. I have just found out thar I need to use addslash() function, my q's is where do i put this function? Caleb Carvalho Application Engineer LoadRunner/APM - Enterprise Testing and Performance Management Solutions - Mercury Interactive 410 Frimley Business Park Frimley, Surrey. GU16 7ST United Kingdom Telephone : +44 (0)1276 808300 _ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]