[PHP] Highlighting a stored value as 'selected'
Is there an easier way to display/highlight the value stored in the database for a select option? Such as: Stored value is 'center'. The statement is: print ''; print 'Left'; print 'Center'; print 'Right'; print ''; I can have 3 sets of the above tied to 'if's but would rather ask for an easier or better way. Thanks in advance. Alp -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Highlighting a stored value as 'selected'
Hi Jarratt, Thank you for your advice. I will try that and come back with the result. Alp "RaTT" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hello Alp > > Try something like, > > > //DB fields as an array > > $db_fields = array('left' => 'left', >'center' => 'center', >'right' => 'right'); > > function drop($array,$sel_name='',$sel_field='',$css=''){ > $dropdown = "\n"; > foreach($arr as $key => $val){ > $sel = ($sel_field == $key)?' selected="selected"':''; > $dropdown .= "\t".''.$val.''."\n"; > } > $dropdown .= "\n"; > return $dropdown; > } > usage: > echo drop($db_fields,'test_select','center'); > ?> > > HTH > Jarratt > > > > On Tue, 8 Feb 2005 17:14:24 +0800, Alp <[EMAIL PROTECTED]> wrote: > > Is there an easier way to display/highlight the value stored in the database > > for a select option? Such as: > > Stored value is 'center'. The statement is: > > print ''; > > print 'Left'; > > print 'Center'; > > print 'Right'; > > print ''; > > > > I can have 3 sets of the above tied to 'if's but would rather ask for an > > easier or better way. > > > > Thanks in advance. > > > > Alp > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Advice/opinion requested on page section lineup
Hi Experts, I would like to be able to alter the lining-up of several sections on a php generated webpage. What would be the best/optimal approach in achieving that? As an example "sections" referred to are mostly tables generated via code on data obtained from a DB. Should I name them (somehow), shall I use a seperate table to store the lining-up information or shall I add a "precedence" integer column to each relevant table in the database, ...? Thanks in advance for your guidance. Alp -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Advice/opinion requested on page section lineup
Hi Jochem, Intention is to give a user the option of assigning "position" of a "section" on the page, i.e: First: sectA, then sectC, then sectE, then sectB and sectD or any other order that is indicated by the user. So it is somewhat like top-of-page, mid-of-page etc but with a numbering/precedence/sorting (can be named any) system that populates the page according to the choice. Roughly: <--first section--> <--second section--> <--third section--> <--fourth section--> <--fifth section--> etc... Clearer now? Alp "Jochem Maas" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Alp wrote: > ... > > > > I would like to be able to alter the lining-up of several sections on a php > > generated webpage. What would be the best/optimal approach in achieving > > that? > > > > As an example "sections" referred to are mostly tables generated via code on > > data obtained from a DB. Should I name them (somehow), shall I use a > > seperate table to store the lining-up information or shall I add a > > "precedence" integer column to each relevant table in the database, ...? > > > sorry, driveby answer. > you want to make your output (source) HTML look pretty? > 2 options spring to mind: > 1. the Tidy extension (there are probably other similar tools) > 2. don't bother - as long as its syntax is correct indentation > is irrelevant really. > > or do you mean something else by 'line-up'? > > > > > Thanks in advance for your guidance. > > > > Alp > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Advice/opinion requested on page section lineup
Thanks Burhan, That's almost what I exactly want to do. The question is "how do I start doing that" which methodlogy, which structure, etc,,, Alp "Burhan Khalid" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Alp wrote: > > Hi Jochem, > > > > Intention is to give a user the option of assigning "position" of a > > "section" on the page, i.e: > > First: sectA, then sectC, then sectE, then sectB and sectD or any other > > order that is indicated by the user. So it is somewhat like top-of-page, > > mid-of-page etc but with a numbering/precedence/sorting (can be named any) > > system that populates the page according to the choice. > > Roughly: > > <--first section--> > > <--second section--> > > <--third section--> > > <--fourth section--> > > <--fifth section--> > > Alp: > >You can implement a weights system, similar to Drupal. In such a > system, each item is given a weight -- the lighter the item floats to > the top, and the heavier items sink to the bottom. Weights can range > from anything (lets take -10 to 10 -- 0 being the default). 1 is > "heavier" than 0, so any item with a weight of 1 sinks below any item > with a weight < 1. -1 is lighter than 0, so it will float above both 0 > and 1. > >This type of system is good if you are not concerned with strict > placing of items, since two items in the same weight category are simply > stacked on top of each other. > > Regards, > Burhan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Converting a string into ASCII and a bit more - newbie
Hi, My question could have quite stright forward answer or the question itself might be silly but being a newbie, I'll ask it anyway. First I am trying to convert each character in a string into their respective ASCII codes and then keep these again in a string. Such as: string : ABCDEFGHIJ, expect to see in the result : 65666768697071727374 Then I would like to further manipulate this result with some math, say add 10 to each pair (the ascii code) so the new result becomes: 75767778798081828384 For my first attempt I tried: $x=1 while ($x<=strlen($string)) { $holder = ord(substr($string, $x, 1)); $result = $result . $holder; } and failed since it takes ages to process and does not really return a proper value/result but repetitive number such as 1.. I have also tried a 'for' example I found which failed as well. I truely hope an expert here could show me some light and point me in the right direction. I have 2 sets installed on my PC as PHPDEV423 and XAMPP 1.4.9 (set to use php4) and it fails in both. Thanks in advance, Alp P.S.: I hope I have posted this in the correct NG -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Can't get results from MySQL via PHP
Hi there, I've been fighting with PHP/MySQL to get proper results but without success. For example: $sql = "SELECT * FROM prod WHERE shortname='Myprog"; $result = mysql_query($sql); >>> returns Resource #7 $list = mysql_fetch_row($result); >>> returns Array and actually the data in the table is a four digit number! The query returns what is expected in MySQL but refuses to do so under php. What is it (or could be) that I am doing wrong/missing? Thanks in advance. Alp -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Can't get results from MySQL via PHP
Thanks for your response, I did finally sove it by changing mysql_fetch_row($result); to mysql_fetch_array($result); and assigning my variable as $somevar = $list['fieldname']; Now I get my real value. Thanks again. Alp "Raditha Dissanayake" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Alp wrote: > > >Hi there, > > > >I've been fighting with PHP/MySQL to get proper results but without success. > >For example: > > $sql = "SELECT * FROM prod WHERE shortname='Myprog"; > > $result = mysql_query($sql); >>> returns Resource #7 > > $list = mysql_fetch_row($result); >>> returns Array > > > >and actually the data in the table is a four digit number! The query returns > >what is expected in MySQL but refuses to do so under php. What is it (or > >could be) that I am doing wrong/missing? > > > > > PHP is behaving exactly as it should. The fact that your table has one > column only is of no relevence you still have to retrieve the first > element of the array that is returned mysql_fetch_row($result); > > -- > Raditha Dissanayake. > -- > http://www.radinks.com/print/card-designer/ | Card Designer Applet > http://www.radinks.com/upload/ | Drag and Drop Upload -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Converting a string into ASCII and a bit more - newbie
Thanks Matthew, Got it going finally. Would you be able to help in my further question? Alp "Matthew Fonda" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > This ought to work: > $string = 'ABCDEFGHIJ'; > $chars = preg_split('//', $string, -1, PREG_SPLIT_NO_EMPTY); > for ($i = 0; $i < count($chars); $i++) { > $chars[$i] = ord($chars[$i]); > //$chars[$i] = ord($chars[$i]) + 10; > } > $string = implode('', $chars); > ?> > > On Sun, 2004-11-14 at 22:32, Alp wrote: > > Hi, > > > > My question could have quite stright forward answer or the question itself > > might be silly but being a newbie, I'll ask it anyway. > > First I am trying to convert each character in a string into their > > respective ASCII codes and then keep these again in a string. Such as: > > string : ABCDEFGHIJ, expect to see in the result : 65666768697071727374 > > Then I would like to further manipulate this result with some math, say add > > 10 to each pair (the ascii code) so the new result becomes: > > 75767778798081828384 > > For my first attempt I tried: > > $x=1 > > while ($x<=strlen($string)) { > > $holder = ord(substr($string, $x, 1)); > > $result = $result . $holder; > > } > > and failed since it takes ages to process and does not really return a > > proper value/result but repetitive number such as 1.. > > I have also tried a 'for' example I found which failed as well. > > I truely hope an expert here could show me some light and point me in the > > right direction. > > I have 2 sets installed on my PC as PHPDEV423 and XAMPP 1.4.9 (set to use > > php4) and it fails in both. > > > > Thanks in advance, > > > > Alp > > P.S.: I hope I have posted this in the correct NG > -- > Regards, > Matthew Fonda -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Multiline data Insert Into table from a generated form?
Hi experts, I'd like your advice on the following as to how to approach/resolve. I'm generating a form based on a user input number, say 3, where 3 lines for input for a few fields are created. What would be the appropriate way to append these 3 seperate lines into the table all at one go? I have tried to name the input fields per its corresponding line number (not sure yet if it properly is working though). I have given the code for the form below. I tried to use a similar approach for the $sql (whit while) but apparently either the form or the sql is failing. Any help, pointers, advice would be highly appreciated. Thanks in advance. Alp Code: print ''; print ''; $i = 1; while ($i <= $tour_days) { print ''; print ''; $days = ("Day 0".$i); print $days; print ''; print ''; print ''; print ''; print ''; print ''; $i++; } print ''; print "\n\n"; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Multiline data Insert Into table from a generated form?
Thank you Mike for your quick reply. I will try to incorporate it into the function I'm using and let you know the result. The function code is also given below. Alp function add_to_database( $tourid, $dayno, $fromto, $bld, $descrip, &$dberror) { //user connection section--begin $username="root"; $password=""; $database="nazardane"; $link = mysql_pconnect("localhost", $username, $password); if ( ! $link ) { $dberror = "Couldn't connect to MySQL server"; return false; } if ( ! mysql_select_db( $database, $link)) { $dberror = mysql_error(); return false; } $sql = "INSERT INTO tour_details ( tour_id, dayno, fromto, bld, descrip ) VALUES ( '$tourid', '$dayno', '$fromto', '$bld', '$descrip' ) )"; if (! mysql_query($sql, $link)) { $dberror = mysql_error(); return false; } return true; } "Mike Smith" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > Code: > > print ' > align="center">'; > > print ''; > > $i = 1; > > while ($i <= $tour_days) { > > print ''; > > print ''; > > $days = ("Day 0".$i); > > print $days; > > print ''; > > print ''; > > print ''; > > print ''; > > print ''; > > print ' > wrap="virtual">'; > > $i++; > > } > > print ''; > > print "\n\n"; > > Change the field names to arrays (i.e. "tourid".$i becomes tourid[] > > When you POST loop through the array: > > while($c=0;$c If($_POST['tourid'][$c]!=""...){ > $sql = "INSERT INTO reservations ('tourid'...) VALUES > ('{$_POST['tourid'][$c]}'...)\n"; > } > } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Multiline data Insert Into table from a generated form?
Hi Mike, PHP returns a parse error indicating the line number for the while (.) ! Code now is: function add_to_database( $tourid, $dayno, $fromto, $bld, $descrip, &$dberror) { //user connection section--begin $username="root"; $password=""; $database="nazardane"; $link = mysql_pconnect("localhost", $username, $password); if ( ! $link ) { $dberror = "Couldn't connect to MySQL server"; return false; } if ( ! mysql_select_db( $database, $link)) { $dberror = mysql_error(); return false; } while ($c=0;$c wrote in message news:[EMAIL PROTECTED] > > Code: > > print ' > align="center">'; > > print ''; > > $i = 1; > > while ($i <= $tour_days) { > > print ''; > > print ''; > > $days = ("Day 0".$i); > > print $days; > > print ''; > > print ''; > > print ''; > > print ''; > > print ''; > > print ' > wrap="virtual">'; > > $i++; > > } > > print ''; > > print "\n\n"; > > Change the field names to arrays (i.e. "tourid".$i becomes tourid[] > > When you POST loop through the array: > > while($c=0;$c If($_POST['tourid'][$c]!=""...){ > $sql = "INSERT INTO reservations ('tourid'...) VALUES > ('{$_POST['tourid'][$c]}'...)\n"; > } > } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Multiline data Insert - Resolved
Hi Mike, Resolved it. Well, actually your code is a 'for' rather than a 'while' which I realized a bit late. :-) And there were two fullstops that needed to be a comma. Now it works. Thanks a lot for your guidance. Alp "Alp" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi Mike, > > PHP returns a parse error indicating the line number for the while (.) ! > Code now is: > function add_to_database( $tourid, $dayno, $fromto, $bld, $descrip, > &$dberror) > { > //user connection section--begin > $username="root"; > $password=""; > $database="nazardane"; > $link = mysql_pconnect("localhost", $username, $password); > if ( ! $link ) > { > $dberror = "Couldn't connect to MySQL server"; > return false; > } > if ( ! mysql_select_db( $database, $link)) > { > $dberror = mysql_error(); > return false; > } > while ($c=0;$c if ($_POST['tourid'][$c]!="" && $_POST['dayno'][$c]!="" && > $_POST['fromto'][$c]!="" && $_POST['bld'][$c]!="" && > $_POST['descrip'][$c]!=""){ >$sql = "INSERT INTO tour_details ('tour_id'. 'dayno', 'fromto', 'bld', > 'descrip') VALUES ('{$_POST['tourid'][$c]}'. '{$_POST['dayno'][$c]}', > '{$_POST['fromto'][$c]}', '{$_POST['bld'][$c]}', > '{$_POST['descrip'][$c]}')\n"; > } > if (! mysql_query($sql, $link)) >{ >$dberror = mysql_error(); >return false; >} > } > $lastinsertid = mysql_insert_id(); > > return true; > } > > Actually the form is posted to itself. What could be the problem now? > > Thanks in advance. > > Alp > > "Mike Smith" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > > Code: > > > print ' > > align="center">'; > > > print ''; > > > $i = 1; > > > while ($i <= $tour_days) { > > > print ''; > > > print ' value="'.$tour_id.'">'; > > > $days = ("Day 0".$i); > > > print $days; > > > print ''; > > > print ''; > > > print ''; > > > print ''; > > > print ''; > > > print ' > > wrap="virtual">'; > > > $i++; > > > } > > > print ''; > > > print "\n\n"; > > > > Change the field names to arrays (i.e. "tourid".$i becomes tourid[] > > > > When you POST loop through the array: > > > > while($c=0;$c > If($_POST['tourid'][$c]!=""...){ > > $sql = "INSERT INTO reservations ('tourid'...) VALUES > > ('{$_POST['tourid'][$c]}'...)\n"; > > } > > } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Script stuck on final ?>
Why would a php script get stuck at the ver last line of code in php/mysql combination? I'm getting a parse error at the very last line. Thanks in advance for your help. Alp -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Script stuck on final ?>
Thanks to both of you. Unfortunately I have found out it was due to another reason: in one function I am trying to insert 3 sets of data into 3 seperate tables. In trying to accomplish that I am using a 'for' loop. The minute I write in the second 'for' loop I loose the page in browser and receive this parse error pointing to the last line of code. Any ideas to how I can overcome this? The loop I am using is given below. Thanks in advance. Alp Code: for ($c=0;$c wrote in message news:[EMAIL PROTECTED] > Why would a php script get stuck at the ver last line of code in php/mysql > combination? I'm getting a parse error at the very last line. > > Thanks in advance for your help. > > Alp -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Script stuck on final ?>
Thanks for pointing it out James. That was it! At least now I do not end up with a blank browser page, but unfortunately I can not achieve what I am trying to do though which is inserting the user input to the relevant tables. I'll keep on trying my luck/witts until I get it... somehow... Alp AND thanks to all of you who persistently tried to get me to check my brackets, etc for consistency! I should have looked closer to the code. "James Kaufman" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On Thu, Feb 03, 2005 at 08:25:43PM +0800, Alp wrote: > > Thanks to both of you. Unfortunately I have found out it was due to another > > reason: in one function I am trying to insert 3 sets of data into 3 seperate > > tables. In trying to accomplish that I am using a 'for' loop. The minute I > > write in the second 'for' loop I loose the page in browser and receive this > > parse error pointing to the last line of code. > > > > Any ideas to how I can overcome this? The loop I am using is given below. > > > > Thanks in advance. > > > > Alp > > Code: > > for ($c=0;$c > if ($_POST['inctourid'][$c]!="" && $_POST['included'][$c]!=""){ > >$sql = "INSERT INTO tour_includes (tour_id, included) VALUES > > ('{$_POST['inctourid'][$c]}', '{$_POST['included'][$c]}')\n"; > > } > > if (! mysql_query($sql, $link)) > >{ > >$dberror = mysql_error(); > >return false; > >} > > // for ($i=0;$i > // if ($_POST['extourid'][$c]!="" && $_POST['excluded'][$c]!=""){ > > // $sql = "INSERT INTO tour_excludes (tour_id, excluded) VALUES > > ('{$_POST['extourid'][$c]}', '{$_POST['excluded'][$c]}')\n"; > > // } > > // if (! mysql_query($sql, $link)) > > // { > > // $dberror = mysql_error(); > > // return false; > > // } > > } // Add closing brace here > > -- > Jim Kaufman > Linux Evangelist > public key 0x6D802619, CISSP# 65668 > http://www.linuxforbusiness.net > --- > The most merciful thing in the world ... is the inability of the human mind to > correlate all its contents. > -- H. P. Lovecraft -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Script stuck on final ?>
Thanks Richard, I thought I wasn't missing one, that is until James pinpointed it! I'm using TextPad which does have syntax dependent text coloring, but unfortunately it does not point out what you are missing such as a closing bracket (unlike Dreamweaver). Alp "Richard Lynch" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Alp wrote: > > Why would a php script get stuck at the ver last line of code in php/mysql > > combination? I'm getting a parse error at the very last line. > > It may help you (now and in the future) to remember that PHP is just a > program, that reads your script, line by line, and then tries to convert > what you typed into an "action" for it to take. > > If it's complaining on the last line, then, most likely, it expecting > something *MORE* from you, based on what you already have typed. > > So you're missing the ending part of something, like an ending " mark, or > an ending ' or an ending } or an ending ) or an ending ] or something of > that nature. > > It's also a good idea to be FANATIC about your alignment of beginning and > ending { } markers -- There are religious arguments about where exactly > they should be placed, but pick whatever seems most reasonable to you and > stick to it, and ALWAYS line them up the same with CONSISTENT indentation. > > Otherwise, you'll spend the rest of your programming life looking for > missing } > > You may also want to get a good color-coding editor. A quick Google for > "PHP Editors" should turn up tons of them. > > -- > Like Music? > http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Script stuck on final ?>
Thanks Jochem. Ctrl+Shift+M is also another great way to catch a mistake. I have never gone through the help before, looks like I should have... Alp "Jochem Maas" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Alp wrote: > > Thanks Richard, > > > > I thought I wasn't missing one, that is until James pinpointed it! > > > > I'm using TextPad which does have syntax dependent text coloring, but > > put your cursor next to a brace - hit CRTL+M, look what happens. :-) > > > unfortunately it does not point out what you are missing such as a closing > > bracket (unlike Dreamweaver). > > (Table)Nightmareweaver. > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Multiline data Insert Into table from a generated form?
Hi Mike, Sorry that the response is a bit late. I will keep in mind to include the whole details of the error next time, sorry for the toruble. Somehow, I just couldn't manage to get all 3 tables updated from a single php file (well, understandable since I'm a beginner) so now I am going through 3 seperate scripts one calling the next page in line. But I really was hoping to cut down on the page travelling since there are (or would mostly be) a few lines of input for each if not none. Maybe I'm trying to re-invent the wheel but I couldn't find a suitable CMS out there that would beeasily modifiable to suit my exact needs and thus set out to put together my own. Intention is to provide an interface so that tour package details could be entered into the DB for use with a generic php/html page that would display all the info available per tour in an orderly manner. So now this info can be entered through several steps. I would still need to find a way to give options to create tables (for html) to the user, i.e. num.of columns, rows, the contents of the header row(s), alignment etc. I know it will take me a long way to accomplish all this but I'm not lucky in finding examples that could show me the way, where/how to start... I will try your suggestions and let you know. Thanks for all your help. Alp "Mike Smith" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Change: > > while ($c=0;$c > to (change the : before $c++ to ;): > > for ($c=0;$c > I think i mentioned the while loop in my first reply. I should have said for. > (See: http://us2.php.net/for, http://us3.php.net/while, > http://us4.php.net/foreach) > > I'm not sure what you mean by "form is posted to itself". Do you have > the function at the top of the page with the form? If so, you can do > something like > > if($_POST['var']){ > > add_to_database( $tourid, $dayno, $fromto, $bld, $descrip, > &$dberror) > //ideally you'd forward to another page to let the user know the form > was received OK... > } else { > > //Show form > > } > > Please post any specific error message you may get, not just "a parse > error", it will save my eyes! > > Thanks, > Mike -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Script stuck on final ?>
Hi Jochem, "Jochem Maas" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Alp wrote: > > Thanks Jochem. Ctrl+Shift+M is also another great way to catch a mistake. I > > have never gone through the help before, looks like I should have... > > thats almost begging for RTFM-like comment ;-) Well, couldn't agree with you more! :-) > but seeing as you have just given me a new shortcut I let it be :-) Phew! So barely saved... :-P > seriously 9 of out 10 editors have a lot more functionality than > the average user knows about I use textpad almost everyday, have done for > at least 2-3 years and the CTRL+SHFT+M combo is news to me. > > cheers. and good luck with php :-) Thanks, and I will need that! Alp -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Multiline data Insert Into table from a generated form?
Hi Chris, Thanks for reminding but until I'm done with the whole thing it is operating on a PC and that's why the username/password are the default. Even the DB name is for testing only. Alp "Christopher Fulton" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > [snip] > > //user connection section--begin > > $username="root"; > > $password=""; > > $database="nazardane"; > [/snip] > > If this is actually your login, I would suggest changing it right away > > [snip] > > while ($c=0;$c [/snip] > > Like Mike already said, that should be a for loop. But, you do have > one other option, that I prefer...A foreach loop. > > foreach($_POST['tourid'] AS $tour_id { > ... now in your code use $tour_id instead of $_POST['tourid'][$c] > } > > -Chris > > ps...You may want to read through the php turorial again. Lots of > helpful information there. http://us2.php.net/tut.php > -- > Christopher Fulton > http://www.fultonfam.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Trying to match two tables' data
Hi experts, Here's the scenario: - 3 lines of data is present in a table - 2 lines of detail lines (corresponding to the above) are needed to be entered into a second table Result needed is: table1line1table1line2table1line3 (as column headers) table2line1table2line2table2line3 (as first line of detail) table2line4table2line5table2line6 (as second line of detail) I might be in a wrong approach in accomplising this and would highly appreciate any corrections. In short, column header data is entered into a table, then number of detail lines are obtained (in general, i.e. 2), the display should show 2 lines of input boxes under each header text in the browser for data entry into these detail lines. Clear as mud? Its getting there for me slowly... Thanks in advance. Alp -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Trying to match two tables' data - Resolved (for now at least)
I have solved it through a sort of nested loop. print ''; $x = 0; while ($x < $colcnt) { $coltitle = mysql_result($prccols,$x,"colhdr"); print ''.$coltitle.''; $x++; } print ''; $i = 1; while ($i <= $pricing_details) { print ''; $c=0; while ($c < $colcnt) { print ''; print ''; print ''; print ''; print ''; print ''; $c++; } Print ''; $i++; } print ''; Thanks anyway. Alp "Alp" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi experts, > > Here's the scenario: > - 3 lines of data is present in a table > - 2 lines of detail lines (corresponding to the above) are needed to be > entered into a second table > > Result needed is: > table1line1table1line2table1line3 (as column headers) > table2line1table2line2table2line3 (as first line of detail) > table2line4table2line5table2line6 (as second line of detail) > > I might be in a wrong approach in accomplising this and would highly > appreciate any corrections. In short, column header data is entered into a > table, then number of detail lines are obtained (in general, i.e. 2), the > display should show 2 lines of input boxes under each header text in the > browser for data entry into these detail lines. > > Clear as mud? Its getting there for me slowly... > > Thanks in advance. > > Alp -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Converting a string into ASCII and a bit more - newbie
Hi Klaus, Thanks you very much both for your quick reply and guidance. Yes, it now works as it should. I have a few further questions all related to the subject if you wouldn't mind. One is: how can I do the following (sort of maths) with a secondary string of ascii values i.e. 25203030 with this result string from the first operation (65666768697071727374) should be processed as (65+25)(66+20)(67+30)(68+30)(69+25)(70+20)(71+30)(72+30)(73+25)(74+20) So it actually is a nested loop but I am clueless how to accomplish this in PHP. Then finally I will convert the resulting ascii values string back into chr's. I think I know how to do this. (Finally). Thanks again for your time and help. Alp -Original Message From: Klaus Reimer- Alp wrote: > $x=1 > while ($x<=strlen($string)) { > $holder = ord(substr($string, $x, 1)); > $result = $result . $holder; > } > and failed since it takes ages to process and does not really return a > proper value/result but repetitive number such as 1.. I think you forgot to increment $x. Add an "$x++" at the end of your loop and it works. And by the way: It's better to write "$result .= $holder" if you want to append a string to another. That's shorter and (more important) faster. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Recall: [PHP] Converting a string into ASCII and a bit more - newbie
The sender would like to recall the message, "[PHP] Converting a string into ASCII and a bit more - newbie". -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php