Re: [PHP-DB] MySQL Array
Try: $query = "INSERT INTO anagrafe (codice,nome, cognome, codicefiscale) VALUES ('" .strtoupper($codicefiscale) ."','{$NOME}','" .strtoupper($cognome) ."','" .strtoupper($co dicefiscale) ."', etc" then mysql_query ( $query ) ; Ignatius - Original Message - From: "Antonio Bernabei" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, December 06, 2002 7:12 PM Subject: Re: [PHP-DB] MySQL Array > Hi, > > I want to insert the upper case of the strings written in the forn, so I put > on the php file called these lines > > $NOME=strtoupper($nome); > > mysql_query ("INSERT INTO anagrafe (codice,nome, cognome, codicefiscale) > > VALUES > ('strtoupper($codicefiscale)','$NOME','strtoupper($cognome)','strtoupper($co > dicefiscale)', ... > > but if $codice if for example abc in field codice I don't get ABC but > uppercase(abc) > while if $nome is mario in the filed nome I get MARIO > > Can I avoid to write extra lines for the conversion? > Thanks > Antonio > > > > > -- > 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] MySQL Array
Hi, I want to insert the upper case of the strings written in the forn, so I put on the php file called these lines $NOME=strtoupper($nome); mysql_query ("INSERT INTO anagrafe (codice,nome, cognome, codicefiscale) VALUES ('strtoupper($codicefiscale)','$NOME','strtoupper($cognome)','strtoupper($co dicefiscale)', ... but if $codice if for example abc in field codice I don't get ABC but uppercase(abc) while if $nome is mario in the filed nome I get MARIO Can I avoid to write extra lines for the conversion? Thanks Antonio -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] MySQL Array
Mark, That was just about it. Once I moved the $c incrementor inside the loop it worked perfectly. $c = 0; print(""); while($row = mysql_fetch_array($dbResult)) { $c++; print("{$row['server_name']}"); if(($c % 4) == 0) { print(""); } } I appreciate you all helping a me (a rookie) through this problem. Art "Mark" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > It's not incrementing $c. Start out with $c=0;, then Add $c++; after > the while line (not after the whole while statement). > > Like this: > $c = 0; > print(""); > while($row = mysql_fetch_array($dbResult)) > $c++; > { > print("{$row['server_name']}"); > if(($c % 4) == 0) > { > print(""); > } > } > > You'll also need a print("") at the end, but I assume > you knew that... > > --- "Chevalier, Arthur" <[EMAIL PROTECTED]> wrote: > > You are right about my query. I am only pulling down one column. > > > > As you guys can probably tell I am pretty inexperienced with this. > > I tried > > what you said and still got the same results. > > > > Here are snippets of my code and maybe this will depict what I am > > doing > > wrong: > > > > After creating the connection: > > > > $query = "select server_name from servers where midtier = > > '$server'"; > > $dbResult = mysql_query($query,$dblink); > > > > $c = 1; > > print(""); > > while($row = mysql_fetch_array($dbResult)) > > { > > print("{$row['server_name']}"); > > if(($c % 4) == 0) > > { > > print(""); > > } > > } > > > > > > > > -Original Message- > > From: 1LT John W. Holmes [mailto:[EMAIL PROTECTED]] > > Sent: Thursday, December 05, 2002 3:26 PM > > To: Ryan Jameson (USA); Art Chevalier; [EMAIL PROTECTED] > > Subject: Re: [PHP-DB] MySQL Array > > > > I think he meant that he is only pulling one column, i.e. "field1" > > with each > > mysql_fetch_array and he wants that in four columns. > > > > $c = 1; > > echo ""; > > while($ar = mysql_fetch_array($result)) > > { > > echo "{$ar['field1']}"; > > if(($c % 4) == 0) { echo ""; } > > } > > > > You'll have to account for incomplete rows and clean up the output, > > but > > hopefully that gives you an idea. > > > > ---John Holmes... > > > > - Original Message - > > From: "Ryan Jameson (USA)" <[EMAIL PROTECTED]> > > To: "Art Chevalier" <[EMAIL PROTECTED]>; > > <[EMAIL PROTECTED]> > > Sent: Thursday, December 05, 2002 3:05 PM > > Subject: RE: [PHP-DB] MySQL Array > > > > > > while ($ar = mysql_fetch_array($rs)) > > echo "". > > $ar['field1']."".$ar['field2'].""; > > > > > > Make sense? > > > > -Original Message- > > From: Art Chevalier [mailto:[EMAIL PROTECTED]] > > Sent: Thursday, December 05, 2002 12:44 PM > > To: [EMAIL PROTECTED] > > Subject: [PHP-DB] MySQL Array > > > > > > Hello, > > > > I am pulling one column out of a MySQL table in an array. I want > > to place > > each element into a HTML table 4 rows across. I am currently doing > > this > > with the mysql_fetch_array() function. How can I pull out 4 array > > elements > > in one pass through a while loop? > > > > Thanks > > > > Art Chevalier > > > > > > > > -- > > 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 Database Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > = > Mark Weinstock > [EMAIL PROTECTED] > *** > You can't demand something as a "right" unless you are willing to fight to death to defend everyone else's right to the same thing. > -Stolen from the now-defunct Randy's Random mailing list. > *** > > __ > Do you Yahoo!? > Yahoo! Mail Plus - Powerful. Affordable. Sign up now. > http://mailplus.yahoo.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] MySQL Array
It's not incrementing $c. Start out with $c=0;, then Add $c++; after the while line (not after the whole while statement). Like this: $c = 0; print(""); while($row = mysql_fetch_array($dbResult)) $c++; { print("{$row['server_name']}"); if(($c % 4) == 0) { print(""); } } You'll also need a print("") at the end, but I assume you knew that... --- "Chevalier, Arthur" <[EMAIL PROTECTED]> wrote: > You are right about my query. I am only pulling down one column. > > As you guys can probably tell I am pretty inexperienced with this. > I tried > what you said and still got the same results. > > Here are snippets of my code and maybe this will depict what I am > doing > wrong: > > After creating the connection: > > $query = "select server_name from servers where midtier = > '$server'"; > $dbResult = mysql_query($query,$dblink); > > $c = 1; > print(""); > while($row = mysql_fetch_array($dbResult)) > { > print("{$row['server_name']}"); > if(($c % 4) == 0) > { > print(""); > } > } > > > > -Original Message- > From: 1LT John W. Holmes [mailto:[EMAIL PROTECTED]] > Sent: Thursday, December 05, 2002 3:26 PM > To: Ryan Jameson (USA); Art Chevalier; [EMAIL PROTECTED] > Subject: Re: [PHP-DB] MySQL Array > > I think he meant that he is only pulling one column, i.e. "field1" > with each > mysql_fetch_array and he wants that in four columns. > > $c = 1; > echo ""; > while($ar = mysql_fetch_array($result)) > { > echo "{$ar['field1']}"; > if(($c % 4) == 0) { echo ""; } > } > > You'll have to account for incomplete rows and clean up the output, > but > hopefully that gives you an idea. > > ---John Holmes... > > - Original Message - > From: "Ryan Jameson (USA)" <[EMAIL PROTECTED]> > To: "Art Chevalier" <[EMAIL PROTECTED]>; > <[EMAIL PROTECTED]> > Sent: Thursday, December 05, 2002 3:05 PM > Subject: RE: [PHP-DB] MySQL Array > > > while ($ar = mysql_fetch_array($rs)) > echo "". > $ar['field1']."".$ar['field2'].""; > > > Make sense? > > -Original Message- > From: Art Chevalier [mailto:[EMAIL PROTECTED]] > Sent: Thursday, December 05, 2002 12:44 PM > To: [EMAIL PROTECTED] > Subject: [PHP-DB] MySQL Array > > > Hello, > > I am pulling one column out of a MySQL table in an array. I want > to place > each element into a HTML table 4 rows across. I am currently doing > this > with the mysql_fetch_array() function. How can I pull out 4 array > elements > in one pass through a while loop? > > Thanks > > Art Chevalier > > > > -- > 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 Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > = Mark Weinstock [EMAIL PROTECTED] *** You can't demand something as a "right" unless you are willing to fight to death to defend everyone else's right to the same thing. -Stolen from the now-defunct Randy's Random mailing list. *** __ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] MySQL Array
You are right about my query. I am only pulling down one column. As you guys can probably tell I am pretty inexperienced with this. I tried what you said and still got the same results. Here are snippets of my code and maybe this will depict what I am doing wrong: After creating the connection: $query = "select server_name from servers where midtier = '$server'"; $dbResult = mysql_query($query,$dblink); $c = 1; print(""); while($row = mysql_fetch_array($dbResult)) { print("{$row['server_name']}"); if(($c % 4) == 0) { print(""); } } -Original Message- From: 1LT John W. Holmes [mailto:[EMAIL PROTECTED]] Sent: Thursday, December 05, 2002 3:26 PM To: Ryan Jameson (USA); Art Chevalier; [EMAIL PROTECTED] Subject: Re: [PHP-DB] MySQL Array I think he meant that he is only pulling one column, i.e. "field1" with each mysql_fetch_array and he wants that in four columns. $c = 1; echo ""; while($ar = mysql_fetch_array($result)) { echo "{$ar['field1']}"; if(($c % 4) == 0) { echo ""; } } You'll have to account for incomplete rows and clean up the output, but hopefully that gives you an idea. ---John Holmes... - Original Message - From: "Ryan Jameson (USA)" <[EMAIL PROTECTED]> To: "Art Chevalier" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Thursday, December 05, 2002 3:05 PM Subject: RE: [PHP-DB] MySQL Array while ($ar = mysql_fetch_array($rs)) echo "". $ar['field1']."".$ar['field2'].""; Make sense? -Original Message- From: Art Chevalier [mailto:[EMAIL PROTECTED]] Sent: Thursday, December 05, 2002 12:44 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] MySQL Array Hello, I am pulling one column out of a MySQL table in an array. I want to place each element into a HTML table 4 rows across. I am currently doing this with the mysql_fetch_array() function. How can I pull out 4 array elements in one pass through a while loop? Thanks Art Chevalier -- 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 Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] MySQL Array
I think he meant that he is only pulling one column, i.e. "field1" with each mysql_fetch_array and he wants that in four columns. $c = 1; echo ""; while($ar = mysql_fetch_array($result)) { echo "{$ar['field1']}"; if(($c % 4) == 0) { echo ""; } } You'll have to account for incomplete rows and clean up the output, but hopefully that gives you an idea. ---John Holmes... - Original Message - From: "Ryan Jameson (USA)" <[EMAIL PROTECTED]> To: "Art Chevalier" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Thursday, December 05, 2002 3:05 PM Subject: RE: [PHP-DB] MySQL Array while ($ar = mysql_fetch_array($rs)) echo "". $ar['field1']."".$ar['field2'].""; Make sense? -Original Message- From: Art Chevalier [mailto:[EMAIL PROTECTED]] Sent: Thursday, December 05, 2002 12:44 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] MySQL Array Hello, I am pulling one column out of a MySQL table in an array. I want to place each element into a HTML table 4 rows across. I am currently doing this with the mysql_fetch_array() function. How can I pull out 4 array elements in one pass through a while loop? Thanks Art Chevalier -- 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 Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] MySQL Array
Why don't you post the actual data you are pulling FROM the Db.. then show HOW you want it formatted. Might be better for us to give you a solution or something. Aaron -Original Message- From: Art Chevalier [mailto:[EMAIL PROTECTED]] Sent: December 5, 2002 3:21 PM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] MySQL Array Yes that makes sense, but it is pretty much the same thing I was doing and it's producing the same results. Its basically putting the first element in all 4 table cells. The thing is...I am only selecting from one field. Im trying to get the 4 elements of the column with each pass. So in essence I am trying to get the pointer to move down the array 4 positions within one pass through the loop. If I had any kind of logicl skills I probably could get it:) Art "Ryan Jameson" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... while ($ar = mysql_fetch_array($rs)) echo "". $ar['field1']."".$ar['field2'].""; Make sense? -Original Message- From: Art Chevalier [mailto:[EMAIL PROTECTED]] Sent: Thursday, December 05, 2002 12:44 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] MySQL Array Hello, I am pulling one column out of a MySQL table in an array. I want to place each element into a HTML table 4 rows across. I am currently doing this with the mysql_fetch_array() function. How can I pull out 4 array elements in one pass through a while loop? Thanks Art Chevalier -- 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 Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] MySQL Array
Yes that makes sense, but it is pretty much the same thing I was doing and it's producing the same results. Its basically putting the first element in all 4 table cells. The thing is...I am only selecting from one field. Im trying to get the 4 elements of the column with each pass. So in essence I am trying to get the pointer to move down the array 4 positions within one pass through the loop. If I had any kind of logicl skills I probably could get it:) Art "Ryan Jameson" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... while ($ar = mysql_fetch_array($rs)) echo "". $ar['field1']."".$ar['field2'].""; Make sense? -Original Message- From: Art Chevalier [mailto:[EMAIL PROTECTED]] Sent: Thursday, December 05, 2002 12:44 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] MySQL Array Hello, I am pulling one column out of a MySQL table in an array. I want to place each element into a HTML table 4 rows across. I am currently doing this with the mysql_fetch_array() function. How can I pull out 4 array elements in one pass through a while loop? Thanks Art Chevalier -- 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] MySQL Array
while ($ar = mysql_fetch_array($rs)) echo "". $ar['field1']."".$ar['field2'].""; Make sense? -Original Message- From: Art Chevalier [mailto:[EMAIL PROTECTED]] Sent: Thursday, December 05, 2002 12:44 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] MySQL Array Hello, I am pulling one column out of a MySQL table in an array. I want to place each element into a HTML table 4 rows across. I am currently doing this with the mysql_fetch_array() function. How can I pull out 4 array elements in one pass through a while loop? Thanks Art Chevalier -- 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] MySQL Array
Hello, I am pulling one column out of a MySQL table in an array. I want to place each element into a HTML table 4 rows across. I am currently doing this with the mysql_fetch_array() function. How can I pull out 4 array elements in one pass through a while loop? Thanks Art Chevalier -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php