+ Reply to Thread
Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: PHP/MySQL Programming

  1. #1
    driveflexfuel is offline x10 Sophmore driveflexfuel is an unknown quantity at this point
    Join Date
    Jul 2008
    Posts
    159

    PHP/MySQL Programming

    I am offering 3000 credits for someone to create the following 5 forms/pages for me.

    2 database Search pages

    1 one with radio buttons labeled business and phone number the customer can click on which one they want to search by. default is phone

    2 Search by state i have an image map where they can click on the state and it needs to display all resutls for that state on another page. Image map adds the variable page.php?state=california if you click california

    1 form to Submit new business to database
    after submission it has to display the information added on a new page and include the variable $comment_id="business" for a code that i will be adding

    Form needs to have the following inputs
    Business
    Owner_name
    phone
    Address
    City
    State
    Zipcode

    I have not yet created the database but it will have
    Database information

    Business
    Owner_Name
    phone
    Address
    City
    State
    ZipCode


    If you have any questions please feel free to ask here or message me on windows messenger email is liffesucks@hotmail.com
    Last edited by driveflexfuel; 01-18-2009 at 10:24 PM.

  2. #2
    xmakina's Avatar
    xmakina is offline x10 Lieutenant xmakina is an unknown quantity at this point
    Join Date
    May 2008
    Location
    England
    Posts
    265

    Re: PHP/MySQL Programming

    I think this belongs in the marketplace...
    IF($this->$post.content() == "SEE SIG"){
    w3Schools and Google
    }

  3. #3
    freecrm's Avatar
    freecrm is offline x10 Elder freecrm is an unknown quantity at this point
    Join Date
    May 2008
    Location
    UK
    Posts
    629

    Re: PHP/MySQL Programming

    Made a start on the first one, but I need (or someone needs) to set the column variable depending on the radio buttons.... just ran out of time.

    PHP Code:
    <?php
    mysql_connect
    ($hostname$username$password);

    $searchvar "-1";
    if (isset(
    $_POST['searchfield'])) {
      
    $searchvar = (get_magic_quotes_gpc()) ? $_POST['searchfield'] : addslashes($_POST['searchfield']);
    }

    $selectcolumnvar "PHONE";
    if (isset(
    $selectcolumn)) {
      
    $selectcolumnvar = (get_magic_quotes_gpc()) ? $selectcolumn addslashes($selectcolumn);
    }

    mysql_select_db($database);
    $query_SearchResults sprintf("SELECT * FROM TABLE WHERE %s LIKE '%%%s%%' ORDER BY COMPANY ASC"$selectcolumnvar,$searchvar);
    $SearchResults mysql_query($query_SearchResults) or die(mysql_error());
    $row_SearchResults mysql_fetch_assoc($SearchResults);
    $totalRows_SearchResults mysql_num_rows($SearchResults);
    ?>
    <html>
    <head>
    <title>Untitled Document</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    </head>

    <body>
    <form name="form1" method="post" action="">
    <p> Search for</p>
    <p><input name="searchfield" type="text" id="searchfield"></p>
    <p>in</p>
    <p>
    <label><input type="radio" name="RadioGroup1" value="Y">Business</label>
    <br>
    <label><input name="RadioGroup1" type="radio" value="phone number" checked>Phone Number</label>
    </p>
    <p>
    <input type="submit" name="Submit" value="Search">
    <br>
    </p>
    </form>
    <p>&nbsp;</p>

    <table>
      <tr>
        <td>BUSINESS</td>
        <td>OWNERNAME</td>
        <td>PHONE</td>
        <td>ADDRESS</td>
        <td>CITY</td>
        <td>STATE</td>
        <td>ZIPCODE</td>
      </tr>
      <?php do { ?>
      <tr>
        <td><?php echo $row_SearchResults['BUSINESS']; ?></td>
        <td><?php echo $row_SearchResults['OWNERNAME']; ?></td>
        <td><?php echo $row_SearchResults['PHONE']; ?></td>
        <td><?php echo $row_SearchResults['ADDRESS']; ?></td>
        <td><?php echo $row_SearchResults['CITY']; ?></td>
        <td><?php echo $row_SearchResults['STATE']; ?></td>
        <td><?php echo $row_SearchResults['ZIPCODE']; ?></td>
      </tr>
      <?php } while ($row_SearchResults mysql_fetch_assoc($SearchResults)); ?>
    </table>
    </body>
    </html>

  4. #4
    VPmase's Avatar
    VPmase is offline x10 Elder VPmase is an unknown quantity at this point
    Join Date
    Nov 2007
    Location
    Dixon, IL, USA
    Posts
    914

    Re: PHP/MySQL Programming

    Quote Originally Posted by freecrm View Post
    Made a start on the first one, but I need (or someone needs) to set the column variable depending on the radio buttons.... just ran out of time.

    PHP Code:
    <?php
    mysql_connect
    ($hostname$username$password);

    $searchvar "-1";
    if (isset(
    $_POST['searchfield'])) {
      
    $searchvar = (get_magic_quotes_gpc()) ? $_POST['searchfield'] : addslashes($_POST['searchfield']);
    }

    $selectcolumnvar "PHONE";
    if (isset(
    $selectcolumn)) {
      
    $selectcolumnvar = (get_magic_quotes_gpc()) ? $selectcolumn addslashes($selectcolumn);
    }

    mysql_select_db($database);
    $query_SearchResults sprintf("SELECT * FROM TABLE WHERE %s LIKE '%%%s%%' ORDER BY COMPANY ASC"$selectcolumnvar,$searchvar);
    $SearchResults mysql_query($query_SearchResults) or die(mysql_error());
    $row_SearchResults mysql_fetch_assoc($SearchResults);
    $totalRows_SearchResults mysql_num_rows($SearchResults);
    ?>
    <html>
    <head>
    <title>Untitled Document</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    </head>

    <body>
    <form name="form1" method="post" action="">
    <p> Search for</p>
    <p><input name="searchfield" type="text" id="searchfield"></p>
    <p>in</p>
    <p>
    <label><input type="radio" name="RadioGroup1" value="Y">Business</label>
    <br>
    <label><input name="RadioGroup1" type="radio" value="phone number" checked>Phone Number</label>
    </p>
    <p>
    <input type="submit" name="Submit" value="Search">
    <br>
    </p>
    </form>
    <p>&nbsp;</p>

    <table>
      <tr>
        <td>BUSINESS</td>
        <td>OWNERNAME</td>
        <td>PHONE</td>
        <td>ADDRESS</td>
        <td>CITY</td>
        <td>STATE</td>
        <td>ZIPCODE</td>
      </tr>
      <?php do { ?>
      <tr>
        <td><?php echo $row_SearchResults['BUSINESS']; ?></td>
        <td><?php echo $row_SearchResults['OWNERNAME']; ?></td>
        <td><?php echo $row_SearchResults['PHONE']; ?></td>
        <td><?php echo $row_SearchResults['ADDRESS']; ?></td>
        <td><?php echo $row_SearchResults['CITY']; ?></td>
        <td><?php echo $row_SearchResults['STATE']; ?></td>
        <td><?php echo $row_SearchResults['ZIPCODE']; ?></td>
      </tr>
      <?php } while ($row_SearchResults mysql_fetch_assoc($SearchResults)); ?>
    </table>
    </body>
    </html>
    For that code to work you have to have PHP Level 2 or higher so make sure you have it and if not go to your account and request it.

    Quote Originally Posted by xmakina View Post
    I think this belongs in the marketplace...
    It doesn't matter, its a programming question so its fine here or in the Marketplace.

  5. #5
    driveflexfuel is offline x10 Sophmore driveflexfuel is an unknown quantity at this point
    Join Date
    Jul 2008
    Posts
    159

    Re: PHP/MySQL Programming

    I have managed to create the search by state and the form to add to the database from a source I found on another forums but I still need the search form. I thank you for working on the code above and you will get credits for you hard work when this code is completed.

    This is the code i am using if someone can tell me where i am going wrong it would be great. The form pops up with no errors but when I search it does not do anything you can view a sample page at www.djcustomdesign.com/database/search.php

    Code:
    <?php
            $db_server = "localhost";
            $database = "driveflexfuel_business";
            $db_user = "******";
            $db_pass = "******";
    mysql_connect($db_server, $db_user, $db_pass);
    
    $searchvar = "-1";
    if (isset($_POST['searchfield'])) {
      $searchvar = (get_magic_quotes_gpc()) ? $_POST['searchfield'] : addslashes($_POST['searchfield']);
    }
    
    $selectcolumnvar = "PHONE";
    if (isset($selectcolumn)) {
      $selectcolumnvar = (get_magic_quotes_gpc()) ? $selectcolumn : addslashes($selectcolumn);
    }
    
    mysql_select_db($database);
    $query_SearchResults = sprintf("SELECT * FROM COMPANY WHERE %s LIKE '%%%s%%' ORDER BY BUSINESS ASC", $selectcolumnvar,$searchvar);
    $SearchResults = mysql_query($query_SearchResults) or die(mysql_error());
    $row_SearchResults = mysql_fetch_assoc($SearchResults);
    $totalRows_SearchResults = mysql_num_rows($SearchResults);
    ?>
    <html>
    <head>
    <title>Untitled Document</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    </head>
    
    <body>
    <form name="form1" method="post" action="">
    <p> Search for</p>
    <p><input name="searchfield" type="text" id="searchfield"></p>
    <p>in</p>
    <p>
    <label><input type="radio" name="RadioGroup1" value="Y">Business</label>
    <br>
    <label><input name="RadioGroup1" type="radio" value="phone number" checked>Phone Number</label>
    </p>
    <p>
    <input type="submit" name="Submit" value="Search">
    <br>
    </p>
    </form>
    <p>&nbsp;</p>
    
    <table>
      <tr>
        <td>BUSINESS</td>
        <td>OWNERNAME</td>
        <td>PHONE</td>
        <td>ADDRESS</td>
        <td>CITY</td>
        <td>STATE</td>
        <td>ZIPCODE</td>
      </tr>
      <?php do { ?>
      <tr>
        <td><?php echo $row_SearchResults['BUSINESS']; ?></td>
        <td><?php echo $row_SearchResults['OWNERNAME']; ?></td>
        <td><?php echo $row_SearchResults['PHONE']; ?></td>
        <td><?php echo $row_SearchResults['ADDRESS']; ?></td>
        <td><?php echo $row_SearchResults['CITY']; ?></td>
        <td><?php echo $row_SearchResults['STATE']; ?></td>
        <td><?php echo $row_SearchResults['ZIPCODE']; ?></td>
      </tr>
      <?php } while ($row_SearchResults = mysql_fetch_assoc($SearchResults)); ?>
    </table>
    The table name is company
    The field names are all in lowercase and are
    business
    owner
    address
    city
    state
    zip
    phone

  6. #6
    gomarc's Avatar
    gomarc is offline x10 Elder gomarc is an unknown quantity at this point
    Join Date
    Oct 2007
    Location
    USA
    Posts
    511

    Re: PHP/MySQL Programming

    Change your table fields to uppercase:

    BUSINESS
    OWNERNAME
    PHONE
    ADDRESS
    CITY
    STATE
    ZIPCODE


    They need to match:

    Quote Originally Posted by driveflexfuel View Post
    ...

    Code:
     ...
        <td><?php echo $row_SearchResults['BUSINESS']; ?></td>
        <td><?php echo $row_SearchResults['OWNERNAME']; ?></td>
        <td><?php echo $row_SearchResults['PHONE']; ?></td>
        <td><?php echo $row_SearchResults['ADDRESS']; ?></td>
        <td><?php echo $row_SearchResults['CITY']; ?></td>
        <td><?php echo $row_SearchResults['STATE']; ?></td>
        <td><?php echo $row_SearchResults['ZIPCODE']; ?></td>
    
    ...

  7. #7
    driveflexfuel is offline x10 Sophmore driveflexfuel is an unknown quantity at this point
    Join Date
    Jul 2008
    Posts
    159

    Re: PHP/MySQL Programming

    I want to thank all of you for your work on the coding everything is working great and credits have been handed out.

  8. #8
    gomarc's Avatar
    gomarc is offline x10 Elder gomarc is an unknown quantity at this point
    Join Date
    Oct 2007
    Location
    USA
    Posts
    511

    Re: PHP/MySQL Programming

    Quote Originally Posted by driveflexfuel View Post
    I want to thank all of you for your work on the coding everything is working great and credits have been handed out.
    Thank you for the credits, very generous from your part.

  9. #9
    freecrm's Avatar
    freecrm is offline x10 Elder freecrm is an unknown quantity at this point
    Join Date
    May 2008
    Location
    UK
    Posts
    629

    Re: PHP/MySQL Programming

    Quote Originally Posted by driveflexfuel View Post
    I want to thank all of you for your work on the coding everything is working great and credits have been handed out.
    V Generous...

    I'll see if I can get round to your others when I get a second or 3,600 of them!

  10. #10
    gomarc's Avatar
    gomarc is offline x10 Elder gomarc is an unknown quantity at this point
    Join Date
    Oct 2007
    Location
    USA
    Posts
    511

    Re: PHP/MySQL Programming

    Quote Originally Posted by driveflexfuel View Post
    ...
    2 Search by state i have an image map where they can click on the state and it needs to display all resutls for that state on another page. Image map adds the variable page.php?state=california if you click california
    ...
    If I understood correctly, you already have an image map where users can click on the state.

    PHP Code:
    <?php

    /*
    File name: by_state.php
    Expecting something like : by_state.php?state=california
    Note that 'california' is not the same as 'ca'
    but california will match CaliFORnia.

    Your MySql table must contain a field named STATE.

    */

    if (isset($_GET['state']) ) {
        
    // Connect
            
    $db_server "localhost";
            
    $database "*******";
            
    $db_user "********";
            
    $db_pass "********";
           
        
    // Reverse magic_quotes_gpc/magic_quotes_sybase effects on those vars if ON.

            
    if(get_magic_quotes_gpc()) {
                
    $sstate stripslashes($_GET['state']);
                
            } else {
                
    $sstate $_GET['state'];

            }
            
        
    mysql_connect($db_server,$db_user,$db_pass);
        @
    mysql_select_db($database) or die( "Unable to select database");
        
        
    $query sprintf("SELECT * from company WHERE `STATE` LIKE \"$sstate\" ORDER BY BUSINESS ASC");
        
    $result mysql_query($query);
        
    $num mysql_num_rows($result);
            
        
    mysql_close();
        
        if (
    $num 1) {
             echo 
    "No Business found in the State of " $_GET['state'] . "\n";
        } else {
        
    // Build the table with results
    ?>        
        <table>
      <tr>
        <td>BUSINESS</td>
        <td>OWNERNAME</td>
        <td>PHONE</td>
        <td>ADDRESS</td>
        <td>CITY</td>
        <td>STATE</td>
        <td>ZIPCODE</td>
      </tr>
      <?php $i=0;
      while (
    $i $num)  { ?> 
      <tr>
        <td><?php echo mysql_result($result$i'BUSINESS');  ?></td>
        <td><?php echo mysql_result($result$i'OWNERNAME'); ?></td>
        <td><?php echo mysql_result($result$i'PHONE');     ?></td>
        <td><?php echo mysql_result($result$i'ADDRESS');   ?></td>
        <td><?php echo mysql_result($result$i'CITY');      ?></td>
        <td><?php echo mysql_result($result$i'STATE');     ?></td>
        <td><?php echo mysql_result($result$i'ZIPCODE');   ?></td>
      </tr>
      
      <?php 
      
    ++$i;
      }  
    ?>
    </table>

    <?php
        
    }
        }
    ?>
    Last edited by gomarc; 01-21-2009 at 08:38 AM.

+ Reply to Thread
Page 1 of 2 12 LastLast

Similar Threads

  1. Common Programming Terms --- Part III
    By Tariqul Islam in forum Tutorials
    Replies: 7
    Last Post: 09-03-2008, 10:25 PM
  2. Common Programming Terms --- Part II
    By Tariqul Islam in forum Tutorials
    Replies: 2
    Last Post: 08-14-2008, 01:10 AM
  3. PHP/mySQL noob question
    By alexxz4 in forum Programming Help
    Replies: 10
    Last Post: 04-05-2008, 01:56 PM
  4. Your Favorite Programming Language
    By sumitmehta in forum Off Topic
    Replies: 14
    Last Post: 03-08-2008, 11:26 PM
  5. Common Programming Terms --- Part I
    By Tariqul Islam in forum Tutorials
    Replies: 2
    Last Post: 01-19-2008, 12:08 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers