[PHP-DB] echo
Hi all, I am new to web programming. I have code to add pictures to a MYSQL database. Now I can't seem to figure out how to get them back out ! so we can see them. The MySQL doesn't seem to be a problem (yet), also I'm trying to learn PHP. What I usually do is to load the images in a folder "img" and then the name of the pic (i.e. "myphoto.jpg") in the database, so i retrieve the name of the pic with: Code: and then: Code: echo ""; but I can't see the photo Any pointers or code samples will be greatly appreciated... - Bored stiff? Loosen up... Download and play hundreds of games for free on Yahoo! Games.
[PHP-DB] echo
I am storing just the name of photos in the database and the photos are in /img folder , and there is no permissions issue. My testing server is IIS And the path would be something like this : Inetpub\wwwroot\album\img as I am running out of time! could someone complete this code just with one echo and img src so that I can retrive my photos ? MySQL columns : photoID=seq number photoFileName=name of my photo like 3sw.jpg title=title description=short description - Expecting? Get great news right away with email Auto-Check. Try the Yahoo! Mail Beta.
[PHP-DB] echo
thanks to Chris and Dimiter, I think I am close but still the problem is not solved, when I add echo " to the code as it was sugested by Dimiter there is parse Error : PHP Parse error: syntax error, unexpected $end in C:\Inetpub\wwwroot\album\show.php on line 44 line 44 is end of the code just after what does it mean? >I am storing just the name of photos in the database and the photos are >in /img folder ,and there is no permissions issue. My testing server >is IIS And the path would be something like this : Inetpub\wwwroot\album\img >as I am running out of time! could someone complete this code just with >one echo and img src so that I can retrive my photos ? >MySQL columns : photoID=seq number >photoFileName=name of my photo like 3sw.jpg >title=title >description=short description >- > } mysql_free_result($result); ?> - Looking for earth-friendly autos? Browse Top Cars by "Green Rating" at Yahoo! Autos' Green Center.
[PHP-DB] echo
thank you all, it did it! >[EMAIL PROTECTED] >You need a trailing " >you have echo " >it needs to be >echo ""; - Bored stiff? Loosen up... Download and play hundreds of games for free on Yahoo! Games.
[PHP-DB] ECHO $variable
In one of my scripts I have where $saved_message_title is 1 Peter 5:7 "Cast all your cares on Him for He cares about you" --- note the " When this is displayed on the screen it reads 1 Peter 5:7 I am assuming the " closes the value= How may I echo this to the screen and have the full text be displayed, not just 1 Peter 5:7 ? Ron
[PHP-DB] echo delay...
Hi fellow php late night peoples Thanks for everyone's help the last couple of days... I have learned so much. The best way to learn this stuff...is simple trial and error... and thanks for good old Ggle! My problem tonight is very simple. I just don't know what command I want to use. I want to echo text in a page then take a delay then echo more text/images to the same page. I tried the sleep command with the number of seconds, but it don't load the page to the sleep timer is done. any ideas of what php command I can use? Matt
Re: [PHP-DB] echo
You might be missing a quote so here and there unless you have the quotes stored in the database too. Since your photos are stored on disk, make sure the webserver has access to them. Then make sure that your string is something like in php: printf("", $somepath, $somefilename); in your php line: echo ""; the line echoed doesn't have any quotes in it. Ron elk dolk wrote: > Hi all, > I am new to web programming. > > I have code to add pictures to a MYSQL database. Now I can't seem to figure > out how to get them back out ! so we can see them. > The MySQL doesn't seem to be a problem (yet), also I'm trying to learn PHP. > > What I usually do is to load the images in a folder "img" and then the name > of the pic (i.e. "myphoto.jpg") in the database, so i retrieve the name of > the pic with: > > Code: $connex = MySQL_connect(server,login,password); > $sql_query = "select picname from photos where..."; > $result = MySQL_query($sql_query,$connex); > $row = MySQL_fetch_array($result); > ?> > > and then: > > Code: echo ""; > > but I can't see the photo > Any pointers or code samples will be greatly appreciated... > > > - > Bored stiff? Loosen up... > Download and play hundreds of games for free on Yahoo! Games. -- = It's is not, it isn't ain't, and it's it's, not its, if you mean it is. If you don't, it's its. Then too, it's hers. It isn't her's. It isn't our's either. It's ours, and likewise yours and theirs. -- Oxford Uni Press = Ron Croonenberg | | Phone: 1 765 658 4761 Lab Instructor & | Fax: 1 765 658 4732 Technology Coordinator| | Department of Computer Science| e-mail: [EMAIL PROTECTED] DePauw University | 275 Julian Science & Math Center | 602 South College Ave.| Greencastle, IN 46135| = http://www.csc.depauw.edu/RonCroonenberg.html = -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] echo
elk dolk wrote: Hi all, I am new to web programming. I have code to add pictures to a MYSQL database. Now I can't seem to figure out how to get them back out ! so we can see them. The MySQL doesn't seem to be a problem (yet), also I'm trying to learn PHP. What I usually do is to load the images in a folder "img" and then the name of the pic (i.e. "myphoto.jpg") in the database, so i retrieve the name of the pic with: Code: $connex = MySQL_connect(server,login,password); $sql_query = "select picname from photos where..."; $result = MySQL_query($sql_query,$connex); $row = MySQL_fetch_array($result); ?> and then: Code: echo ""; but I can't see the photo Any pointers or code samples will be greatly appreciated... Are you storing the whole file in the database or just the path to the file? If you're storing just the path, then your script is pointing to the wrong directory and/or the file it's trying to reference doesn't exist (or a permissions issue maybe). If you're storing the whole file you need a new php script to pull it back out. Then in your html code you do: echo ''; That will hit 'display_image.php' and pull the image contents out of the database. See http://www.phpriot.com/d/articles/database/images-in-mysql/page8.html for an example. -- Postgresql & php tutorials http://www.designmagick.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] echo
elk dolk wrote: I am storing just the name of photos in the database and the photos are in /img folder , and there is no permissions issue. So it's a path issue. You need to reference the image as: -- Postgresql & php tutorials http://www.designmagick.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] echo
something like this : Inetpub\wwwroot\album\img as I am running out of time! could someone complete this code just with one echo and img src so that I can retrive my photos ? MySQL columns : photoID=seq number photoFileName=name of my photo like 3sw.jpg title=title description=short description The path would be relative to your web root folder. in your case or if you are testing on your own machine use http://localhost/album/img/image_name";> or if you need it to work for outside connections : http://your_ip_addres/album/img/image_name";> i suggest using the relative path. while ($row = mysql_fetch_array($result)) { echo " } P.S. Chris sorry for accidentaly sending it only to you the first time.. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] echo
if you view the source of the generated page, is the image name correct? is the path to the image correct? bastien From: elk dolk <[EMAIL PROTECTED]> To: php-db@lists.php.net Subject: [PHP-DB] echo Date: Tue, 27 Mar 2007 22:07:37 -0700 (PDT) Hi all, I am new to web programming. I have code to add pictures to a MYSQL database. Now I can't seem to figure out how to get them back out ! so we can see them. The MySQL doesn't seem to be a problem (yet), also I'm trying to learn PHP. What I usually do is to load the images in a folder "img" and then the name of the pic (i.e. "myphoto.jpg") in the database, so i retrieve the name of the pic with: Code: and then: Code: echo ""; but I can't see the photo Any pointers or code samples will be greatly appreciated... - Bored stiff? Loosen up... Download and play hundreds of games for free on Yahoo! Games. _ RealLiveMoms: Share your experience with Real Live Moms just like you http://www.reallivemoms.ca/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] echo
elk dolk wrote: thanks to Chris and Dimiter, I think I am close but still the problem is not solved, when I add echo " to the code as it was sugested by Dimiter there is parse Error : PHP Parse error: syntax error, unexpected $end in C:\Inetpub\wwwroot\album\show.php on line 44 line 44 is end of the code just after what does it mean? probably you don't have a semi colon at the end of your echo line nor is there and end double quote. I am storing just the name of photos in the database and the photos are in /img folder ,and there is no permissions issue. My testing server is IIS And the path would be something like this : Inetpub\wwwroot\album\img as I am running out of time! could someone complete this code just with one echo and img src so that I can retrive my photos ? MySQL columns : photoID=seq number photoFileName=name of my photo like 3sw.jpg title=title description=short description - while ($row = mysql_fetch_array($result)) { echo " } mysql_free_result($result); ?> - Looking for earth-friendly autos? Browse Top Cars by "Green Rating" at Yahoo! Autos' Green Center. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] echo
try echo " "; warpping the array element in braces allows for proper evaluation bastien From: elk dolk <[EMAIL PROTECTED]> To: php-db@lists.php.net Subject: [PHP-DB] echo Date: Thu, 29 Mar 2007 05:08:36 -0700 (PDT) thanks to Chris and Dimiter, I think I am close but still the problem is not solved, when I add echo " to the code as it was sugested by Dimiter there is parse Error : PHP Parse error: syntax error, unexpected $end in C:\Inetpub\wwwroot\album\show.php on line 44 line 44 is end of the code just after what does it mean? >I am storing just the name of photos in the database and the photos are >in /img folder ,and there is no permissions issue. My testing server >is IIS And the path would be something like this : Inetpub\wwwroot\album\img >as I am running out of time! could someone complete this code just with >one echo and img src so that I can retrive my photos ? >MySQL columns : photoID=seq number >photoFileName=name of my photo like 3sw.jpg >title=title >description=short description >- } mysql_free_result($result); ?> - Looking for earth-friendly autos? Browse Top Cars by "Green Rating" at Yahoo! Autos' Green Center. _ Fine Dining & Fancy Food. Check Out This Collection Of Good Eats. http://local.live.com/?mkt=en-ca/?v=2&cid=A6D6BDB4586E357F!378 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Echo Command Thanks
Hi there everyone, Thank you all for your responses to my question about the best way to end a PHP command (Or use Echo to print HTML). My gut feeling was it should be ok, it's just that *To me* it is MUCH easier to follow code which doesn't contain echo "" etc . I much prefer to do it ?> and so on, it seems to look much cleaner to me. I'm not a C+ programmer, a Perl programmer or anything like that, i've learnt ASP and PHP, started with ASP but found it to be a system hog, tried PHP and fell in love with it within a couple of days and just wanted to make sure I wasn't putting unecessary strain on my server :-) Thanks again everyone, this is the best PHP / Programming mailinglist out there. Regards Chris Payne -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] ECHO $variable
Hi Where's the DB question? Niel -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] ECHO $variable
easist way is to wrap the entire value in single quotes not double quotes...kinda breaks the rules but it will work..the other option is to search your value and do a replace on the double quotes bastien From: "Ron Piggott (PHP)" <[EMAIL PROTECTED]> Reply-To: [EMAIL PROTECTED] To: PHP DB Subject: [PHP-DB] ECHO $variable Date: Sun, 08 Oct 2006 01:32:13 -0400 In one of my scripts I have where $saved_message_title is 1 Peter 5:7 "Cast all your cares on Him for He cares about you" --- note the " When this is displayed on the screen it reads 1 Peter 5:7 I am assuming the " closes the value= How may I echo this to the screen and have the full text be displayed, not just 1 Peter 5:7 ? Ron -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] ECHO $variable
You can as well add a backslash BEFORE the " eg. echo "text \"more text\" "; So that will return this: text "more text" - Original Message - From: "Bastien Koert" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]>; Sent: Sunday, October 08, 2006 3:35 PM Subject: RE: [PHP-DB] ECHO $variable easist way is to wrap the entire value in single quotes not double quotes...kinda breaks the rules but it will work..the other option is to search your value and do a replace on the double quotes bastien From: "Ron Piggott (PHP)" <[EMAIL PROTECTED]> Reply-To: [EMAIL PROTECTED] To: PHP DB Subject: [PHP-DB] ECHO $variable Date: Sun, 08 Oct 2006 01:32:13 -0400 In one of my scripts I have where $saved_message_title is 1 Peter 5:7 "Cast all your cares on Him for He cares about you" --- note the " When this is displayed on the screen it reads 1 Peter 5:7 I am assuming the " closes the value= How may I echo this to the screen and have the full text be displayed, not just 1 Peter 5:7 ? Ron -- 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] echo delay...
I would suggest placing all the data into divs and using some js to show those divs when the time is right bastien From: "Matthew Ferry" <[EMAIL PROTECTED]> To: Subject: [PHP-DB] echo delay... Date: Fri, 16 Feb 2007 03:37:17 -0500 Hi fellow php late night peoples Thanks for everyone's help the last couple of days... I have learned so much. The best way to learn this stuff...is simple trial and error... and thanks for good old Ggle! My problem tonight is very simple. I just don't know what command I want to use. I want to echo text in a page then take a delay then echo more text/images to the same page. I tried the sleep command with the number of seconds, but it don't load the page to the sleep timer is done. any ideas of what php command I can use? Matt _ Your Space. Your Friends. Your Stories. Share your world with Windows Live Spaces. http://discoverspaces.live.com/?loc=en-CA -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Echo function stopping
Hi People, Below I have included some code that just doesn't seem to be functioning all correctly. I have this running and it appears to stop the query/echo after the first entry in the database. What is it that I am doing wrong here?? Regards, Shannon Round ".$roundnum.""; echo "".$array[$i]["home"]."".$array[$i]["home_goals"]."\n"; if ($array[$i]["home_goals"] > $array[$i]["away_goals"]) { echo "Defeated"; } elseif ($array[$i]["home_goals"] < $array[$i]["away_goals"]) { echo "Defeated by"; } elseif ($array[$i]["home_goals"] == $array[$i]["away_goals"]) { echo "Drew"; } echo "".$array[$i]["away"]."".$array[$i]["away_goals"]."\n"; } } ?> -- PHP Database 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-DB] echo printing a cookie
Hi I'm trying to print the contents of a cookie (php 4.2.3) the syntax below is wrong but what should it be? if ($_cookie["cookiename"]== TRUE) { echo"your cookie is" $_COOKIE["cookiename"]""; } Regards Steve Dodkins IMPORTANT NOTICE The information in this e-mail is confidential and should only be read by those persons to whom it is addressed and is not intended to be relied upon by any person without subsequent written confirmation of its contents. ebm-ZIEHL (UK) Ltd. cannot accept any responsibility for the accuracy or completeness of this message as it has been transmitted over a public network. Furthermore, the content of this e-mail is the personal view of the sender and does not represent the advice, views or opinion of our company. Accordingly, our company disclaim all responsibility and accept no liability (including in negligence) for the consequences of any person acting, or refraining from acting, on such information prior to the receipt by those persons of subsequent written confirmation. In particular (but not by way of limitation) our company disclaims all responsibility and accepts no liability for any e-mails which are defamatory, offensive, racist or in any other way are in breach of any third party's rights, including breach of confidence, privacy or other rights. If you have received this e-mail message in error, please notify me immediately by telephone. Please also destroy and delete the message from your computer. Any form of reproduction, dissemination, copying, disclosure, modification, distribution and/or publication of this e-mail message is strictly prohibited. If you have received this E-mail in error, or suspect that the message may have been intercepted or amended, please notify ebm-ZIEHL (UK) Ltd on +44(0)1245 468555. ebm-ZIEHL (UK) Ltd Chelmsford Business Park, Chelmsford, Essex CM2 5EZ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Echo with extra characters
I have the following code in my page as a header. When I echo $mainarea I get \'Language\'. I think it is something to do with my quotation marks but need some help. How do I get rid of the ' and \ so that I am left with my variable?. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] echo printing a cookie
I belive $_cookie is different then $_COOKIE Jeff Steve Dodkins ehl.co.uk> cc: Subject: [PHP-DB] echo printing a cookie 10/15/2002 09:21 AM Hi I'm trying to print the contents of a cookie (php 4.2.3) the syntax below is wrong but what should it be? if ($_cookie["cookiename"]== TRUE) { echo"your cookie is" $_COOKIE["cookiename"]""; } Regards Steve Dodkins IMPORTANT NOTICE The information in this e-mail is confidential and should only be read by those persons to whom it is addressed and is not intended to be relied upon by any person without subsequent written confirmation of its contents. ebm-ZIEHL (UK) Ltd. cannot accept any responsibility for the accuracy or completeness of this message as it has been transmitted over a public network. Furthermore, the content of this e-mail is the personal view of the sender and does not represent the advice, views or opinion of our company. Accordingly, our company disclaim all responsibility and accept no liability (including in negligence) for the consequences of any person acting, or refraining from acting, on such information prior to the receipt by those persons of subsequent written confirmation. In particular (but not by way of limitation) our company disclaims all responsibility and accepts no liability for any e-mails which are defamatory, offensive, racist or in any other way are in breach of any third party's rights, including breach of confidence, privacy or other rights. If you have received this e-mail message in error, please notify me immediately by telephone. Please also destroy and delete the message from your computer. Any form of reproduction, dissemination, copying, disclosure, modification, distribution and/or publication of this e-mail message is strictly prohibited. If you have received this E-mail in error, or suspect that the message may have been intercepted or amended, please notify ebm-ZIEHL (UK) Ltd on +44(0)1245 468555. ebm-ZIEHL (UK) Ltd Chelmsford Business Park, Chelmsford, Essex CM2 5EZ -- 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] echo printing a cookie
Here ya go.. if ($_cookie["cookiename"]) { echo"your cookie is".$_COOKIE['cookiename'].""; } Cheers Simon -Original Message- From: Steve Dodkins [mailto:[EMAIL PROTECTED]] Sent: 15 October 2002 15:22 To: Php-Db (E-mail) Subject: [PHP-DB] echo printing a cookie Hi I'm trying to print the contents of a cookie (php 4.2.3) the syntax below is wrong but what should it be? if ($_cookie["cookiename"]== TRUE) { echo"your cookie is" $_COOKIE["cookiename"]""; } Regards Steve Dodkins IMPORTANT NOTICE The information in this e-mail is confidential and should only be read by those persons to whom it is addressed and is not intended to be relied upon by any person without subsequent written confirmation of its contents. ebm-ZIEHL (UK) Ltd. cannot accept any responsibility for the accuracy or completeness of this message as it has been transmitted over a public network. Furthermore, the content of this e-mail is the personal view of the sender and does not represent the advice, views or opinion of our company. Accordingly, our company disclaim all responsibility and accept no liability (including in negligence) for the consequences of any person acting, or refraining from acting, on such information prior to the receipt by those persons of subsequent written confirmation. In particular (but not by way of limitation) our company disclaims all responsibility and accepts no liability for any e-mails which are defamatory, offensive, racist or in any other way are in breach of any third party's rights, including breach of confidence, privacy or other rights. If you have received this e-mail message in error, please notify me immediately by telephone. Please also destroy and delete the message from your computer. Any form of reproduction, dissemination, copying, disclosure, modification, distribution and/or publication of this e-mail message is strictly prohibited. If you have received this E-mail in error, or suspect that the message may have been intercepted or amended, please notify ebm-ZIEHL (UK) Ltd on +44(0)1245 468555. ebm-ZIEHL (UK) Ltd Chelmsford Business Park, Chelmsford, Essex CM2 5EZ -- 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] echo printing a cookie
If (isset($_COOKIE[cookiename]) { echo 'Your cookie is: '.$_COOKIE[cookiename].' '; } -Original Message- From: Steve Dodkins [mailto:[EMAIL PROTECTED]] Sent: Tuesday, October 15, 2002 9:22 AM To: Php-Db (E-mail) Subject: [PHP-DB] echo printing a cookie Hi I'm trying to print the contents of a cookie (php 4.2.3) the syntax below is wrong but what should it be? if ($_cookie["cookiename"]== TRUE) { echo"your cookie is" $_COOKIE["cookiename"]""; } Regards Steve Dodkins IMPORTANT NOTICE The information in this e-mail is confidential and should only be read by those persons to whom it is addressed and is not intended to be relied upon by any person without subsequent written confirmation of its contents. ebm-ZIEHL (UK) Ltd. cannot accept any responsibility for the accuracy or completeness of this message as it has been transmitted over a public network. Furthermore, the content of this e-mail is the personal view of the sender and does not represent the advice, views or opinion of our company. Accordingly, our company disclaim all responsibility and accept no liability (including in negligence) for the consequences of any person acting, or refraining from acting, on such information prior to the receipt by those persons of subsequent written confirmation. In particular (but not by way of limitation) our company disclaims all responsibility and accepts no liability for any e-mails which are defamatory, offensive, racist or in any other way are in breach of any third party's rights, including breach of confidence, privacy or other rights. If you have received this e-mail message in error, please notify me immediately by telephone. Please also destroy and delete the message from your computer. Any form of reproduction, dissemination, copying, disclosure, modification, distribution and/or publication of this e-mail message is strictly prohibited. If you have received this E-mail in error, or suspect that the message may have been intercepted or amended, please notify ebm-ZIEHL (UK) Ltd on +44(0)1245 468555. ebm-ZIEHL (UK) Ltd Chelmsford Business Park, Chelmsford, Essex CM2 5EZ -- 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] echo printing a cookie
> -Original Message- > From: Steve Dodkins [mailto:[EMAIL PROTECTED]] > Sent: 15 October 2002 14:22 > To: Php-Db (E-mail) > > Hi I'm trying to print the contents of a cookie (php 4.2.3) > the syntax below > is wrong but what should it be? > > if ($_cookie["cookiename"]== TRUE) { > echo"your cookie is" $_COOKIE["cookiename"]""; > } if (isset($_COOKIE['cookiename'])) { echo "your cookie is {$_COOKIE['cookiename']}"; } Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning & Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Echo with extra characters
In case the string is always "Language" you can use : $mainarea = substr($mainarea,2,8); If not, than you need Regexps berber -Original Message- From: Alex Francis [mailto:[EMAIL PROTECTED]] Sent: Wednesday, January 08, 2003 4:41 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] Echo with extra characters I have the following code in my page as a header. When I echo $mainarea I get \'Language\'. I think it is something to do with my quotation marks but need some help. How do I get rid of the ' and \ so that I am left with my variable?. -- 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] echo into variable or the like
Hi, this is my first post so forgive me if I missed a rule and do something wrong. I have this code, echo $_SERVER['PHP_SELF']."?"; foreach ($_GET as $urlvar=>$urlval) echo $urlvar."=".$urlval."&"; It works by it’s self. I want to insert the output in a table. Is there a way to ‘echo’ into a variable(i.e. make the output of this echo the value of a variable) or am I on the wrong track all together?
Re: [PHP-DB] echo into variable or the like
You echo to the page not to a variable. php.net is your friend. :) GL On Aug 20, 2012, at 11:01 PM, > wrote: Hi, this is my first post so forgive me if I missed a rule and do something wrong. I have this code, echo $_SERVER['PHP_SELF']."?"; foreach ($_GET as $urlvar=>$urlval) echo $urlvar."=".$urlval."&"; It works by it’s self. I want to insert the output in a table. Is there a way to ‘echo’ into a variable(i.e. make the output of this echo the value of a variable) or am I on the wrong track all together? Karl DeSaulniers Design Drumm http://designdrumm.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] echo into variable or the like
yeah, I am thinking I should make that a function and call it from a variable. what do you think? I think I need a php.net 'arrays for dummies'. Sean Williams T: 0416 628 967 E: sm...@optusnet.com.au Skype: seanw78 -Original Message- From: Karl DeSaulniers Sent: Tuesday, August 21, 2012 2:22 PM To: php-db@lists.php.net Subject: Re: [PHP-DB] echo into variable or the like You echo to the page not to a variable. php.net is your friend. :) GL On Aug 20, 2012, at 11:01 PM, wrote: Hi, this is my first post so forgive me if I missed a rule and do something wrong. I have this code, echo $_SERVER['PHP_SELF']."?"; foreach ($_GET as $urlvar=>$urlval) echo $urlvar."=".$urlval."&"; It works by it’s self. I want to insert the output in a table. Is there a way to ‘echo’ into a variable(i.e. make the output of this echo the value of a variable) or am I on the wrong track all together? Karl DeSaulniers Design Drumm http://designdrumm.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] echo into variable or the like
On Aug 21, 2012, at 12:35 AM, wrote: yeah, I am thinking I should make that a function and call it from a variable. what do you think? I think I need a php.net 'arrays for dummies'. Sean Williams T: 0416 628 967 E: sm...@optusnet.com.au Skype: seanw78 -Original Message- From: Karl DeSaulniers Sent: Tuesday, August 21, 2012 2:22 PM To: php-db@lists.php.net Subject: Re: [PHP-DB] echo into variable or the like You echo to the page not to a variable. php.net is your friend. :) GL On Aug 20, 2012, at 11:01 PM, wrote: Hi, this is my first post so forgive me if I missed a rule and do something wrong. I have this code, echo $_SERVER['PHP_SELF']."?"; foreach ($_GET as $urlvar=>$urlval) echo $urlvar."=".$urlval."&"; It works by it’s self. I want to insert the output in a table. Is there a way to ‘echo’ into a variable(i.e. make the output of this echo the value of a variable) or am I on the wrong track all together? Karl DeSaulniers Design Drumm http://designdrumm.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 Na just go to php.net and do a search. Look up - foreach() There are examples to learn from php.net and other users there. May not be a copy and paste job, you'll most likely want to adopt things to your situation, but the fundamentals are all there. Best way/place to learn IMO. Then I would go and google MySQL INSERT or what ever SQL Lang your using. Again, I would go to the php.net link that pops up. :) Those two things should get you on track for what it looks like your trying to do. if your not there after those two things, look up array() php and so on... ..but your not far off with what you have, you just need to swap a $var = with the echo text looks like. Then use $var in your INSERT statement like so. $sql = "INSERT (var, ... ) Value( '".mysql_real_escape_string($var)."', )"; The single quotes are only needed for strings too. For variables that are integers (numbers), you don't need them. You may also want to go ahead and look into how to set up your mysql- >php scripts with mysqli as well. Like using mysqli_real_escape_string() instead. I think mysql_ is getting depreciated. Instead of learning one way and then finding out you have to migrate later. :-/ Please correct me if I am wrong anyone. HTH, Best, Karl DeSaulniers Design Drumm http://designdrumm.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] echo into variable or the like
On Tue, Aug 21, 2012 at 12:01 AM, wrote: > Hi, this is my first post so forgive me if I missed a rule and do something > wrong. > > I have this code, > > echo $_SERVER['PHP_SELF']."?"; > foreach ($_GET as $urlvar=>$urlval) > echo $urlvar."=".$urlval."&"; > > It works by it’s self. > I want to insert the output in a table. Is there a way to ‘echo’ into a > variable(i.e. make the output of this echo the value of a variable) or am I > on the wrong track all together? This question actually belongs on the PHP General mailing list. As for echoing into a variable, the only way that's really possible is with output buffering (ob_start(), ob_get_contents(), ob_end_clean(), et al). However, you don't need (and shouldn't want) to do this here. Instead, as your snippet really won't do much of anything useful, you should (entirely) rewrite your code to look something like this, for an HTML table: '.PHP_EOL; foreach ($_GET as $key => $value) { echo ' '.PHP_EOL; echo ' '.$key.''.PHP_EOL; echo ' '.$value.''.PHP_EOL; echo ' '.PHP_EOL; } echo ''; ?> However, since it looks almost as if you're trying to build a query string based upon the supplied GET variables, you may want to try looking into http_build_query(). -- Network Infrastructure Manager http://www.php.net/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php