Re: [PHP] eof bof in php
At 2:21 PM -0500 12/22/08, Anthony Gentile wrote: I would argue it is better practice as: h1?php echo 'Hello World'; ?/h1 than ?php echo h1Hello World/h1; ? Anthony Gentile Certainly, but all you have done here is to move your ?php ? to different places. There is a threshold one reaches in deciding where is the best place to put the ?php ... ? -- it's a personal choice. With me, a one liner is sufficient for me to use: h1?php echo 'Hello World'; ?/h1 For more than that, I usually: ? html ?php I use heredoc for email text, but not for html. I do this primarily because I like the way my editor works for showing paired tags and braces. It makes it easy for me to check tag pairing. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] eof bof in php
Totally agree. Whenever i can i put html outside of php tags mainly because the code gets more readable because in eclipse u get syntax highlighting etc. Tim-Hinnerk Heuer http://www.ihostnz.com On Wed, Dec 24, 2008 at 4:13 AM, tedd tedd.sperl...@gmail.com wrote: At 2:21 PM -0500 12/22/08, Anthony Gentile wrote: I would argue it is better practice as: h1?php echo 'Hello World'; ?/h1 than ?php echo h1Hello World/h1; ? Anthony Gentile Certainly, but all you have done here is to move your ?php ? to different places. There is a threshold one reaches in deciding where is the best place to put the ?php ... ? -- it's a personal choice. With me, a one liner is sufficient for me to use: h1?php echo 'Hello World'; ?/h1 For more than that, I usually: ? html ?php I use heredoc for email text, but not for html. I do this primarily because I like the way my editor works for showing paired tags and braces. It makes it easy for me to check tag pairing. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] eof bof in php
At 1:21 PM -0500 12/21/08, Anthony Gentile wrote: -snip exampe- is probably going to give you the result you want. However you should know it is bad practice to mix PHP and HTML as horridly as I just showed you. AKA you don't want your PHP writing your HTML. Anthony Gentile Anthony: Granted, the example you gave was a bit mixed, but it's perfectly Okay to have php write html. In fact, if you think about it that's the only way php can express itself to the user. A simple echo($var) is writing html to a browser. Good practice should to write code (i.e., php, mysql, css, html, js) that is semantic and compliant with standards. Mixing them well is almost an art form that observes best practices in all. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] eof bof in php
I would argue it is better practice as: h1?php echo 'Hello World'; ?/h1 than ?php echo h1Hello World/h1; ? Anthony Gentile On Mon, Dec 22, 2008 at 9:18 AM, tedd tedd.sperl...@gmail.com wrote: At 1:21 PM -0500 12/21/08, Anthony Gentile wrote: -snip exampe- is probably going to give you the result you want. However you should know it is bad practice to mix PHP and HTML as horridly as I just showed you. AKA you don't want your PHP writing your HTML. Anthony Gentile Anthony: Granted, the example you gave was a bit mixed, but it's perfectly Okay to have php write html. In fact, if you think about it that's the only way php can express itself to the user. A simple echo($var) is writing html to a browser. Good practice should to write code (i.e., php, mysql, css, html, js) that is semantic and compliant with standards. Mixing them well is almost an art form that observes best practices in all. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] eof bof in php
On Mon, 2008-12-22 at 14:21 -0500, Anthony Gentile wrote: I would argue it is better practice as: h1?php echo 'Hello World'; ?/h1 than ?php echo h1Hello World/h1; ? Anthony Gentile On Mon, Dec 22, 2008 at 9:18 AM, tedd tedd.sperl...@gmail.com wrote: At 1:21 PM -0500 12/21/08, Anthony Gentile wrote: -snip exampe- is probably going to give you the result you want. However you should know it is bad practice to mix PHP and HTML as horridly as I just showed you. AKA you don't want your PHP writing your HTML. Anthony Gentile Anthony: Granted, the example you gave was a bit mixed, but it's perfectly Okay to have php write html. In fact, if you think about it that's the only way php can express itself to the user. A simple echo($var) is writing html to a browser. Good practice should to write code (i.e., php, mysql, css, html, js) that is semantic and compliant with standards. Mixing them well is almost an art form that observes best practices in all. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Why?! As you've seen, it can get awfully messy very quickly... Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] eof bof in php
Well you said it...for my example it makes sense. For when it gets really messy by all means concatenate with php. However, my argument is not so much keeping html seperate from php as it is keeping the business logic separate from the presentationso if you have php writing html and its all dealing with the presentation...I personally don't think its a problem. However when you start writing html out with php in your business logic...to me that's a no no. Anthony Gentile On Mon, Dec 22, 2008 at 2:47 PM, Ashley Sheridan a...@ashleysheridan.co.ukwrote: On Mon, 2008-12-22 at 14:21 -0500, Anthony Gentile wrote: I would argue it is better practice as: h1?php echo 'Hello World'; ?/h1 than ?php echo h1Hello World/h1; ? Anthony Gentile On Mon, Dec 22, 2008 at 9:18 AM, tedd tedd.sperl...@gmail.com wrote: At 1:21 PM -0500 12/21/08, Anthony Gentile wrote: -snip exampe- is probably going to give you the result you want. However you should know it is bad practice to mix PHP and HTML as horridly as I just showed you. AKA you don't want your PHP writing your HTML. Anthony Gentile Anthony: Granted, the example you gave was a bit mixed, but it's perfectly Okay to have php write html. In fact, if you think about it that's the only way php can express itself to the user. A simple echo($var) is writing html to a browser. Good practice should to write code (i.e., php, mysql, css, html, js) that is semantic and compliant with standards. Mixing them well is almost an art form that observes best practices in all. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Why?! As you've seen, it can get awfully messy very quickly... Ash www.ashleysheridan.co.uk
Re: [PHP] eof bof in php
On Mon, 2008-12-22 at 15:04 -0500, Anthony Gentile wrote: Well you said it...for my example it makes sense. For when it gets really messy by all means concatenate with php. However, my argument is not so much keeping html seperate from php as it is keeping the business logic separate from the presentationso if you have php writing html and its all dealing with the presentation...I personally don't think its a problem. However when you start writing html out with php in your business logic...to me that's a no no. Anthony Gentile On Mon, Dec 22, 2008 at 2:47 PM, Ashley Sheridan a...@ashleysheridan.co.ukwrote: On Mon, 2008-12-22 at 14:21 -0500, Anthony Gentile wrote: I would argue it is better practice as: h1?php echo 'Hello World'; ?/h1 than ?php echo h1Hello World/h1; ? Anthony Gentile On Mon, Dec 22, 2008 at 9:18 AM, tedd tedd.sperl...@gmail.com wrote: At 1:21 PM -0500 12/21/08, Anthony Gentile wrote: -snip exampe- is probably going to give you the result you want. However you should know it is bad practice to mix PHP and HTML as horridly as I just showed you. AKA you don't want your PHP writing your HTML. Anthony Gentile Anthony: Granted, the example you gave was a bit mixed, but it's perfectly Okay to have php write html. In fact, if you think about it that's the only way php can express itself to the user. A simple echo($var) is writing html to a browser. Good practice should to write code (i.e., php, mysql, css, html, js) that is semantic and compliant with standards. Mixing them well is almost an art form that observes best practices in all. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Why?! As you've seen, it can get awfully messy very quickly... Ash www.ashleysheridan.co.uk I largely tend towards using heredoc syntax wherever possible, as it lets you separate the PHP and HTML in the way you want, yet still allows you to have variable output inside the HTML. I hate repetitious breaking out of HTML code just to output a variable or two. Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] eof bof in php
On Dec 22, 2008, at 12:15 PM, Ashley Sheridan a...@ashleysheridan.co.uk wrote: On Mon, 2008-12-22 at 15:04 -0500, Anthony Gentile wrote: Well you said it...for my example it makes sense. For when it gets really messy by all means concatenate with php. However, my argument is not so much keeping html seperate from php as it is keeping the business logic separate from the presentationso if you have php writing html and its all dealing with the presentation...I personally don't think its a problem. However when you start writing html out with php in your business logic...to me that's a no no. Anthony Gentile On Mon, Dec 22, 2008 at 2:47 PM, Ashley Sheridan a...@ashleysheridan.co.ukwrote: On Mon, 2008-12-22 at 14:21 -0500, Anthony Gentile wrote: I would argue it is better practice as: h1?php echo 'Hello World'; ?/h1 than ?php echo h1Hello World/h1; ? Anthony Gentile On Mon, Dec 22, 2008 at 9:18 AM, tedd tedd.sperl...@gmail.com wrote: At 1:21 PM -0500 12/21/08, Anthony Gentile wrote: -snip exampe- is probably going to give you the result you want. However you should know it is bad practice to mix PHP and HTML as horridly as I just showed you. AKA you don't want your PHP writing your HTML. Anthony Gentile Anthony: Granted, the example you gave was a bit mixed, but it's perfectly Okay to have php write html. In fact, if you think about it that's the only way php can express itself to the user. A simple echo($var) is writing html to a browser. Good practice should to write code (i.e., php, mysql, css, html, js) that is semantic and compliant with standards. Mixing them well is almost an art form that observes best practices in all. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Why?! As you've seen, it can get awfully messy very quickly... Ash www.ashleysheridan.co.uk I largely tend towards using heredoc syntax wherever possible, as it lets you separate the PHP and HTML in the way you want, yet still allows you to have variable output inside the HTML. I hate repetitious breaking out of HTML code just to output a variable or two. Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php I love heredocs! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] eof bof in php
Hi, I'm very new to php. Please can someone point me in the right direction? I want to display a message: 'No Products Found' if my search record set returns no value. I think I need to be looking at this section of my code ... $query_rsSearch = sprintf(SELECT * FROM products WHERE product_name LIKE %s, GetSQLValueString(% . $colname_rsSearch . %, text)); $rsSearch = mysql_query($query_rsSearch, $sondia_lighting) or die(mysql_error()); $row_rsSearch = mysql_fetch_assoc($rsSearch); $totalRows_rsSearch = mysql_num_rows($rsSearch); ? Thanks - Gary Maddock-Greene -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] eof bof in php
On Sun, 2008-12-21 at 15:22 +, Gary Maddock-Greene wrote: Hi, I'm very new to php. Please can someone point me in the right direction? I want to display a message: 'No Products Found' if my search record set returns no value. I think I need to be looking at this section of my code ... $query_rsSearch = sprintf(SELECT * FROM products WHERE product_name LIKE %s, GetSQLValueString(% . $colname_rsSearch . %, text)); $rsSearch = mysql_query($query_rsSearch, $sondia_lighting) or die(mysql_error()); $row_rsSearch = mysql_fetch_assoc($rsSearch); $totalRows_rsSearch = mysql_num_rows($rsSearch); ? Thanks - Gary Maddock-Greene Can you not just use the $totalRows_rsSearch value inside of an if statement? Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] eof bof in php
Thanks Ashley ... I have been trying that but I think my syntax id shot!! ?php if ($totalRows_rsSearch=0) echo Sorry no products were found; else echo h3Please click on a product for further information./h3 ? !-- Product block start search results -- ?php do { ? div class=productitemimg src=products?php echo $row_rsSearch['product_image']; ? / div class=text h3?php echo $row_rsSearch['product_name']; ?/h3 p class=style1?php echo $row_rsSearch['product_subtitle']; ?/p a href=products?php echo $row_rsSearch['product_url']; ?View Product/a div class=clear/div /div div class=clear/div center /center /div ?php } while ($row_rsSearch = mysql_fetch_assoc($rsSearch)); ? -- - Gary Maddock-Greene Ashley Sheridan a...@ashleysheridan.co.uk wrote in message news:1229873521.4229.6.ca...@localhost.localdomain... On Sun, 2008-12-21 at 15:22 +, Gary Maddock-Greene wrote: Hi, I'm very new to php. Please can someone point me in the right direction? I want to display a message: 'No Products Found' if my search record set returns no value. I think I need to be looking at this section of my code ... $query_rsSearch = sprintf(SELECT * FROM products WHERE product_name LIKE %s, GetSQLValueString(% . $colname_rsSearch . %, text)); $rsSearch = mysql_query($query_rsSearch, $sondia_lighting) or die(mysql_error()); $row_rsSearch = mysql_fetch_assoc($rsSearch); $totalRows_rsSearch = mysql_num_rows($rsSearch); ? Thanks - Gary Maddock-Greene Can you not just use the $totalRows_rsSearch value inside of an if statement? Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] eof bof in php
On Sun, 2008-12-21 at 15:40 +, Gary Maddock-Greene wrote: Thanks Ashley ... I have been trying that but I think my syntax id shot!! ?php if ($totalRows_rsSearch=0) echo Sorry no products were found; else echo h3Please click on a product for further information./h3 ? !-- Product block start search results -- ?php do { ? div class=productitemimg src=products?php echo $row_rsSearch['product_image']; ? / div class=text h3?php echo $row_rsSearch['product_name']; ?/h3 p class=style1?php echo $row_rsSearch['product_subtitle']; ?/p a href=products?php echo $row_rsSearch['product_url']; ?View Product/a div class=clear/div /div div class=clear/div center /center /div ?php } while ($row_rsSearch = mysql_fetch_assoc($rsSearch)); ? -- - Gary Maddock-Greene Ashley Sheridan a...@ashleysheridan.co.uk wrote in message news:1229873521.4229.6.ca...@localhost.localdomain... On Sun, 2008-12-21 at 15:22 +, Gary Maddock-Greene wrote: Hi, I'm very new to php. Please can someone point me in the right direction? I want to display a message: 'No Products Found' if my search record set returns no value. I think I need to be looking at this section of my code ... $query_rsSearch = sprintf(SELECT * FROM products WHERE product_name LIKE %s, GetSQLValueString(% . $colname_rsSearch . %, text)); $rsSearch = mysql_query($query_rsSearch, $sondia_lighting) or die(mysql_error()); $row_rsSearch = mysql_fetch_assoc($rsSearch); $totalRows_rsSearch = mysql_num_rows($rsSearch); ? Thanks - Gary Maddock-Greene Can you not just use the $totalRows_rsSearch value inside of an if statement? Ash www.ashleysheridan.co.uk It might be because you're comparing the total to a string rather than a number if ($totalRows_rsSearch=0) If you remove the quote marks, it should work. Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] eof bof in php
I have tried that but to no avail :) ?php if ($totalRows_rsSearch=0) echo Sorry no products were found; else // All seems OK to here, then the syntax error unexpected T_VARIABLE appears echo h3Please click on a product for further information./h3 ?php do { ? div class=productitemimg src=products?php echo $row_rsSearch['product_image']; ? / div class=text h3?php echo $row_rsSearch['product_name']; ?/h3 p class=style1?php echo $row_rsSearch['product_subtitle']; ?/p a href=products?php echo $row_rsSearch['product_url']; ?View Product/a div class=clear/div /div div class=clear/div center /center /div ?php } while ($row_rsSearch = mysql_fetch_assoc($rsSearch)); ? -- - Gary Maddock-Greene Ashley Sheridan a...@ashleysheridan.co.uk wrote in message news:1229875150.4229.9.ca...@localhost.localdomain... On Sun, 2008-12-21 at 15:40 +, Gary Maddock-Greene wrote: Thanks Ashley ... I have been trying that but I think my syntax id shot!! ?php if ($totalRows_rsSearch=0) echo Sorry no products were found; else echo h3Please click on a product for further information./h3 ? !-- Product block start search results -- ?php do { ? div class=productitemimg src=products?php echo $row_rsSearch['product_image']; ? / div class=text h3?php echo $row_rsSearch['product_name']; ?/h3 p class=style1?php echo $row_rsSearch['product_subtitle']; ?/p a href=products?php echo $row_rsSearch['product_url']; ?View Product/a div class=clear/div /div div class=clear/div center /center /div ?php } while ($row_rsSearch = mysql_fetch_assoc($rsSearch)); ? -- - Gary Maddock-Greene Ashley Sheridan a...@ashleysheridan.co.uk wrote in message news:1229873521.4229.6.ca...@localhost.localdomain... On Sun, 2008-12-21 at 15:22 +, Gary Maddock-Greene wrote: Hi, I'm very new to php. Please can someone point me in the right direction? I want to display a message: 'No Products Found' if my search record set returns no value. I think I need to be looking at this section of my code ... $query_rsSearch = sprintf(SELECT * FROM products WHERE product_name LIKE %s, GetSQLValueString(% . $colname_rsSearch . %, text)); $rsSearch = mysql_query($query_rsSearch, $sondia_lighting) or die(mysql_error()); $row_rsSearch = mysql_fetch_assoc($rsSearch); $totalRows_rsSearch = mysql_num_rows($rsSearch); ? Thanks - Gary Maddock-Greene Can you not just use the $totalRows_rsSearch value inside of an if statement? Ash www.ashleysheridan.co.uk It might be because you're comparing the total to a string rather than a number if ($totalRows_rsSearch=0) If you remove the quote marks, it should work. Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] eof bof in php
On Sun, 2008-12-21 at 16:22 +, Gary Maddock-Greene wrote: I have tried that but to no avail :) ?php if ($totalRows_rsSearch=0) echo Sorry no products were found; else // All seems OK to here, then the syntax error unexpected T_VARIABLE appears echo h3Please click on a product for further information./h3 ?php do { ? div class=productitemimg src=products?php echo $row_rsSearch['product_image']; ? / div class=text h3?php echo $row_rsSearch['product_name']; ?/h3 p class=style1?php echo $row_rsSearch['product_subtitle']; ?/p a href=products?php echo $row_rsSearch['product_url']; ?View Product/a div class=clear/div /div div class=clear/div center /center /div ?php } while ($row_rsSearch = mysql_fetch_assoc($rsSearch)); ? -- - Gary Maddock-Greene Ashley Sheridan a...@ashleysheridan.co.uk wrote in message news:1229875150.4229.9.ca...@localhost.localdomain... On Sun, 2008-12-21 at 15:40 +, Gary Maddock-Greene wrote: Thanks Ashley ... I have been trying that but I think my syntax id shot!! ?php if ($totalRows_rsSearch=0) echo Sorry no products were found; else echo h3Please click on a product for further information./h3 ? !-- Product block start search results -- ?php do { ? div class=productitemimg src=products?php echo $row_rsSearch['product_image']; ? / div class=text h3?php echo $row_rsSearch['product_name']; ?/h3 p class=style1?php echo $row_rsSearch['product_subtitle']; ?/p a href=products?php echo $row_rsSearch['product_url']; ?View Product/a div class=clear/div /div div class=clear/div center /center /div ?php } while ($row_rsSearch = mysql_fetch_assoc($rsSearch)); ? -- - Gary Maddock-Greene Ashley Sheridan a...@ashleysheridan.co.uk wrote in message news:1229873521.4229.6.ca...@localhost.localdomain... On Sun, 2008-12-21 at 15:22 +, Gary Maddock-Greene wrote: Hi, I'm very new to php. Please can someone point me in the right direction? I want to display a message: 'No Products Found' if my search record set returns no value. I think I need to be looking at this section of my code ... $query_rsSearch = sprintf(SELECT * FROM products WHERE product_name LIKE %s, GetSQLValueString(% . $colname_rsSearch . %, text)); $rsSearch = mysql_query($query_rsSearch, $sondia_lighting) or die(mysql_error()); $row_rsSearch = mysql_fetch_assoc($rsSearch); $totalRows_rsSearch = mysql_num_rows($rsSearch); ? Thanks - Gary Maddock-Greene Can you not just use the $totalRows_rsSearch value inside of an if statement? Ash www.ashleysheridan.co.uk It might be because you're comparing the total to a string rather than a number if ($totalRows_rsSearch=0) If you remove the quote marks, it should work. Ash www.ashleysheridan.co.uk Just spotted that you've omitted the semicolon from the second echo statement as well. Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] eof bof in php
if (0 == $totalRows_rsSearch) { echo Sorry no products were found; } else Anthony Gentile On Sun, Dec 21, 2008 at 11:22 AM, Gary Maddock-Greene g...@maddock-greene.co.uk wrote: I have tried that but to no avail :) ?php if ($totalRows_rsSearch=0) echo Sorry no products were found; else // All seems OK to here, then the syntax error unexpected T_VARIABLE appears echo h3Please click on a product for further information./h3 ?php do { ? div class=productitemimg src=products?php echo $row_rsSearch['product_image']; ? / div class=text h3?php echo $row_rsSearch['product_name']; ?/h3 p class=style1?php echo $row_rsSearch['product_subtitle']; ?/p a href=products?php echo $row_rsSearch['product_url']; ?View Product/a div class=clear/div /div div class=clear/div center /center /div ?php } while ($row_rsSearch = mysql_fetch_assoc($rsSearch)); ? -- - Gary Maddock-Greene Ashley Sheridan a...@ashleysheridan.co.uk wrote in message news:1229875150.4229.9.ca...@localhost.localdomain... On Sun, 2008-12-21 at 15:40 +, Gary Maddock-Greene wrote: Thanks Ashley ... I have been trying that but I think my syntax id shot!! ?php if ($totalRows_rsSearch=0) echo Sorry no products were found; else echo h3Please click on a product for further information./h3 ? !-- Product block start search results -- ?php do { ? div class=productitemimg src=products?php echo $row_rsSearch['product_image']; ? / div class=text h3?php echo $row_rsSearch['product_name']; ?/h3 p class=style1?php echo $row_rsSearch['product_subtitle']; ?/p a href=products?php echo $row_rsSearch['product_url']; ?View Product/a div class=clear/div /div div class=clear/div center /center /div ?php } while ($row_rsSearch = mysql_fetch_assoc($rsSearch)); ? -- - Gary Maddock-Greene Ashley Sheridan a...@ashleysheridan.co.uk wrote in message news:1229873521.4229.6.ca...@localhost.localdomain... On Sun, 2008-12-21 at 15:22 +, Gary Maddock-Greene wrote: Hi, I'm very new to php. Please can someone point me in the right direction? I want to display a message: 'No Products Found' if my search record set returns no value. I think I need to be looking at this section of my code ... $query_rsSearch = sprintf(SELECT * FROM products WHERE product_name LIKE %s, GetSQLValueString(% . $colname_rsSearch . %, text)); $rsSearch = mysql_query($query_rsSearch, $sondia_lighting) or die(mysql_error()); $row_rsSearch = mysql_fetch_assoc($rsSearch); $totalRows_rsSearch = mysql_num_rows($rsSearch); ? Thanks - Gary Maddock-Greene Can you not just use the $totalRows_rsSearch value inside of an if statement? Ash www.ashleysheridan.co.uk It might be because you're comparing the total to a string rather than a number if ($totalRows_rsSearch=0) If you remove the quote marks, it should work. Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] eof bof in php
On Sun, 2008-12-21 at 11:39 -0500, Anthony Gentile wrote: if (0 == $totalRows_rsSearch) { echo Sorry no products were found; } else Anthony Gentile On Sun, Dec 21, 2008 at 11:22 AM, Gary Maddock-Greene g...@maddock-greene.co.uk wrote: I have tried that but to no avail :) ?php if ($totalRows_rsSearch=0) echo Sorry no products were found; else // All seems OK to here, then the syntax error unexpected T_VARIABLE appears echo h3Please click on a product for further information./h3 ?php do { ? div class=productitemimg src=products?php echo $row_rsSearch['product_image']; ? / div class=text h3?php echo $row_rsSearch['product_name']; ?/h3 p class=style1?php echo $row_rsSearch['product_subtitle']; ?/p a href=products?php echo $row_rsSearch['product_url']; ?View Product/a div class=clear/div /div div class=clear/div center /center /div ?php } while ($row_rsSearch = mysql_fetch_assoc($rsSearch)); ? -- - Gary Maddock-Greene Ashley Sheridan a...@ashleysheridan.co.uk wrote in message news:1229875150.4229.9.ca...@localhost.localdomain... On Sun, 2008-12-21 at 15:40 +, Gary Maddock-Greene wrote: Thanks Ashley ... I have been trying that but I think my syntax id shot!! ?php if ($totalRows_rsSearch=0) echo Sorry no products were found; else echo h3Please click on a product for further information./h3 ? !-- Product block start search results -- ?php do { ? div class=productitemimg src=products?php echo $row_rsSearch['product_image']; ? / div class=text h3?php echo $row_rsSearch['product_name']; ?/h3 p class=style1?php echo $row_rsSearch['product_subtitle']; ?/p a href=products?php echo $row_rsSearch['product_url']; ?View Product/a div class=clear/div /div div class=clear/div center /center /div ?php } while ($row_rsSearch = mysql_fetch_assoc($rsSearch)); ? -- - Gary Maddock-Greene Ashley Sheridan a...@ashleysheridan.co.uk wrote in message news:1229873521.4229.6.ca...@localhost.localdomain... On Sun, 2008-12-21 at 15:22 +, Gary Maddock-Greene wrote: Hi, I'm very new to php. Please can someone point me in the right direction? I want to display a message: 'No Products Found' if my search record set returns no value. I think I need to be looking at this section of my code ... $query_rsSearch = sprintf(SELECT * FROM products WHERE product_name LIKE %s, GetSQLValueString(% . $colname_rsSearch . %, text)); $rsSearch = mysql_query($query_rsSearch, $sondia_lighting) or die(mysql_error()); $row_rsSearch = mysql_fetch_assoc($rsSearch); $totalRows_rsSearch = mysql_num_rows($rsSearch); ? Thanks - Gary Maddock-Greene Can you not just use the $totalRows_rsSearch value inside of an if statement? Ash www.ashleysheridan.co.uk It might be because you're comparing the total to a string rather than a number if ($totalRows_rsSearch=0) If you remove the quote marks, it should work. Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php D'oh, not sure how I missed that one too, the double ==. No wonder it wasn't working. Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] eof bof in php
Thanks guys .. I can get this part working great .. ?php if (0 == $totalRows_rsSearch) { echo h3Sorry no products were found/h3; } else echo h3Please click on a product for further information./h3 ? But I want to add the following so that only the products table appears when product are present. I cannot seem to add this code into the above after the echo h3Please click on a product for further information./h3. I can't get the syntax right ... I appreciate everyones help -- - Gary Maddock-Greene Ashley Sheridan a...@ashleysheridan.co.uk wrote in message news:1229878234.4229.12.ca...@localhost.localdomain... On Sun, 2008-12-21 at 11:39 -0500, Anthony Gentile wrote: if (0 == $totalRows_rsSearch) { echo Sorry no products were found; } else Anthony Gentile On Sun, Dec 21, 2008 at 11:22 AM, Gary Maddock-Greene g...@maddock-greene.co.uk wrote: I have tried that but to no avail :) ?php if ($totalRows_rsSearch=0) echo Sorry no products were found; else // All seems OK to here, then the syntax error unexpected T_VARIABLE appears echo h3Please click on a product for further information./h3 ?php do { ? div class=productitemimg src=products?php echo $row_rsSearch['product_image']; ? / div class=text h3?php echo $row_rsSearch['product_name']; ?/h3 p class=style1?php echo $row_rsSearch['product_subtitle']; ?/p a href=products?php echo $row_rsSearch['product_url']; ?View Product/a div class=clear/div /div div class=clear/div center /center /div ?php } while ($row_rsSearch = mysql_fetch_assoc($rsSearch)); ? -- - Gary Maddock-Greene Ashley Sheridan a...@ashleysheridan.co.uk wrote in message news:1229875150.4229.9.ca...@localhost.localdomain... On Sun, 2008-12-21 at 15:40 +, Gary Maddock-Greene wrote: Thanks Ashley ... I have been trying that but I think my syntax id shot!! ?php if ($totalRows_rsSearch=0) echo Sorry no products were found; else echo h3Please click on a product for further information./h3 ? !-- Product block start search results -- ?php do { ? div class=productitemimg src=products?php echo $row_rsSearch['product_image']; ? / div class=text h3?php echo $row_rsSearch['product_name']; ?/h3 p class=style1?php echo $row_rsSearch['product_subtitle']; ?/p a href=products?php echo $row_rsSearch['product_url']; ?View Product/a div class=clear/div /div div class=clear/div center /center /div ?php } while ($row_rsSearch = mysql_fetch_assoc($rsSearch)); ? -- - Gary Maddock-Greene Ashley Sheridan a...@ashleysheridan.co.uk wrote in message news:1229873521.4229.6.ca...@localhost.localdomain... On Sun, 2008-12-21 at 15:22 +, Gary Maddock-Greene wrote: Hi, I'm very new to php. Please can someone point me in the right direction? I want to display a message: 'No Products Found' if my search record set returns no value. I think I need to be looking at this section of my code ... $query_rsSearch = sprintf(SELECT * FROM products WHERE product_name LIKE %s, GetSQLValueString(% . $colname_rsSearch . %, text)); $rsSearch = mysql_query($query_rsSearch, $sondia_lighting) or die(mysql_error()); $row_rsSearch = mysql_fetch_assoc($rsSearch); $totalRows_rsSearch = mysql_num_rows($rsSearch); ? Thanks - Gary Maddock-Greene Can you not just use the $totalRows_rsSearch value inside of an if statement? Ash www.ashleysheridan.co.uk It might be because you're comparing the total to a string rather than a number if ($totalRows_rsSearch=0) If you remove the quote marks, it should work. Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php D'oh, not sure how I missed that one too, the double ==. No wonder it wasn't working. Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] eof bof in php
...missing semicolon and some brackets. ?php if (0 == $totalRows_rsSearch) { echo h3Sorry no products were found/h3; } else { echo h3Please click on a product for further information./h3; } ? If there is more code you can show by perhaps pasting here: http://pastebin.redlinktech.com We can help with further syntax problems. Anthony Gentile On Sun, Dec 21, 2008 at 12:33 PM, Gary Maddock-Greene g...@maddock-greene.co.uk wrote: Thanks guys .. I can get this part working great .. ?php if (0 == $totalRows_rsSearch) { echo h3Sorry no products were found/h3; } else echo h3Please click on a product for further information./h3 ? But I want to add the following so that only the products table appears when product are present. I cannot seem to add this code into the above after the echo h3Please click on a product for further information./h3. I can't get the syntax right ... I appreciate everyones help -- - Gary Maddock-Greene Ashley Sheridan a...@ashleysheridan.co.uk wrote in message news:1229878234.4229.12.ca...@localhost.localdomain... On Sun, 2008-12-21 at 11:39 -0500, Anthony Gentile wrote: if (0 == $totalRows_rsSearch) { echo Sorry no products were found; } else Anthony Gentile On Sun, Dec 21, 2008 at 11:22 AM, Gary Maddock-Greene g...@maddock-greene.co.uk wrote: I have tried that but to no avail :) ?php if ($totalRows_rsSearch=0) echo Sorry no products were found; else // All seems OK to here, then the syntax error unexpected T_VARIABLE appears echo h3Please click on a product for further information./h3 ?php do { ? div class=productitemimg src=products?php echo $row_rsSearch['product_image']; ? / div class=text h3?php echo $row_rsSearch['product_name']; ?/h3 p class=style1?php echo $row_rsSearch['product_subtitle']; ?/p a href=products?php echo $row_rsSearch['product_url']; ?View Product/a div class=clear/div /div div class=clear/div center /center /div ?php } while ($row_rsSearch = mysql_fetch_assoc($rsSearch)); ? -- - Gary Maddock-Greene Ashley Sheridan a...@ashleysheridan.co.uk wrote in message news:1229875150.4229.9.ca...@localhost.localdomain... On Sun, 2008-12-21 at 15:40 +, Gary Maddock-Greene wrote: Thanks Ashley ... I have been trying that but I think my syntax id shot!! ?php if ($totalRows_rsSearch=0) echo Sorry no products were found; else echo h3Please click on a product for further information./h3 ? !-- Product block start search results -- ?php do { ? div class=productitemimg src=products?php echo $row_rsSearch['product_image']; ? / div class=text h3?php echo $row_rsSearch['product_name']; ?/h3 p class=style1?php echo $row_rsSearch['product_subtitle']; ?/p a href=products?php echo $row_rsSearch['product_url']; ?View Product/a div class=clear/div /div div class=clear/div center /center /div ?php } while ($row_rsSearch = mysql_fetch_assoc($rsSearch)); ? -- - Gary Maddock-Greene Ashley Sheridan a...@ashleysheridan.co.uk wrote in message news:1229873521.4229.6.ca...@localhost.localdomain... On Sun, 2008-12-21 at 15:22 +, Gary Maddock-Greene wrote: Hi, I'm very new to php. Please can someone point me in the right direction? I want to display a message: 'No Products Found' if my search record set returns no value. I think I need to be looking at this section of my code ... $query_rsSearch = sprintf(SELECT * FROM products WHERE product_name LIKE %s, GetSQLValueString(% . $colname_rsSearch . %, text)); $rsSearch = mysql_query($query_rsSearch, $sondia_lighting) or die(mysql_error()); $row_rsSearch = mysql_fetch_assoc($rsSearch); $totalRows_rsSearch = mysql_num_rows($rsSearch); ? Thanks - Gary Maddock-Greene Can you not just use the $totalRows_rsSearch value inside of an if statement? Ash www.ashleysheridan.co.uk It might be because you're comparing the total to a string rather than a number if ($totalRows_rsSearch=0) If you remove the quote marks, it should work. Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php D'oh, not sure how I missed that one too, the double ==. No wonder it wasn't working. Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] eof bof in php
I've corrected those errors thanks but how do I insert this code as the else statement? ?php do { ? div class=productitemimg src=products?php echo $row_rsSearch['product_image']; ? / div class=text h3?php echo $row_rsSearch['product_name']; ?/h3 p class=style1?php echo $row_rsSearch['product_subtitle']; ?/p a href=products?php echo $row_rsSearch['product_url']; ?View Product/a div class=clear/div /div div class=clear/div center /center /div ?php } while ($row_rsSearch = mysql_fetch_assoc($rsSearch)); ? -- - Gary Maddock-Greene Anthony Gentile asgent...@gmail.com wrote in message news:2ce4207d0812210959k3491690ctbc4f0dbf971ac...@mail.gmail.com... ...missing semicolon and some brackets. ?php if (0 == $totalRows_rsSearch) { echo h3Sorry no products were found/h3; } else { echo h3Please click on a product for further information./h3; } ? If there is more code you can show by perhaps pasting here: http://pastebin.redlinktech.com We can help with further syntax problems. Anthony Gentile On Sun, Dec 21, 2008 at 12:33 PM, Gary Maddock-Greene g...@maddock-greene.co.uk wrote: Thanks guys .. I can get this part working great .. ?php if (0 == $totalRows_rsSearch) { echo h3Sorry no products were found/h3; } else echo h3Please click on a product for further information./h3 ? But I want to add the following so that only the products table appears when product are present. I cannot seem to add this code into the above after the echo h3Please click on a product for further information./h3. I can't get the syntax right ... I appreciate everyones help -- - Gary Maddock-Greene Ashley Sheridan a...@ashleysheridan.co.uk wrote in message news:1229878234.4229.12.ca...@localhost.localdomain... On Sun, 2008-12-21 at 11:39 -0500, Anthony Gentile wrote: if (0 == $totalRows_rsSearch) { echo Sorry no products were found; } else Anthony Gentile On Sun, Dec 21, 2008 at 11:22 AM, Gary Maddock-Greene g...@maddock-greene.co.uk wrote: I have tried that but to no avail :) ?php if ($totalRows_rsSearch=0) echo Sorry no products were found; else // All seems OK to here, then the syntax error unexpected T_VARIABLE appears echo h3Please click on a product for further information./h3 ?php do { ? div class=productitemimg src=products?php echo $row_rsSearch['product_image']; ? / div class=text h3?php echo $row_rsSearch['product_name']; ?/h3 p class=style1?php echo $row_rsSearch['product_subtitle']; ?/p a href=products?php echo $row_rsSearch['product_url']; ?View Product/a div class=clear/div /div div class=clear/div center /center /div ?php } while ($row_rsSearch = mysql_fetch_assoc($rsSearch)); ? -- - Gary Maddock-Greene Ashley Sheridan a...@ashleysheridan.co.uk wrote in message news:1229875150.4229.9.ca...@localhost.localdomain... On Sun, 2008-12-21 at 15:40 +, Gary Maddock-Greene wrote: Thanks Ashley ... I have been trying that but I think my syntax id shot!! ?php if ($totalRows_rsSearch=0) echo Sorry no products were found; else echo h3Please click on a product for further information./h3 ? !-- Product block start search results -- ?php do { ? div class=productitemimg src=products?php echo $row_rsSearch['product_image']; ? / div class=text h3?php echo $row_rsSearch['product_name']; ?/h3 p class=style1?php echo $row_rsSearch['product_subtitle']; ?/p a href=products?php echo $row_rsSearch['product_url']; ?View Product/a div class=clear/div /div div class=clear/div center /center /div ?php } while ($row_rsSearch = mysql_fetch_assoc($rsSearch)); ? -- - Gary Maddock-Greene Ashley Sheridan a...@ashleysheridan.co.uk wrote in message news:1229873521.4229.6.ca...@localhost.localdomain... On Sun, 2008-12-21 at 15:22 +, Gary Maddock-Greene wrote: Hi, I'm very new to php. Please can someone point me in the right direction? I want to display a message: 'No Products Found' if my search record set returns no value. I think I need to be looking at this section of my code ... $query_rsSearch = sprintf(SELECT * FROM products WHERE product_name LIKE %s, GetSQLValueString(% . $colname_rsSearch . %, text)); $rsSearch = mysql_query($query_rsSearch, $sondia_lighting) or die(mysql_error()); $row_rsSearch = mysql_fetch_assoc($rsSearch); $totalRows_rsSearch = mysql_num_rows($rsSearch); ? Thanks - Gary Maddock-Greene Can you not just use the $totalRows_rsSearch value inside of an if statement? Ash www.ashleysheridan.co.uk It might be because you're comparing the total to a string rather than a number if ($totalRows_rsSearch=0) If you remove the quote marks, it should work. Ash www.ashleysheridan.co.uk --
Re: [PHP] eof bof in php
?php if (0 == $totalRows_rsSearch) { echo h3Sorry no products were found/h3; } else { echo h3Please click on a product for further information./h3; while ($row_rsSearch = mysql_fetch_assoc($rsSearch)){ echo div class=\productitem\img src=\products\. $row_rsSearch['product_image']. div class=\text\ h3. $row_rsSearch['product_name']./h3 p class=\style1\. $row_rsSearch['product_subtitle'] . /p a href=\products\. $row_rsSearch['product_url'].View Product/a div class=\clear\/div /div div class=\clear\/div center /center /div; } } ? is probably going to give you the result you want. However you should know it is bad practice to mix PHP and HTML as horridly as I just showed you. AKA you don't want your PHP writing your HTML. Anthony Gentile On Sun, Dec 21, 2008 at 1:07 PM, Gary Maddock-Greene g...@maddock-greene.co.uk wrote: I've corrected those errors thanks but how do I insert this code as the else statement? ?php do { ? div class=productitemimg src=products?php echo $row_rsSearch['product_image']; ? / div class=text h3?php echo $row_rsSearch['product_name']; ?/h3 p class=style1?php echo $row_rsSearch['product_subtitle']; ?/p a href=products?php echo $row_rsSearch['product_url']; ?View Product/a div class=clear/div /div div class=clear/div center /center /div ?php } while ($row_rsSearch = mysql_fetch_assoc($rsSearch)); ? -- - Gary Maddock-Greene Anthony Gentile asgent...@gmail.com wrote in message news:2ce4207d0812210959k3491690ctbc4f0dbf971ac...@mail.gmail.com... ...missing semicolon and some brackets. ?php if (0 == $totalRows_rsSearch) { echo h3Sorry no products were found/h3; } else { echo h3Please click on a product for further information./h3; } ? If there is more code you can show by perhaps pasting here: http://pastebin.redlinktech.com We can help with further syntax problems. Anthony Gentile On Sun, Dec 21, 2008 at 12:33 PM, Gary Maddock-Greene g...@maddock-greene.co.uk wrote: Thanks guys .. I can get this part working great .. ?php if (0 == $totalRows_rsSearch) { echo h3Sorry no products were found/h3; } else echo h3Please click on a product for further information./h3 ? But I want to add the following so that only the products table appears when product are present. I cannot seem to add this code into the above after the echo h3Please click on a product for further information./h3. I can't get the syntax right ... I appreciate everyones help -- - Gary Maddock-Greene Ashley Sheridan a...@ashleysheridan.co.uk wrote in message news:1229878234.4229.12.ca...@localhost.localdomain... On Sun, 2008-12-21 at 11:39 -0500, Anthony Gentile wrote: if (0 == $totalRows_rsSearch) { echo Sorry no products were found; } else Anthony Gentile On Sun, Dec 21, 2008 at 11:22 AM, Gary Maddock-Greene g...@maddock-greene.co.uk wrote: I have tried that but to no avail :) ?php if ($totalRows_rsSearch=0) echo Sorry no products were found; else // All seems OK to here, then the syntax error unexpected T_VARIABLE appears echo h3Please click on a product for further information./h3 ?php do { ? div class=productitemimg src=products?php echo $row_rsSearch['product_image']; ? / div class=text h3?php echo $row_rsSearch['product_name']; ?/h3 p class=style1?php echo $row_rsSearch['product_subtitle']; ?/p a href=products?php echo $row_rsSearch['product_url']; ?View Product/a div class=clear/div /div div class=clear/div center /center /div ?php } while ($row_rsSearch = mysql_fetch_assoc($rsSearch)); ? -- - Gary Maddock-Greene Ashley Sheridan a...@ashleysheridan.co.uk wrote in message news:1229875150.4229.9.ca...@localhost.localdomain... On Sun, 2008-12-21 at 15:40 +, Gary Maddock-Greene wrote: Thanks Ashley ... I have been trying that but I think my syntax id shot!! ?php if ($totalRows_rsSearch=0) echo Sorry no products were found; else echo h3Please click on a product for further information./h3 ? !-- Product block start search results -- ?php do { ? div class=productitemimg src=products?php echo $row_rsSearch['product_image']; ? / div class=text h3?php echo $row_rsSearch['product_name']; ?/h3 p class=style1?php echo $row_rsSearch['product_subtitle']; ?/p a href=products?php echo $row_rsSearch['product_url']; ?View Product/a div class=clear/div /div div class=clear/div center /center /div ?php } while ($row_rsSearch = mysql_fetch_assoc($rsSearch)); ? -- - Gary Maddock-Greene Ashley Sheridan a...@ashleysheridan.co.uk wrote in message
Re: [PHP] eof bof in php
err forgot the closing in img src=\products\. should look like img src=\products\. Anthony Gentile Cell: 704.657.8550 Diese E-Mail ist vertraulich. Wenn Sie nicht der rechtmaessige Empfaenger sind, duerfen Sie den Inhalt weder kopieren noch verbreiten oder benutzen. Sollten Sie diese E-Mail versehentlich erhalten haben, senden Sie diese bitte an uns zurueck und loeschen Sie sie anschliessend. This email is confidential. If you are not the intended recipient, you must not copy, disclose or use its contents. If you have received it in error, please inform us immediately by return email and delete the document. On Sun, Dec 21, 2008 at 1:21 PM, Anthony Gentile asgent...@gmail.comwrote: ?php if (0 == $totalRows_rsSearch) { echo h3Sorry no products were found/h3; } else { echo h3Please click on a product for further information./h3; while ($row_rsSearch = mysql_fetch_assoc($rsSearch)){ echo div class=\productitem\img src=\products\. $row_rsSearch['product_image']. div class=\text\ h3. $row_rsSearch['product_name']./h3 p class=\style1\. $row_rsSearch['product_subtitle'] . /p a href=\products\. $row_rsSearch['product_url'].View Product/a div class=\clear\/div /div div class=\clear\/div center /center /div; } } ? is probably going to give you the result you want. However you should know it is bad practice to mix PHP and HTML as horridly as I just showed you. AKA you don't want your PHP writing your HTML. Anthony Gentile On Sun, Dec 21, 2008 at 1:07 PM, Gary Maddock-Greene g...@maddock-greene.co.uk wrote: I've corrected those errors thanks but how do I insert this code as the else statement? ?php do { ? div class=productitemimg src=products?php echo $row_rsSearch['product_image']; ? / div class=text h3?php echo $row_rsSearch['product_name']; ?/h3 p class=style1?php echo $row_rsSearch['product_subtitle']; ?/p a href=products?php echo $row_rsSearch['product_url']; ?View Product/a div class=clear/div /div div class=clear/div center /center /div ?php } while ($row_rsSearch = mysql_fetch_assoc($rsSearch)); ? -- - Gary Maddock-Greene Anthony Gentile asgent...@gmail.com wrote in message news:2ce4207d0812210959k3491690ctbc4f0dbf971ac...@mail.gmail.com... ...missing semicolon and some brackets. ?php if (0 == $totalRows_rsSearch) { echo h3Sorry no products were found/h3; } else { echo h3Please click on a product for further information./h3; } ? If there is more code you can show by perhaps pasting here: http://pastebin.redlinktech.com We can help with further syntax problems. Anthony Gentile On Sun, Dec 21, 2008 at 12:33 PM, Gary Maddock-Greene g...@maddock-greene.co.uk wrote: Thanks guys .. I can get this part working great .. ?php if (0 == $totalRows_rsSearch) { echo h3Sorry no products were found/h3; } else echo h3Please click on a product for further information./h3 ? But I want to add the following so that only the products table appears when product are present. I cannot seem to add this code into the above after the echo h3Please click on a product for further information./h3. I can't get the syntax right ... I appreciate everyones help -- - Gary Maddock-Greene Ashley Sheridan a...@ashleysheridan.co.uk wrote in message news:1229878234.4229.12.ca...@localhost.localdomain... On Sun, 2008-12-21 at 11:39 -0500, Anthony Gentile wrote: if (0 == $totalRows_rsSearch) { echo Sorry no products were found; } else Anthony Gentile On Sun, Dec 21, 2008 at 11:22 AM, Gary Maddock-Greene g...@maddock-greene.co.uk wrote: I have tried that but to no avail :) ?php if ($totalRows_rsSearch=0) echo Sorry no products were found; else // All seems OK to here, then the syntax error unexpected T_VARIABLE appears echo h3Please click on a product for further information./h3 ?php do { ? div class=productitemimg src=products?php echo $row_rsSearch['product_image']; ? / div class=text h3?php echo $row_rsSearch['product_name']; ?/h3 p class=style1?php echo $row_rsSearch['product_subtitle']; ?/p a href=products?php echo $row_rsSearch['product_url']; ?View Product/a div class=clear/div /div div class=clear/div center /center /div ?php } while ($row_rsSearch = mysql_fetch_assoc($rsSearch)); ? -- - Gary Maddock-Greene Ashley Sheridan a...@ashleysheridan.co.uk wrote in message news:1229875150.4229.9.ca...@localhost.localdomain... On Sun, 2008-12-21 at 15:40 +, Gary Maddock-Greene wrote: Thanks Ashley ... I have been trying that but I think my syntax id shot!! ?php if ($totalRows_rsSearch=0) echo Sorry no products were found; else echo h3Please click on a product for further
Re: [PHP] eof bof in php
That's got it thanks Anthony. I love when you learn something. It was the back slash \ preceeding the 's in my html that I wasn't aware of. Now I know they are needed if using in your code. Thank you so much for your help. -- - Gary Maddock-Greene Anthony Gentile asgent...@gmail.com wrote in message news:2ce4207d0812211021g215d5346wb0afcedf039ef...@mail.gmail.com... ?php if (0 == $totalRows_rsSearch) { echo h3Sorry no products were found/h3; } else { echo h3Please click on a product for further information./h3; while ($row_rsSearch = mysql_fetch_assoc($rsSearch)){ echo div class=\productitem\img src=\products\. $row_rsSearch['product_image']. div class=\text\ h3. $row_rsSearch['product_name']./h3 p class=\style1\. $row_rsSearch['product_subtitle'] . /p a href=\products\. $row_rsSearch['product_url'].View Product/a div class=\clear\/div /div div class=\clear\/div center /center /div; } } ? is probably going to give you the result you want. However you should know it is bad practice to mix PHP and HTML as horridly as I just showed you. AKA you don't want your PHP writing your HTML. Anthony Gentile On Sun, Dec 21, 2008 at 1:07 PM, Gary Maddock-Greene g...@maddock-greene.co.uk wrote: I've corrected those errors thanks but how do I insert this code as the else statement? ?php do { ? div class=productitemimg src=products?php echo $row_rsSearch['product_image']; ? / div class=text h3?php echo $row_rsSearch['product_name']; ?/h3 p class=style1?php echo $row_rsSearch['product_subtitle']; ?/p a href=products?php echo $row_rsSearch['product_url']; ?View Product/a div class=clear/div /div div class=clear/div center /center /div ?php } while ($row_rsSearch = mysql_fetch_assoc($rsSearch)); ? -- - Gary Maddock-Greene Anthony Gentile asgent...@gmail.com wrote in message news:2ce4207d0812210959k3491690ctbc4f0dbf971ac...@mail.gmail.com... ...missing semicolon and some brackets. ?php if (0 == $totalRows_rsSearch) { echo h3Sorry no products were found/h3; } else { echo h3Please click on a product for further information./h3; } ? If there is more code you can show by perhaps pasting here: http://pastebin.redlinktech.com We can help with further syntax problems. Anthony Gentile On Sun, Dec 21, 2008 at 12:33 PM, Gary Maddock-Greene g...@maddock-greene.co.uk wrote: Thanks guys .. I can get this part working great .. ?php if (0 == $totalRows_rsSearch) { echo h3Sorry no products were found/h3; } else echo h3Please click on a product for further information./h3 ? But I want to add the following so that only the products table appears when product are present. I cannot seem to add this code into the above after the echo h3Please click on a product for further information./h3. I can't get the syntax right ... I appreciate everyones help -- - Gary Maddock-Greene Ashley Sheridan a...@ashleysheridan.co.uk wrote in message news:1229878234.4229.12.ca...@localhost.localdomain... On Sun, 2008-12-21 at 11:39 -0500, Anthony Gentile wrote: if (0 == $totalRows_rsSearch) { echo Sorry no products were found; } else Anthony Gentile On Sun, Dec 21, 2008 at 11:22 AM, Gary Maddock-Greene g...@maddock-greene.co.uk wrote: I have tried that but to no avail :) ?php if ($totalRows_rsSearch=0) echo Sorry no products were found; else // All seems OK to here, then the syntax error unexpected T_VARIABLE appears echo h3Please click on a product for further information./h3 ?php do { ? div class=productitemimg src=products?php echo $row_rsSearch['product_image']; ? / div class=text h3?php echo $row_rsSearch['product_name']; ?/h3 p class=style1?php echo $row_rsSearch['product_subtitle']; ?/p a href=products?php echo $row_rsSearch['product_url']; ?View Product/a div class=clear/div /div div class=clear/div center /center /div ?php } while ($row_rsSearch = mysql_fetch_assoc($rsSearch)); ? -- - Gary Maddock-Greene Ashley Sheridan a...@ashleysheridan.co.uk wrote in message news:1229875150.4229.9.ca...@localhost.localdomain... On Sun, 2008-12-21 at 15:40 +, Gary Maddock-Greene wrote: Thanks Ashley ... I have been trying that but I think my syntax id shot!! ?php if ($totalRows_rsSearch=0) echo Sorry no products were found; else echo h3Please click on a product for further information./h3 ? !-- Product block start search results -- ?php do { ? div class=productitemimg src=products?php echo $row_rsSearch['product_image']; ? / div class=text h3?php echo $row_rsSearch['product_name']; ?/h3 p class=style1?php echo $row_rsSearch['product_subtitle']; ?/p a href=products?php echo $row_rsSearch['product_url']; ?View Product/a div class=clear/div
Re: [PHP] eof bof in php
thanks for the advice re html and php mashup!! I will research to find the way to do it outside the php. - Gary Maddock-Greene Anthony Gentile asgent...@gmail.com wrote in message news:2ce4207d0812211021g215d5346wb0afcedf039ef...@mail.gmail.com... ?php if (0 == $totalRows_rsSearch) { echo h3Sorry no products were found/h3; } else { echo h3Please click on a product for further information./h3; while ($row_rsSearch = mysql_fetch_assoc($rsSearch)){ echo div class=\productitem\img src=\products\. $row_rsSearch['product_image']. div class=\text\ h3. $row_rsSearch['product_name']./h3 p class=\style1\. $row_rsSearch['product_subtitle'] . /p a href=\products\. $row_rsSearch['product_url'].View Product/a div class=\clear\/div /div div class=\clear\/div center /center /div; } } ? is probably going to give you the result you want. However you should know it is bad practice to mix PHP and HTML as horridly as I just showed you. AKA you don't want your PHP writing your HTML. Anthony Gentile On Sun, Dec 21, 2008 at 1:07 PM, Gary Maddock-Greene g...@maddock-greene.co.uk wrote: I've corrected those errors thanks but how do I insert this code as the else statement? ?php do { ? div class=productitemimg src=products?php echo $row_rsSearch['product_image']; ? / div class=text h3?php echo $row_rsSearch['product_name']; ?/h3 p class=style1?php echo $row_rsSearch['product_subtitle']; ?/p a href=products?php echo $row_rsSearch['product_url']; ?View Product/a div class=clear/div /div div class=clear/div center /center /div ?php } while ($row_rsSearch = mysql_fetch_assoc($rsSearch)); ? -- - Gary Maddock-Greene Anthony Gentile asgent...@gmail.com wrote in message news:2ce4207d0812210959k3491690ctbc4f0dbf971ac...@mail.gmail.com... ...missing semicolon and some brackets. ?php if (0 == $totalRows_rsSearch) { echo h3Sorry no products were found/h3; } else { echo h3Please click on a product for further information./h3; } ? If there is more code you can show by perhaps pasting here: http://pastebin.redlinktech.com We can help with further syntax problems. Anthony Gentile On Sun, Dec 21, 2008 at 12:33 PM, Gary Maddock-Greene g...@maddock-greene.co.uk wrote: Thanks guys .. I can get this part working great .. ?php if (0 == $totalRows_rsSearch) { echo h3Sorry no products were found/h3; } else echo h3Please click on a product for further information./h3 ? But I want to add the following so that only the products table appears when product are present. I cannot seem to add this code into the above after the echo h3Please click on a product for further information./h3. I can't get the syntax right ... I appreciate everyones help -- - Gary Maddock-Greene Ashley Sheridan a...@ashleysheridan.co.uk wrote in message news:1229878234.4229.12.ca...@localhost.localdomain... On Sun, 2008-12-21 at 11:39 -0500, Anthony Gentile wrote: if (0 == $totalRows_rsSearch) { echo Sorry no products were found; } else Anthony Gentile On Sun, Dec 21, 2008 at 11:22 AM, Gary Maddock-Greene g...@maddock-greene.co.uk wrote: I have tried that but to no avail :) ?php if ($totalRows_rsSearch=0) echo Sorry no products were found; else // All seems OK to here, then the syntax error unexpected T_VARIABLE appears echo h3Please click on a product for further information./h3 ?php do { ? div class=productitemimg src=products?php echo $row_rsSearch['product_image']; ? / div class=text h3?php echo $row_rsSearch['product_name']; ?/h3 p class=style1?php echo $row_rsSearch['product_subtitle']; ?/p a href=products?php echo $row_rsSearch['product_url']; ?View Product/a div class=clear/div /div div class=clear/div center /center /div ?php } while ($row_rsSearch = mysql_fetch_assoc($rsSearch)); ? -- - Gary Maddock-Greene Ashley Sheridan a...@ashleysheridan.co.uk wrote in message news:1229875150.4229.9.ca...@localhost.localdomain... On Sun, 2008-12-21 at 15:40 +, Gary Maddock-Greene wrote: Thanks Ashley ... I have been trying that but I think my syntax id shot!! ?php if ($totalRows_rsSearch=0) echo Sorry no products were found; else echo h3Please click on a product for further information./h3 ? !-- Product block start search results -- ?php do { ? div class=productitemimg src=products?php echo $row_rsSearch['product_image']; ? / div class=text h3?php echo $row_rsSearch['product_name']; ?/h3 p class=style1?php echo $row_rsSearch['product_subtitle']; ?/p a href=products?php echo $row_rsSearch['product_url']; ?View Product/a div class=clear/div /div div class=clear/div center /center /div ?php } while ($row_rsSearch =
Re: [PHP] eof bof in php
I guess you are right about mixing php with html. Actually the suggestion you gave breaks my search function. If I now search for a product called 'type 22' the space and first digit 2 breaks the serach. Also the \ in the htnl / php is causing a break in the image path urls ... so back to the drawing board for me :) -- - Gary Maddock-Greene Gary Maddock-Greene g...@maddock-greene.co.uk wrote in message news:b4.82.23981.dee8e...@pb1.pair.com... thanks for the advice re html and php mashup!! I will research to find the way to do it outside the php. - Gary Maddock-Greene Anthony Gentile asgent...@gmail.com wrote in message news:2ce4207d0812211021g215d5346wb0afcedf039ef...@mail.gmail.com... ?php if (0 == $totalRows_rsSearch) { echo h3Sorry no products were found/h3; } else { echo h3Please click on a product for further information./h3; while ($row_rsSearch = mysql_fetch_assoc($rsSearch)){ echo div class=\productitem\img src=\products\. $row_rsSearch['product_image']. div class=\text\ h3. $row_rsSearch['product_name']./h3 p class=\style1\. $row_rsSearch['product_subtitle'] . /p a href=\products\. $row_rsSearch['product_url'].View Product/a div class=\clear\/div /div div class=\clear\/div center /center /div; } } ? is probably going to give you the result you want. However you should know it is bad practice to mix PHP and HTML as horridly as I just showed you. AKA you don't want your PHP writing your HTML. Anthony Gentile On Sun, Dec 21, 2008 at 1:07 PM, Gary Maddock-Greene g...@maddock-greene.co.uk wrote: I've corrected those errors thanks but how do I insert this code as the else statement? ?php do { ? div class=productitemimg src=products?php echo $row_rsSearch['product_image']; ? / div class=text h3?php echo $row_rsSearch['product_name']; ?/h3 p class=style1?php echo $row_rsSearch['product_subtitle']; ?/p a href=products?php echo $row_rsSearch['product_url']; ?View Product/a div class=clear/div /div div class=clear/div center /center /div ?php } while ($row_rsSearch = mysql_fetch_assoc($rsSearch)); ? -- - Gary Maddock-Greene Anthony Gentile asgent...@gmail.com wrote in message news:2ce4207d0812210959k3491690ctbc4f0dbf971ac...@mail.gmail.com... ...missing semicolon and some brackets. ?php if (0 == $totalRows_rsSearch) { echo h3Sorry no products were found/h3; } else { echo h3Please click on a product for further information./h3; } ? If there is more code you can show by perhaps pasting here: http://pastebin.redlinktech.com We can help with further syntax problems. Anthony Gentile On Sun, Dec 21, 2008 at 12:33 PM, Gary Maddock-Greene g...@maddock-greene.co.uk wrote: Thanks guys .. I can get this part working great .. ?php if (0 == $totalRows_rsSearch) { echo h3Sorry no products were found/h3; } else echo h3Please click on a product for further information./h3 ? But I want to add the following so that only the products table appears when product are present. I cannot seem to add this code into the above after the echo h3Please click on a product for further information./h3. I can't get the syntax right ... I appreciate everyones help -- - Gary Maddock-Greene Ashley Sheridan a...@ashleysheridan.co.uk wrote in message news:1229878234.4229.12.ca...@localhost.localdomain... On Sun, 2008-12-21 at 11:39 -0500, Anthony Gentile wrote: if (0 == $totalRows_rsSearch) { echo Sorry no products were found; } else Anthony Gentile On Sun, Dec 21, 2008 at 11:22 AM, Gary Maddock-Greene g...@maddock-greene.co.uk wrote: I have tried that but to no avail :) ?php if ($totalRows_rsSearch=0) echo Sorry no products were found; else // All seems OK to here, then the syntax error unexpected T_VARIABLE appears echo h3Please click on a product for further information./h3 ?php do { ? div class=productitemimg src=products?php echo $row_rsSearch['product_image']; ? / div class=text h3?php echo $row_rsSearch['product_name']; ?/h3 p class=style1?php echo $row_rsSearch['product_subtitle']; ?/p a href=products?php echo $row_rsSearch['product_url']; ?View Product/a div class=clear/div /div div class=clear/div center /center /div ?php } while ($row_rsSearch = mysql_fetch_assoc($rsSearch)); ? -- - Gary Maddock-Greene Ashley Sheridan a...@ashleysheridan.co.uk wrote in message news:1229875150.4229.9.ca...@localhost.localdomain... On Sun, 2008-12-21 at 15:40 +, Gary Maddock-Greene wrote: Thanks Ashley ... I have been trying that but I think my syntax id shot!! ?php if ($totalRows_rsSearch=0) echo Sorry no products were found; else echo h3Please click on a product for further information./h3 ? !-- Product block start search results -- ?php do { ? div class=productitemimg
Re: [PHP] eof bof in php
I guess you are right about mixing php with html. Actually the suggestion you gave breaks my search function. If I now search for a product called 'type 22' the space and first digit 2 breaks the serach. Also the \ in the htnl / php is causing a break in the image path urls ... so back to the drawing board for me :) -- - Gary Maddock-Greene Gary Maddock-Greene g...@maddock-greene.co.uk wrote in message news:b4.82.23981.dee8e...@pb1.pair.com... thanks for the advice re html and php mashup!! I will research to find the way to do it outside the php. - Gary Maddock-Greene Anthony Gentile asgent...@gmail.com wrote in message news:2ce4207d0812211021g215d5346wb0afcedf039ef...@mail.gmail.com... ?php if (0 == $totalRows_rsSearch) { echo h3Sorry no products were found/h3; } else { echo h3Please click on a product for further information./h3; while ($row_rsSearch = mysql_fetch_assoc($rsSearch)){ echo div class=\productitem\img src=\products\. $row_rsSearch['product_image']. div class=\text\ h3. $row_rsSearch['product_name']./h3 p class=\style1\. $row_rsSearch['product_subtitle'] . /p a href=\products\. $row_rsSearch['product_url'].View Product/a div class=\clear\/div /div div class=\clear\/div center /center /div; } } ? is probably going to give you the result you want. However you should know it is bad practice to mix PHP and HTML as horridly as I just showed you. AKA you don't want your PHP writing your HTML. Anthony Gentile On Sun, Dec 21, 2008 at 1:07 PM, Gary Maddock-Greene g...@maddock-greene.co.uk wrote: I've corrected those errors thanks but how do I insert this code as the else statement? ?php do { ? div class=productitemimg src=products?php echo $row_rsSearch['product_image']; ? / div class=text h3?php echo $row_rsSearch['product_name']; ?/h3 p class=style1?php echo $row_rsSearch['product_subtitle']; ?/p a href=products?php echo $row_rsSearch['product_url']; ?View Product/a div class=clear/div /div div class=clear/div center /center /div ?php } while ($row_rsSearch = mysql_fetch_assoc($rsSearch)); ? -- - Gary Maddock-Greene Anthony Gentile asgent...@gmail.com wrote in message news:2ce4207d0812210959k3491690ctbc4f0dbf971ac...@mail.gmail.com... ...missing semicolon and some brackets. ?php if (0 == $totalRows_rsSearch) { echo h3Sorry no products were found/h3; } else { echo h3Please click on a product for further information./h3; } ? If there is more code you can show by perhaps pasting here: http://pastebin.redlinktech.com We can help with further syntax problems. Anthony Gentile On Sun, Dec 21, 2008 at 12:33 PM, Gary Maddock-Greene g...@maddock-greene.co.uk wrote: Thanks guys .. I can get this part working great .. ?php if (0 == $totalRows_rsSearch) { echo h3Sorry no products were found/h3; } else echo h3Please click on a product for further information./h3 ? But I want to add the following so that only the products table appears when product are present. I cannot seem to add this code into the above after the echo h3Please click on a product for further information./h3. I can't get the syntax right ... I appreciate everyones help -- - Gary Maddock-Greene Ashley Sheridan a...@ashleysheridan.co.uk wrote in message news:1229878234.4229.12.ca...@localhost.localdomain... On Sun, 2008-12-21 at 11:39 -0500, Anthony Gentile wrote: if (0 == $totalRows_rsSearch) { echo Sorry no products were found; } else Anthony Gentile On Sun, Dec 21, 2008 at 11:22 AM, Gary Maddock-Greene g...@maddock-greene.co.uk wrote: I have tried that but to no avail :) ?php if ($totalRows_rsSearch=0) echo Sorry no products were found; else // All seems OK to here, then the syntax error unexpected T_VARIABLE appears echo h3Please click on a product for further information./h3 ?php do { ? div class=productitemimg src=products?php echo $row_rsSearch['product_image']; ? / div class=text h3?php echo $row_rsSearch['product_name']; ?/h3 p class=style1?php echo $row_rsSearch['product_subtitle']; ?/p a href=products?php echo $row_rsSearch['product_url']; ?View Product/a div class=clear/div /div div class=clear/div center /center /div ?php } while ($row_rsSearch = mysql_fetch_assoc($rsSearch)); ? -- - Gary Maddock-Greene Ashley Sheridan a...@ashleysheridan.co.uk wrote in message news:1229875150.4229.9.ca...@localhost.localdomain... On Sun, 2008-12-21 at 15:40 +, Gary Maddock-Greene wrote: Thanks Ashley ... I have been trying that but I think my syntax id shot!! ?php if ($totalRows_rsSearch=0) echo Sorry no products were found; else echo h3Please click on a product for further information./h3 ? !-- Product block start search results -- ?php do { ? div class=productitemimg src=products?php echo