Jump to content

bach

Members
  • Posts

    16
  • Joined

  • Last visited

    Never

Posts posted by bach

  1. Hi,

    I have been thinking of writing an web application for a member based system. I have come up with an initial DB design and would like some feedback advise next step's etc as this is the first time I am doing this.

     

    Concept

    To hold information about its members and what roles they do, it needs to be simple, fast and functional.

    There are many aspects of this system for future development for building information, availability information etc so this needs to be thought about in the initial stages so a re-design will not be necessary.

     

    Thanks.

  2. I have the following SELECT statement
    [code]SELECT s_name, s_firstname, CONCAT_WS('-', LEFT(s_phone, 4), MID(s_phone, 5, 3), RIGHT(s_phone, 4))
    FROM `bridgend`.`sam`
    ORDER BY s_name asc;[/code]

    When displaying s_phone nothing is displayed on the my site.  s_name and s_firstname is displayed would I somehow have to put concat_ws in a temp variable so I can display it on my site.

    Regards
  3. Craygo,

    Thanks for your help.

    The only thing that did not work is the s_phone, I would like to display the newly formated data I am missing something here.

    Just to make sure I understand the code.
    [code]$result = mysql_query($phonelist) or die("Error: ".mysql_error()."<br />");
    $num_rows = mysql_num_rows($result);[/code]
    $result is the query on the database using the select statement and returns an error if there is a problem
    $num_rows just counts number of rows returned by query ??

    [code]while ($row = mysql_fetch_array($result)){[/code]
    as long as $row has data in it will stay in the while loop ?
  4. Hello,

    I have the following MySQL statement
    [code]SELECT s_name, s_firstname, CONCAT_WS('-', LEFT(s_phone, 4), MID(s_phone, 5, 3), RIGHT(s_phone, 4))
    FROM `bridgend`.`sam`
    ORDER BY s_name asc;[/code]

    I want to display the details of this in a table and loop round until the all records are displayed.

    This is what I have so far but there problems would be greatful for some help.
    [code]<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" lang="en-gb">
    <head>
      <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
    </head>
    <body>
    <?php
    include("condb.php");

    $phonelist =
    "SELECT s_name, s_firstname, CONCAT_WS('-', LEFT(s_phone, 4), MID(s_phone, 5, 3), RIGHT(s_phone, 4))
    FROM `bridgend`.`sam`
    ORDER BY s_name asc;";

    $result = mysql_query($phonelist);

    if (!$result)

    {

    Print("Error: ".mysql_error()."<br />");

    die();

    }

    ?>
    <h1>Title</h1>
    <h2>Phone</h2>
    <table style="text-align: left; width: 100%;" border="0" cellpadding="2" cellspacing="2">
      <tbody>
        <tr>
          <td>Nick</td>
          <td>Ask for</td>
          <td>Contact Number</td>
        </tr>
    <?php   
    if ($row = mysql_fetch_array($phonelist))

    {

    while ($row = mysql_fetch_array($phonelist))

    {
    ?>
        <tr>
          <td><?php print $row["s_name"]; ?></td>
          <td><?php print $row["s_firstname"]; ?></td>
          <td><?php print $row["s_phone"]; ?></td>
        </tr>
    <?php
        } //End While
    } //End if
    ?>
      </tbody>
    </table>
    </body>
    </html>[/code]

    I am not sure if this will fully work with printing s_phone when I am using concat in the query but the problem at present seems to be with [code]if ($row = mysql_fetch_array($phonelist))[/code]
  5. Hello,

    The following code is an example of the menu code contained on all the fundraising pages.

    [code]
    <ul>
    <li><a href="../index.xhtml">Home</a></li>
    <li><a href="../about/about.xhtml">About</a></li>
    <li>Join Us</li>
    <li>Outreach</li>
    <li>News &amp; Events</li>
    <li><a href="fund.xhtml">Fundraising</a></li>
    <ul>
    <li><a href="campaigns.xhtml">Current Campaigns</a></li>
    <li>Help Us Raise Funds</li>
    <li>Donations</li> </ul>
    <li>Contact Us</li></ul>[/code]

    My question is that on each page with a sub-menu like Fundraising I need to change the menu/sub-menu. Is it possible for me to write the whole menu and sub-menus and use php to check which submenus should be shown?

    Bach
  6. Hello,

    I would like to create a function/class (not sure which one appropriate) to log errors to a file.

    To start with I would like to create a 'errorlog.txt' file where every mysql error message will be writen so I would be able to check the error log to see if anyone has been having issues login into database, etc.

    Now I have the mysql error being displayed as part of my connection but I do not want the user to see this message.

    So I would need to store that into a file instead I have no idea on this anyone able to help ?

    Bach.
  7. [!--quoteo(post=375747:date=May 21 2006, 01:06 PM:name=annihilate)--][div class=\'quotetop\']QUOTE(annihilate @ May 21 2006, 01:06 PM) [snapback]375747[/snapback][/div][div class=\'quotemain\'][!--quotec--]
    Try getting rid of the $ infront of mysql_select_db
    [/quote]

    Thanks for your reply,

    I can't believe i missed it cheers
  8. Can you help I have got an if statement which is got an error

    Error
    Fatal error: Call to undefined function: () in sam/db.php on line 22

    [code]
    if(!$connection = mysql_pconnect($host, $username, $password))
    {
      $message = mysql_error();
      echo $message."<br />";
      die();
    }
    line 22 - elseif (!$mysql_select_db($database, $connection))
    {
      $message = mysql_error();
      echo $message."<br />";
      die();
    }[/code]
  9. I was under the sam impression, if there isn't a good reason then I will use a date field for mine.

    The forum software was

    [a href=\"http://www.simplemachines.org/\" target=\"_blank\"]Simple Machine Forum[/a]

    Cheers.
  10. Hello,

    Wonder if you can help. I am looking at the data type of the dateRegistered field for a form script I have got they are using int(10) why ?? why not date ??

    Confusing me.

    Cheers.
×
×
  • 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.