Forums | MacLife
You are not logged in.
#1 2005-02-23 6:15 pm
- enviousltd
- Member
- Registered: 2005-02-23
- Posts: 11
PHP & MYSQL problem. please help.
Hi I've got a problem with my code.
Basically, I want to display a number of products but I do not want the colours of the products to repeat themselves. The sizes of each product are in a drop down. I have managed to remove any duplicate colour but it wont pick up different sizes. below is a copy of my code:
-----------------------------------------------------
<? $result9 = mysql_query("SELECT ProductID, VariationColourName, VariationID, VariationPrice, VariationCode FROM ProductVariations WHERE ProductID='$ProductID' AND Lapsed='0' ORDER BY VariationColourName",$db);?>
<?
$colourass = "nodata";
while ($myrow9 = mysql_fetch_array($result9)) {
?>
<form action="productdetails.php" name="basket" onsubmit="return validateForm(this);">
<INPUT TYPE="hidden" name="ID" value="<? echo $CategoryName;?>" size="30">
<INPUT TYPE="hidden" name="CategoryName" value="<? echo $CategoryName;?>" size="30">
<INPUT TYPE="hidden" name="CatID" value="<? echo $CatID;?>" size="30">
<INPUT TYPE="hidden" name="SubCatID" value="<? echo $SubCatID;?>" size="30">
<INPUT TYPE="hidden" name="SubSubCatID" value="<? echo $SubSubCatID;?>" size="30">
<INPUT TYPE="hidden" name="VariationID" value="<? echo $myrow9["VariationID"];?>" size="30">
<INPUT TYPE="hidden" name="ProductID" value="<? echo $myrow9["ProductID"];?>" size="30">
<INPUT TYPE="hidden" name="Price" value="<? echo $myrow9["VariationPrice"];?>" size="30">
<INPUT TYPE="hidden" name="VariationCode" value="<? echo $myrow9["VariationCode"];?>" size="30">
<? $varID = $myrow9["ProductID"];
$tempy = $myrow9 ["VariationColourName"];
if ($tempy == $colourass) { ?>
<? } else { ?>
<tr valign="top">
<td background="images/sb.bg1.gif"><div align="center">
<? echo $myrow9 ["VariationCode"];?></div>
</td>
<td height="34" background="images/sb.bg1.gif">
<div align="center"><? echo $myrow9 ["VariationColourName"]; ?> </div>
<? $varcolour = $myrow9 ["VariationColourName"];?>
</td>
<td background="images/sb.bg1.gif"><? $result10 = mysql_query("SELECT VariationSize FROM ProductVariations WHERE ProductID='$ProductID' AND Lapsed='0' AND VariationColourName='$varcolour'",$db);?>
<div align="center">
<select name="size" size="1" STYLE="font-face: verdana; font-size: xx-small; color: #000000; width:60px">
<option value="">Select Size</option>
<? while ($myrow10 = mysql_fetch_array($result10)) {?>
<option value="<? echo $myrow10["VariationSize"];?>"><? echo $myrow10["VariationSize"];?></option>
<? }?>
</select>
</div>
</td>
<td background="images/sb.bg1.gif"><div align="center"><span id="normal">
<INPUT name="Qty" TYPE="text" class="smallerTextBox" value="1" size="10" maxlength="2">
</span></div></td>
<td background="images/sb.bg1.gif"><div align="center">
<input name="basket" type="image" value="1" src="images/basket.gif">
</div></td>
<td background="images/sb.bg1.gif"><div align="center"><a href="productdetails.php?VariationID=<? echo $myrow9["VariationID"] ?>&CatID=<? echo $CatID;?>&SubCatID=<? echo $SubCatID;?>&SubSubCatID=<? echo $SubSubCatID;?>&CategoryName=<? echo $CategoryName;?>&Price=<? echo $Price;?>&ID2=<? echo $prodID;?>&ProductID=<? echo $prodID;?>&Qty=1"><img src="images/wishlist.gif" width="14" height="19" border="0"></a></div></td>
</tr>
<? } ?>
</form>
<? $colourass = $myrow9 ["VariationColourName"]; ?>
<? }?>
</table></td>
</tr>
--------------------------------------------------------------
please help :'-(
Offline
#2 2005-02-23 6:33 pm
Re: PHP & MYSQL problem. please help.
Aaah, that's hard to read... the [ code] tag is your friend!
Last edited by maxintosh (2005-02-23 6:33 pm)
Offline
#3 2005-02-23 6:43 pm
- enviousltd
- Member
- Registered: 2005-02-23
- Posts: 11
Re: PHP & MYSQL problem. please help.
here is code again http://www.maridiadesign.com/firas/code.txt
------------------------------------------------
Offline
#4 2005-02-24 3:05 am
Re: PHP & MYSQL problem. please help.
Cleaned it up a bit for you, but next time, please consider submitting cleaner code if you want people to help you:
Code:
<? $result9 = mysql_query("SELECT ProductID
, VariationColourName
, VariationID
, VariationPrice
, VariationCode
FROM ProductVariations
WHERE ProductID='$ProductID'
AND Lapsed='0'
ORDER BY VariationColourName",$db);?>
<?
$colourass = "nodata";
while ($myrow9 = mysql_fetch_array($result9)) {
?>
<form action="productdetails.php" name="basket" onsubmit="return validateForm(this);">
<INPUT TYPE="hidden" name="ID" value="<? echo $CategoryName;?>" size="30">
<INPUT TYPE="hidden" name="CategoryName" value="<? echo $CategoryName;?>" size="30">
<INPUT TYPE="hidden" name="CatID" value="<? echo $CatID;?>" size="30">
<INPUT TYPE="hidden" name="SubCatID" value="<? echo $SubCatID;?>" size="30">
<INPUT TYPE="hidden" name="SubSubCatID" value="<? echo $SubSubCatID;?>" size="30">
<INPUT TYPE="hidden" name="VariationID" value="<? echo $myrow9["VariationID"];?>" size="30">
<INPUT TYPE="hidden" name="ProductID" value="<? echo $myrow9["ProductID"];?>" size="30">
<INPUT TYPE="hidden" name="Price" value="<? echo $myrow9["VariationPrice"];?>" size="30">
<INPUT TYPE="hidden" name="VariationCode" value="<? echo $myrow9["VariationCode"];?>" size="30">
<? $varID = $myrow9["ProductID"];
$tempy = $myrow9 ["VariationColourName"];
if ($tempy == $colourass) { ?>
<? } else { ?>
<tr valign="top">
<td background="images/sb.bg1.gif"><div align="center">
<? echo $myrow9 ["VariationCode"];?></div>
</td>
<td height="34" background="images/sb.bg1.gif">
<div align="center"><? echo $myrow9 ["VariationColourName"]; ?> </div>
<? $varcolour = $myrow9 ["VariationColourName"];?>
</td>
<td background="images/sb.bg1.gif"><? $result10 = mysql_query("SELECT VariationSize FROM ProductVariations WHERE ProductID='$ProductID' AND Lapsed='0' AND VariationColourName='$varcolour'",$db);?>
<div align="center">
<select name="size" size="1" STYLE="font-face: verdana; font-size: xx-small; color: #000000; width:60px">
<option value="">Select Size</option>
<? while ($myrow10 = mysql_fetch_array($result10)) {?>
<option value="<? echo $myrow10["VariationSize"];?>"><? echo $myrow10["VariationSize"];?></option>
<? }?>
</select>
</div>
</td>
<td background="images/sb.bg1.gif"><div align="center"><span id="normal">
<INPUT name="Qty" TYPE="text" class="smallerTextBox" value="1" size="10" maxlength="2">
</span></div></td>
<td background="images/sb.bg1.gif"><div align="center">
<input name="basket" type="image" value="1" src="images/basket.gif">
</div></td>
<td background="images/sb.bg1.gif"><div align="center"><a href="productdetails.php?VariationID=<? echo $myrow9["VariationID"] ?>&CatID=<? echo $CatID;?>&SubCatID=<? echo $SubCatID;?>&SubSubCatID=<? echo $SubSubCatID;?>&CategoryName=<? echo $CategoryName;?>&Price=<? echo $Price;?>&ID2=<? echo $prodID;?>&ProductID=<? echo $prodID;?>&Qty=1"><img src="images/wishlist.gif" width="14" height="19" border="0"></a></div></td>
</tr>
<? } ?>
</form>
<? $colourass = $myrow9 ["VariationColourName"]; ?>
<? }?>
</table></td>
</tr>,xtG
.tsooJ
Offline
#5 2005-02-24 3:54 am
Re: PHP & MYSQL problem. please help.
Okay, first off: sorry to say it, but your code is a freaking mess. You really shouldn't intertwine PHP and HTML like that, except (maybe) fro tiny trivial things. This is not a tiny, trivial page.
First, rewrite the whole thing in PHP (you're lucky, I seem to be having a very slow work day.
). Shorter lines help with overview, put your queries in strings at the top where you can easily find them:
Code:
$query9 = "\
select\
ProductID,\
VariationColourName,\
VariationID,\
VariationPrice,\
VariationCode\
from ProductVariations\
where ProductID='$ProductID'\
and Lapsed='0'\
order by VariationColourName";
$query10 = "\
select VariationSize\
from ProductVariations\
where ProductID='$ProductID'\
and Lapsed='0'\
and VariationColourName='$varcolour'";I made all your SQL keywords lower case. It doesn't matter, if you like them upper cased, that's just fine, but I happen to think that lower case is easier on the eyes. SQL is case-insensitive, so use what you like.
Code:
$result9 = mysql_query($query9, $db);
$colourass = "nodata";
while ($myrow9 = mysql_fetch_array($result9)) {
print("<form action=\"productdetails.php\" name=\"basket\" onsubmit=\"return validateForm(this);\">");
print("<INPUT TYPE=\"hidden\" name=\"ID\" value=\"" . $CategoryName . "\" size=\"30\">");
print("<INPUT TYPE=\"hidden\" name=\"CategoryName\" value=\"" . $CategoryName . "\" size=\"30\">");
print("<INPUT TYPE=\"hidden\" name=\"CatID\" value=\"" . $CatID . "\" size=\"30\">");
print("<INPUT TYPE=\"hidden\" name=\"SubCatID\" value=\"" . $SubCatID . "\" size=\"30\">");
print("<INPUT TYPE=\"hidden\" name=\"SubSubCatID\" value=\"" . $SubSubCatID . "\" size=\"30\">");
print("<INPUT TYPE=\"hidden\" name=\"VariationID\" value=\"" . $myrow9["VariationID"] . "\" size=\"30\">");
print("<INPUT TYPE=\"hidden\" name=\"ProductID\" value=\"" . $myrow9["ProductID"] . "\" size=\"30\">");
print("<INPUT TYPE=\"hidden\" name=\"Price\" value=\"" . $myrow9["VariationPrice"] . "\" size=\"30\">");
print("<INPUT TYPE=\"hidden\" name=\"VariationCode\" value=\"" . $myrow9["VariationCode"] . "\" size=\"30\">");Again with the uppercase... You do realise that XHTML dictates that all tags should be in lower case, right?
Code:
$varID = $myrow9["ProductID"];
$tempy = $myrow9 ["VariationColourName"];
if ($tempy == $colourass) {
} else {Ouch. This is bad form. Very bad. Consider replacing it with this:
Code:
if (!($tempy == $colourass)) {Anyway. On we go:
Code:
print("<tr valign=\"top\">");
print("<td background=\"images/sb.bg1.gif\"><div align=\"center\">");
print($myrow9["VariationCode"] . "</div>");
print("</td>");
print("<td height=\"34\" background=\"images/sb.bg1.gif\">");
print("<div align=\"center\">" . $myrow9["VariationColourName"] . "</div>");
$varcolour = $myrow9["VariationColourName"];
print("</td>");
print("<td background=\"images/sb.bg1.gif\">");
$result10 = mysql_query($query10, $db);
print("<div align=\"center\">");
print("<select name=\"size\" size=\"1\" STYLE=\"font-face: verdana; font-size: xx-small; color: #000000; width:60px\">");
print("<option value=\"\">Select Size</option>");Whoa, whoa..! Hold it a minute. You got print statements, assignments, DB queries, all bunched together and mixed in between each other here. Also, you've got inline styles in your HTML, deprecated tag attributes... You'll really want to clean this all up if you want to debug your code a little. Bring some of that stuff to your stylesheet(s). Put your assignments and DB queries together at the top, maybe.
Code:
while ($myrow10 = mysql_fetch_array($result10))
print("<option value=\"" . $myrow10["VariationSize"] . "\">" . $myrow10["VariationSize"] . "</option>");
print("</select>");
print("</div>");
print("</td>");
print("<td background=\"images/sb.bg1.gif\"><div align=\"center\"><span id=\"normal\">");
print("<INPUT name=\"Qty\" TYPE=\"text\" class=\"smallerTextBox\" value=\"1\" size=\"10\" maxlength=\"2\">");
print("</span></div></td>");
print("<td background=\"images/sb.bg1.gif\"><div align=\"center\">");
print("<input name=\"basket\" type=\"image\" value=\"1\" src=\"images/basket.gif\">");
print("</div></td>");
print("<td background=\"images/sb.bg1.gif\"><div align=\"center\">");
print("<a href="productdetails.php?VariationID=" . $myrow9["VariationID"]);
print("&CatID=" . $CatID . "&SubCatID=" . $SubCatID . "&SubSubCatID=" . $SubSubCatID);
print("&CategoryName=" . $CategoryName . "&Price=" . $Price . "&ID2" . $prodID);
print("&ProductID=" . $prodID . "&Qty=1\">");
print("<img src=\"images/wishlist.gif\" width=\"14\" height=\"19\" border=\"0\"></a></div></td>");
print("</tr>");
}
print("</form>");
$colourass = $myrow9["VariationColourName"];
}
print("</table></td>");
print("</tr>");Okay, that's about all I can help you with right now. Try to write cleaner code, it'll make it easier to debug. And if you can rephrase your question about the colours and the sizes a bit, and perhaps elaborate some on the structure of your database, perhaps I can help with the original question, too.
,xtG
.tsooJ
Offline
#6 2005-02-24 6:36 am
- enviousltd
- Member
- Registered: 2005-02-23
- Posts: 11
Re: PHP & MYSQL problem. please help.
Alien thank you very much for that i have been in a mess with that page. My original question is
I have several products which have several different sizes...... so there is colour and size variations. I want to create a drop down list for the sizes for each colour without any duplicates. so for example
RED SIZES 1 2 3 4 5 6 7 SHOULD BE IN A DROP LIST AND EACH SIZE CAN BE ADDED TO THE BASKET AS A DIFFERENT PRODUCT. AT THE MOMENT IT IS NOT RECOGNISING THE DIFFERENT SIZES AND SEEMS TO GRAB ONLY ONE SIZE IRRESPECTIVE OF WHAT SIZE YOU CHOOSE FROM THE LIST.
MORE THAN ANYTHING I WOULD PREFER IT TO HAVE A COLOUR DROP DOWN SO WHEN IT REFRESHES IT TELLS US WHAT SIZES ARE AVAILABLE AND POPULATES THE SECOND SIZE DROP DOWN. I WOULD REALLY APPRECIATE SOME FEEDBACK
I AHVE BEEN TRYING DISTINCT FUNCTION ETC AND LOOPS BUT HAVING NO JOY
Offline
#7 2005-02-24 7:24 am
- The New Guy
- Member

- From: Left of left
- Registered: 2000-10-18
- Posts: 3422
Re: PHP & MYSQL problem. please help.
Why not intertwine PHP and HTML? Beats escaping every string you want to print.
The car of the future is a train with a bike waiting at the other end.
Offline
#8 2005-02-24 8:39 am
- disturbed_child
- Member

- From: a dark alleyway
- Registered: 2003-02-05
- Posts: 766
- Website
Re: PHP & MYSQL problem. please help.
The New Guy wrote:
Why not intertwine PHP and HTML? Beats escaping every string you want to print.
Not necessarily... If you do something like this:
Code:
$me = <<<WHOA i cantype "whatever" and 'however' i want \in /here and nothing will happen... WHOA;
Offline
#9 2005-02-24 8:49 am
Re: PHP & MYSQL problem. please help.
The New Guy wrote:
Why not intertwine PHP and HTML? Beats escaping every string you want to print.
Because it becomes a mess very quickly and that makes it very difficult to debug.
If you write PHP that just happens to output HTML, write PHP. If you write HTML that just happens to use a smidgen (but no more than a smidgen!) of PHP here and there, write HTML. But don't try to do both, because it quickly becomes unwieldly. See above.
enviousltd wrote:
Alien thank you very much for that i have been in a mess with that page. My original question is
I have several products which have several different sizes...... so there is colour and size variations. I want to create a drop down list for the sizes for each colour without any duplicates. so for example
RED SIZES 1 2 3 4 5 6 7 SHOULD BE IN A DROP LIST AND EACH SIZE CAN BE ADDED TO THE BASKET AS A DIFFERENT PRODUCT. AT THE MOMENT IT IS NOT RECOGNISING THE DIFFERENT SIZES AND SEEMS TO GRAB ONLY ONE SIZE IRRESPECTIVE OF WHAT SIZE YOU CHOOSE FROM THE LIST.
MORE THAN ANYTHING I WOULD PREFER IT TO HAVE A COLOUR DROP DOWN SO WHEN IT REFRESHES IT TELLS US WHAT SIZES ARE AVAILABLE AND POPULATES THE SECOND SIZE DROP DOWN. I WOULD REALLY APPRECIATE SOME FEEDBACK
I AHVE BEEN TRYING DISTINCT FUNCTION ETC AND LOOPS BUT HAVING NO JOY
Okay. So, you've got the following columns in your table, right?
Code:
table ProductVariations {
ProductID,
VariationSize,
VariationColourName,
VariationID,
VariationPrice,
VariationCode
};Now, looks to me like you have some redundancy there, and the root of your problem is with the basic design of your database. But, assuming you can't/won't want to change your database, let's run with this. You want a table like this:
Code:
+-------+------+---------+ | A0001 | Red | 1/2/3/4 | +-------+------+---------+ | A0002 | Blue | 2/4 | +-------+------+---------+
Right?
Well, what you want to do is, once you've collected the individual variations ($query9), for each variation, you collect the available sizes, by selecting on the exact VariationID and VariationColourName, but allowing for all VariationSize values:
Code:
select VariationSize from ProductVariations where VariationID = '$variation_id' and VariationColourName = '$variation_colour_name' and VariationSize = any;
That should return an array of sizes that are available for the specified VariationID/VariationColourname combination.
Assuming ProductID is your primary key, selecting on that is pointless, because the ProductID would be different for eacht size variation.
,xtG
.tsooJ
,xtG
.tsooJ
Offline
#10 2005-02-24 9:39 am
- enviousltd
- Member
- Registered: 2005-02-23
- Posts: 11
Re: PHP & MYSQL problem. please help.
I AM GONNA CHECK THIS OUT ALIEN THANK YOU VERY MUCH
Offline
#11 2005-02-24 10:04 am
- The New Guy
- Member

- From: Left of left
- Registered: 2000-10-18
- Posts: 3422
Re: PHP & MYSQL problem. please help.
Here's how I like to structure my PHP: Get everything set up at the beginning of the document; all data loaded into variables, all errors checked out, all cases determined and loaded into variables.
Then, if I'm outputting HTML, I use switch or if/else statements to display things, kind like this:
Code:
<?
//Check for errors
//set $error = true if there were errors
//store error text in $error_code
?>
<html>
<body>
<? if ($error == true) { ?>
<h1>There was an error because <?= $error code ?></h1>
<? } else { ?>
<h1>No errors</h1>
<? } ?>
</body>
</html>Tips appreciated.
Last edited by The New Guy (2005-02-24 10:05 am)
The car of the future is a train with a bike waiting at the other end.
Offline
#12 2005-02-24 10:56 am
Re: PHP & MYSQL problem. please help.
Well, that's fine and dandy with such a simple example, but try that with deeply nested structures, and see it you can still tell what's what and where it is.
Still, there's redundancy in that code: the <h1> and </h1> tags are output regardless of whether there was or wasn't an error. Better lift them out of the if() statement.
And you might as well assign the error messages to an array and output the contents depending on the error:
Code:
<?
$errors = array(
0 => "There were no errors",
1 => "File error",
2 => "Network error",
3 => "User error",
9 => "Unknown error"
);
// Check for errors and set $error to the correct value
?>
<html>
<body>
<h1><?= $errors[$error] ?></h1>
</body>
</html>,xtG
.tsooJ
Offline
#13 2005-02-24 11:27 am
Re: PHP & MYSQL problem. please help.
On error checking I'll log errors by form element name, so $error['email'] will contain why the email failed validation, $error['name'] will contain why the name failed validation.
During the data validation phase I set error messages depending upon why the routine kicked it out.
That way I can present all the errors at one time and also go down and highlight form feilds to show where errors need to be fixed because the error name corresponds to the form element name.
Offline
#14 2005-02-24 1:15 pm
Re: PHP & MYSQL problem. please help.
disturbed_child wrote:
The New Guy wrote:
Why not intertwine PHP and HTML? Beats escaping every string you want to print.
Not necessarily... If you do something like this:
Code:
$me = <<<WHOA i cantype "whatever" and 'however' i want \in /here and nothing will happen... WHOA;
I've got a question about that. . . I write block strings (or whatever you call them, the <<< thing) all the time in my PHP programs. But It seems that all editors I've seen don't support that (i.e., syntax coloring doesn't relect it as a string, and typeing an apostrophe will really mess up your syntax coloring if you don't type another one down the road), and I don't see other people use it in their scripts much. . .
Are block strings bad form in any way...? 
_Nik
Last edited by GreenAlge (2005-02-24 1:16 pm)
Offline
#15 2005-02-24 1:27 pm
- The New Guy
- Member

- From: Left of left
- Registered: 2000-10-18
- Posts: 3422
Re: PHP & MYSQL problem. please help.
Gipetto wrote:
On error checking I'll log errors by form element name, so $error['email'] will contain why the email failed validation, $error['name']will contain why the name failed validation.
During the data validation phase I set error messages depending upon why the routine kicked it out.
That way I can present all the errors at one time and also go down and highlight form feilds to show where errors need to be fixed because the error name corresponds to the form element name.
I do that too. The previous example was just that; an example.
The car of the future is a train with a bike waiting at the other end.
Offline
#16 2005-02-24 3:31 pm
Re: PHP & MYSQL problem. please help.
Alien wrote:
The New Guy wrote:
Why not intertwine PHP and HTML? Beats escaping every string you want to print.
Because it becomes a mess very quickly and that makes it very difficult to debug.
If you write PHP that just happens to output HTML, write PHP. If you write HTML that just happens to use a smidgen (but no more than a smidgen!) of PHP here and there, write HTML. But don't try to do both, because it quickly becomes unwieldly.
Exactly.
But... there is an even better way than that. Seperate (business)logic and display completely. Use an existing template engine or your own. Either way, you are not breaking your php because you didn't escape a print correctly. And better yet, you don't have to sort through a mess of garbled php/html just to change the layout. Additionally, seperating the styles into a CSS sheet is a good idea as well. As it stands now you are declaring styles from a php page. Not effcient.
PHP:
Code:
$template->assign("sizes", {your array containing the results of the query});TPL:
Code:
<select name="size" class="sizeMenu">
<option value="">Select Size</option>
{html_options options=$sizes.VariationSize}
</select>CSS:
Code:
select.sizeMenu { font-face: verdana; font-size: xx-small; color: #000000; width:60px; }Offline
#17 2005-02-25 12:55 am
Re: PHP & MYSQL problem. please help.
GreenAlge wrote:
disturbed_child wrote:
The New Guy wrote:
Why not intertwine PHP and HTML? Beats escaping every string you want to print.
Not necessarily... If you do something like this:
Code:
$me = <<<WHOA i cantype "whatever" and 'however' i want \in /here and nothing will happen... WHOA;I've got a question about that. . . I write block strings (or whatever you call them, the <<< thing) all the time in my PHP programs. But It seems that all editors I've seen don't support that (i.e., syntax coloring doesn't relect it as a string, and typeing an apostrophe will really mess up your syntax coloring if you don't type another one down the road), and I don't see other people use it in their scripts much. . .
Are block strings bad form in any way...?
Well, not necessarily bad form, but they don't exactly improve readability, do they?
I'd not use them unless absolutely necessary.
,xtG
.tsooJ
Offline
#18 2005-02-25 11:08 am
Re: PHP & MYSQL problem. please help.
Alien wrote:
GreenAlge wrote:
I've got a question about that. . . I write block strings (or whatever you call them, the <<< thing) all the time in my PHP programs. But It seems that all editors I've seen don't support that (i.e., syntax coloring doesn't relect it as a string, and typeing an apostrophe will really mess up your syntax coloring if you don't type another one down the road), and I don't see other people use it in their scripts much. . .
Are block strings bad form in any way...?Well, not necessarily bad form, but they don't exactly improve readability, do they?
I'd not use them unless absolutely necessary.
,xtG
.tsooJ
I'd think it's better for readability than a bunch of "\n"s "\""s and the like...?
_Nik
Offline
#19 2005-02-25 11:49 am
Re: PHP & MYSQL problem. please help.
GreenAlge wrote:
Alien wrote:
Well, not necessarily bad form, but they don't exactly improve readability, do they?
I'd not use them unless absolutely necessary.I'd think it's better for readability than a bunch of "\n"s "\""s and the like...?
Strings are just that, strings. They should be short, and their content is irrelevant, they just get output by your code. If you want to know if the content is OK, check the output of your code.
,xtG
.tsooJ
Offline



