Jump to content


  • Posts

  • Joined

  • Last visited

Everything posted by HuggieBear

  1. Sounds like a reasonable idea.  No need for a user_name column though  ;D Then you could use the avg() function to get the result. Regards Rich
  2. I think this link will be useful to you  ;) [url=http://developer.intuit.com/QuickBooksSDK/Resources/Default.asp?id=97]Intuit Development[/url] I also just "Googled" [url=http://www.google.co.uk/search?q=quickbooks+%2Bwebsite+%2Bintegrate]quickbooks +website +integrate[/url] and got some good results. Regards Rich
  3. I'd go for something like this: index.php [code]<?php   include_once('functions.php');   $page = $_SERVER['PHP_SELF'];   createnav($page); ?>[/code] Then functions.php looks like this: [code]<?php function createnav($var){   preg_match("/([^\/]+)$/", $var, $missing_page);   $pages = array(   "Home" => "index.php",   "Contact Me" => "contact.php",   "Google" => "http://www.google.co.uk"   );   foreach ($pages as $page => $link){       if ($link != $missing_page[0]){         echo "<a href=\"$link\">$page</a><br>";       }   } } ?>[/code] This should work.  You just include a list of pages in the array inside the function.  It's not ideal if you have a lot of pages, but could be adapted. [size=8pt][color=red][b]EDIT: [/b][/color]I've updated the above code and it should work fine.[/size] Regards Rich
  4. Yes, it's all possible. [color=blue][b]addhotel.php[/b] - They can add in new hotels, this page will contain the dynamically generated drop down menus for both country and region, along with the additional fields you're after (Image, description etc).  If the hotel's in a new region they can click a text link next to the region drop down to take them to a new page to add a region. [b]addregion.php[/b] - Here they can add a new region by typing its name in a text box and selecting the country from a dynamically generated drop down.  If the country doesn't exist then they can click the text link next to the country drop down to take them to a new page to add a country. [b]addcountry.php[/b] - Here they can add a new country in a text box.[/color] It's important to note that they must assign the hotel to a region and the region to the country. Regards Rich
  5. Yes, that's no problem, it's perfectly achievable with what you have. I'm not sure what you're doing with the back-end, but yes, the front end can do that without issue. Rich
  6. No, you can set it up so that it shows the hotel name... Here's an example: [code=php:0] $sql = "SELECT hotelName FROM tblHotel where regionID = $row_rsRegion['id']"; [/code] Regards Rich
  7. lol... I read that and then completely disregarded it... My bad and apologies  :-[ A side note, you might want to close the <!DOCTYPE tag at the tom of the HTML. Regards (A very embarrassed) HuggieBear
  8. I would imagine that PHP just isn't installed. Rich
  9. Not country name, country ID.  Look at my previous structure.... [color=green][b]tabCountry[/b] - countryID, countryName [b]tabRegion[/b] - regionID, countryID, regionName [b]tabHotel[/b] - hotelID, regionID, hotelName, hotelImage, hotelDescription, hotelRating [/color] Rich
  10. [quote] so just to clarify, without changing the tables, I could do that with what i have got at the moment [/quote] No, as you have it now, with your current database structure, you have no way of linking the region to the country.  This means if you have three countries in your country list, and want to display the regions based on one particular country you can't, and this is exactly your problem. [code=php:0] SELECT * FROM tabRegion WHERE regionName = '".$row_rsCountry['Id']."'. [/code] Your code references a column that doesn't make sense I've put dummy examples in to illustrate... [color=red]Select all columns from the table tabRegion where the region name (London) is equal to $row_rsCountry['Id'] (5)[/color] Your regionName column is going to be a logical name (I'm assuming) but you're trying to link it to countryID which is going to be a number.  They're never going to match. Can you see what I'm getting at here? If you had a countryID column in tblRegion then you'd almost be there, but the above would need to look like this: [code=php:0] SELECT * FROM tabRegion WHERE countryID = '".$row_rsCountry['Id']."'. [/code] Regards Rich
  11. Your code in the front-end would possibly need changing too, but with the tables setup as they are, you can get the following: All Countries, All Regions in a specific country, All Hotels in a specific country, All Regions, All Hotels in a specific region, All Hotels. Regards Rich
  12. David, that IF statement appears to be constructed correctly yes. Regards Rich
  13. Id say you needed them as follows: [color=green][b]tabCountry[/b] - countryID, countryName [b]tabRegion[/b] - regionID, countryID, regionName [b]tabHotel[/b] - hotelID, regionID, hotelName, hotelImage, hotelDescription, hotelRating[/color] This way you can cascade down. Regards Rich
  14. I have a question, if you already have $surname_autor and $name_autor, why not just include them in the original sql statement and only add them if neither are a match? [code] $query="SELECT id, name, surname FROM autors WHERE name = '$name_autor' AND surname='$surname_autor'"; $result=mysql_query($query); if (mysql_num_rows($result)) {   $autorID=$row['id'];   echo "Existing record with ID :$autorID } else {   mysql_query("INSERT INTO autors (name, surname) VALUES ('$name_autor', '$surname_autor')") or die(mysql_error());   $autorID=mysql_insert_id();   echo "Autor ID is :$autorID } [/code] Regards Rich
  15. The above table structure would allow for that and you wouldn't need to save any details about them. Regards Rich
  16. OK, don't worry, How about something like this. [color=green][size=8pt][b]Table 1[/b] (members) - unique_id, member_name, team_id, manager_id [b]Table 2[/b] (teams) - unique_id, team_name, manager_id[/size][/color] This will allow you to do everything you need.  Do you want a few examples? Regards Rich
  17. OK, now it's starting to make sense, did you design the tables or did you get this script from somewhere as a 'pre-built'? I think the database design is slightly out. Regards Rich
  18. Sounds like a very bad idea! I can't see exactly what you're trying to do here, but your database design is key... You could probably do what you're after with two or three tables and save yourself a hell of a lot of coding. [color=green][size=8pt][b]Table 1[/b] (members) - unique_id, member_name, team_id [b]Table 2[/b] (teams) - unique_id, team_name[/size][/color] You can link the member.team_id to the teams.unique_id to receive the info you needed. Regards Rich
  19. Please can you post the solution... Regards Rich
  20. [code=php:0] mysql_query("SELECT * FROM tabCountry WHERE 'Id' ORDER BY 'countryName' ") or die(mysql_error()); [/code] I'm assuming that with this piece of code that you want to select every country?  If so, you can drop the [color=red]WHERE 'id'[/color] as it's not actually doing anything unless you specify something after it, such as [color=red]WHERE id = '$num'[/color] We seem to be going around the houses here, to help us to help you, can you provide us with your table names and a list of the columns in those tables? Regards Rich
  21. Is there a column called ID in the table called ID? Regards Rich [size=8pt][b]Edit:[/b] Ooops, beaten to it...[/size]
  22. [quote] hey [b]HuggieBear[/b], yeah could i get that code? that would be FANTASTIC!! lol thx!!! [/quote] I'll post it after I've made the comments on it, they should help you to understand it a bit better and hopefully help you to do it yourself in the future.  Incidently, I managed to achieve it just by searching posts on this forum. Regards Rich [size=8pt][b]EDIT:[/b] Code below.  You'll need to add your own SQL statements (which I'm happy to 'help' with if you provide your table structure) and in the fields where I've left my $row['column_name'] variables, you'll need to substitute these for your own.[/size] [code] <?php // Your user for use in the select statement (YOUR CODE) $user = $_SESSION['username']; // Include your DB connection stuff here include('connect.php'); // If page number exists, use it, if not, set one (PAGINATION) if(!isset($_GET['page'])){ $page = 1; } else { $page = $_GET['page']; } // Define the number of results per page (PAGINATION) $max_results = 3; // Figure out the limit for the query based on the current page number (PAGINATION) $from = (($page * $max_results) - $max_results); // I've not included a sql statement as you'll need to write this based on your table structure // but remember to include the important bit which is the LIMIT as we need this for pagination // LIMIT $from, $max_results $sql="Your sql statement goes here"; $result = mysql_query($sql); $friend = null; // This must be set outside the while loop (FRIEND HEADER) while ($row = mysql_fetch_array($result, MYSQL_ASSOC)){   $user_id = $row['username']; // Start of header code (FRIEND HEADER)   if (is_null($friend) || strcmp($friend,$user_id) !=0){       $friend = $row['username'];       // I had a tidy up of what you had already using heredoc (YOUR CODE)       echo <<<HTML         <br> <table bgcolor="#99CCFF" width="500">   <tr bgcolor="#99CCFF">     <td height="28">       <font color="white"><b>From: $row[username]</b></font>     </td>   </tr> </table> HTML; // End of friend header code (FRIEND HEADER)   } $bg = ($bg == "#CCFF99" ? "#CCCC99" : "#CCFF99"); // Assign color to variable (COLOR ALTERNATION) // I had a tidy up of what you had already using heredoc (YOUR CODE)   echo <<<HTML <table bgcolor="#99CCFF" width="500">   <tr bgcolor="$bg"> <!-- Notice the variable instead of color (COLOR ALTERNATION) -->     <td height="25">       <font color="white"><b>Date: </b>$row[date] - </font>$row[title]     </td>   </tr> </table> HTML; } // Figure out the total number of results in DB (PAGINATION) // This sql statement will be almost identical to what you have above. // we can't just use 'SELECT * FROM bulletins' as we don't want to know // all the results, only a select few. $total_results = mysql_result(mysql_query("Same as previous query"),0); // Figure out the total number of pages. Always round up using ceil() $total_pages = ceil($total_results / $max_results); //Previous and next links $plink = "&lt;&lt; Previous"; $nlink = "Next &gt;&gt;"; echo "<center>"; // Build Previous Link if($page > 1){ $prev = ($page - 1); echo "<a href=\"".$_SERVER['PHP_SELF']."?page=$prev\">$plink</a> "; } for($i = 1; $i <= $total_pages; $i++){ if(($page) == $i){ echo "$i "; } else { echo "<a href=\"".$_SERVER['PHP_SELF']."?page=$i\">$i</a> "; } } // Build Next Link if($page < $total_pages){ $next = ($page + 1); echo "<a href=\"".$_SERVER['PHP_SELF']."?page=$next\">$nlink</a>"; } echo "</center>"; ?> [/code]
  23. Show us the code for the page you get the error on. Regards Rich
  24. If you echo $thumb_name do you get the desired file name? Are you specifying the whole path, you may want to make sure if you're not in the same directory that you do this. Regards Rich
  25. Try splitting the code rather than nesting... [code] $sql = "SELECT * FROM extra_logros WHERE date = '$today' AND sector_id = '$sect_id' AND ward_id = $ward_id"; $result = mysql_query($sql); if (mysql_num_rows($result) <1){   // Do stuff } [/code] Regards Rich
  • 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.