Jump to content

wildteen88

Staff Alumni
  • Posts

    10,480
  • Joined

  • Last visited

    Never

Everything posted by wildteen88

  1. Pardon? Not fully understanding you. Are you saying your newlines are not being displayed? If so you'll need to convert newlines to <br /> in order for then to display on your page. PHP has a built in function which handles this for you called nl2br()
  2. This is due to the comparison operator you are using here for($i = 0; $i < count($array1); $i++) { the < means less than. Say your array contained 3 items. The for loop will only iterate 2 times not 3. In order for it to iterate 3 times you'll need to use the less than or equal to operator (<=). EDIT: Ignore me.
  3. Your now need to configure phpMyAdmin to use your new mysql username/password I recommend you to find phpMyAdmins configuration file (config.inc.php) and find the following line $cfg['Servers'][$i]['auth_type'] = 'config'; Change config to http instead. Now when you access phpMyAdmin a login prompt will be displayed.
  4. Then you'll specify a second rewrite rule. RewriteEngine on RewriteCond %{SCRIPT_FILENAME} !-f RewriteCond %{SCRIPT_FILENAME} !-d # matches berwari.net/movies/40 RewriteRule ^(.*)/([0-9]+) index.php?display=$1&n=$2 [L] # matches berwari.net/movies RewriteRule ^(.*) index.php?display=$1 [L]
  5. Your could use array_map instead $query = "SELECT `name` FROM `table1` WHERE `name` IN('". implode("','", array_map('trim', $array1)) . "') ORDER BY CHAR_LENGTH(name) DESC"; Alternatively it could be done when you generate your $array1 array
  6. You're still getting your braces mixed up. if( isset($_COOKIE['step1']) && !isset($_COOKIE['step2']) )
  7. Your're missing a closing brace on this line:
  8. nl2br() will convert newlines to <br /> tags. NOTE: Only nl2br when you're grabbing data from the database. I do not recommend using nl2br when inserting data into the database.
  9. Wouldn't you be better of merging all the if/elseif's for the $sum_weight being 0.00 to 1.00 into just one? Seems pointless having 8 or so conditions that return the same result. Also rather than use || (or) use && (and) <?php function calculate_weight_and_postage($customers_country, $sum_weight) { // the 2 arguments we are taking are the customers country and the sum weight of the order print $sum_weight; // UK if ($customers_country == "United Kingdom") { // sub if if ($sum_weight > 0.00 && $sum_weight < 1.00) { $weightPostage = array("1.50" => "Standard - £1.50 incl VAT"); // return us the weight and postage to use return $weightPostage; } elseif ($sum_weight > 1.00 && $sum_weight < 1.10) { $weightPostage = array("2.95" => "Standard - £2.95 incl VAT"); // return us the weight and postage to use return $weightPostage; } else { $weightPostage = array("3.95" => "Standard - £3.95 incl VAT"); return $weightPostage; } return $weightPostage; } // UK } ?>
  10. No need to install anything. You just write the necessary code for your BBCode parser. In order to write your own you'll need to know some basic PHP syntax and have an understanding of regular expressions.
  11. You could of just used implode $query = "SELECT `name` FROM `table1` WHERE `name` IN('". implode("','", $array1) . "') ORDER BY CHAR_LENGTH(name) DESC"; Which will produce this query: SELECT `name` FROM `table1` WHERE `name` IN('Item0','Item1', etc) ORDER BY CHAR_LENGTH(name) DESC Using IN() instead name='name1' ORr name='name2' etc is more efficient.
  12. It would be helpful if you posted your code / regex pattern here too
  13. This: echo "<td valign=top>". $row['detail_description'] . "</td>"; Needs to be echo "<td valign=top>". $desc . "</td>";
  14. Oh! You're after BBCodes. There are many tutorials for adding BBCodes to your site.
  15. PHPBB is a forum like this one here. Are you wanting to install a forum? PHPBB will install its own database.
  16. Your HTML code needs to be within your while loop otherwise only the last result will be displayed. <table width="800" align="center"> <tr> <td width="100%" align="center"> <?php //Website url $websiteurl = WEBSITEURL; //Retrieve gallery info $galleryselect = "SELECT * FROM gallery ORDER BY id ASC"; if ($galleryresult = mysql_query ($galleryselect)) { while ($row = mysql_fetch_array ($galleryresult)) { $gallery = $row['image']; echo '<img src="'.$websiteurl.'/images/gallery/'.$gallery.'" />'; } } ?> </td> </tr> </table>
  17. Something like the following should do $sql = 'SELECT * FROM your_table'; $result = mysql_query($sql) or die('MySQL Error: ' . mysql_error()); while($row = mysql_fetch_assoc($result)) { $desc = short_description($row['description']); echo $desc; } function short_description($text, $max_lines = 4) { // standardize new lines $text = str_replace(array("\r\n", "\r"), "\n", $text); // get each line $lines = explode("\n", $text); // retieive the requires lines $list = array(); for($i = 0; $i <= $max_lines; $i++) { $list[] = $lines[$i]; } // add closing ul tag $list[] = '</ul>'; return implode("\n", $list); }
  18. phpBB is forum software. Got to phpbb.com for more info.
  19. In what format is the data in your description field, eg Format 1 Line 1<br />Line 2<br />Line 3 Or, Format 2 Line 1<br /> Line 2<br /> Line 3 Or Line 1 Line 2 Line 3 We'll need to know this in order for us to provide a suitable answer.
  20. Yes just specify the domain or the IP address for the mysql server you're wanting to connect to.
  21. Argh, Its your for loop that is the cause. Your post_values sessions variable is an associative array, however your using a number to access each item in the array. This is not possible. Instead your should use a foreach loop foreach($_SESSION['post_values'] as $field_name => $file_value) { if(empty($field_value)) $_SESSION['post_values'][$field_name] = ' '; }
  22. Something must be going on in your code. Post your code here.
  23. Use the SHOW DATABASES sql command to get all the databases that currently exist. Then use a while loop to loop through the available databases, eg $sql = 'SHOW DATABASES'; $result = mysql_query($sql) or die ('MySQL Error: ' . mysql_error()); $my_database = 'YOUR DATABASE NAME'; while(list($db_name) = mysql_fetch_row($result)) { if($db_name == $my_database ) { echo $my_database . ' exists!'; } }
  24. Post your actual code here. The snippets you provided are fine. Maybe there is something else in your code that is causing it.
  25. WAMP has phpMyAdmin configured for you. To access phpMyAdmin open the WAMP taskbar icon, this will open a context menu. From the menu choose PHPMyAdmin. A web browser should open showing phpMyAdmin.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.