Jump to content

Phpfanboi

New Members
  • Posts

    8
  • Joined

  • Last visited

    Never

Posts posted by Phpfanboi

  1. <FORM METHOD=POST ACTION="">
    <p>Breeder or Business Name<br />
    <input type = "text" name = "breedername" size= "25" maxlength = "50" />
    </p>
    <p>Breeder Telephone<br />
    <input type = "text" name = "breedertelephone" size= "25" maxlength = "50" />
    </p>
    <p>Breeder Location<br />
    <input type = "text" name = "breederlocation" size= "25" maxlength = "50" />
    </p>
    <p>Breeder Desription<br />
    <input type = "text" name = "breederdescription" size= "25" maxlength = "50" />
    </p>
    <p>Leave blank<br />
    <input type = "text" name = "breederverify" size= "5" maxlength = "5" /><br /><br />
    </p>
    <input type="submit" value="Submit" name='submit' />
    <br />  <br />
    </form>

     <?php
    if (is_string($breederverify)) {                                                 <-- If $breederverify is set , then echo "Please leave the lowest box empty!"
    echo "Please leave the lowest box empty!";
    } else {                                                                     <-- else if $breederverify is unsigned/null execute this block.
    $con = mysql_connect("localhost","xxxxxxxxxx","xxxxxxxxxx");
    
    mysql_select_db("cichlid",$con);
    
    $breedername = $_POST['breedername'];
    $breedertelephone = $_POST['breedertelephone'];
    $breederlocation = $_POST ['breederlocation'];
    $breederdescription = $_POST ['breederdescription'];
    $breederverify = $_POST ['breederverify'];
    
    $sql = "INSERT INTO breedersinfo SET breederNAME = '$breedername' , breederTELEPHONE = '$breedertelephone' , breederLOCATION = '$breederlocation' , breederDESCRIPTION =                '$breederdescription'";
    
    if(!mysql_query($sql,$con))
    {
    die('ERROR:Could not connect ' . mysql_error ());
    }
    echo "";
    	  
    mysql_close ($con) ;
    
    
    }
    
    ?>
    

     

     

     

     

     

     

     

     

     

    All i am trying to accomplish is a form field that will only update records if the last

    $breederverify = $_POST ['breederverify'];

    is null/unasigned . I was thinking in order to do this i could use is_numeric , or is_string function to check $var ,to see what it's state is. Any help or advice would be appreciated , provided this is even possible. Cheers guys . :confused:

  2. Hello all ,

    I have a small issue in regards to allowing for my results to be placed horizontally across the page instead of vertically. I find the code i have posted works well when it comes to finding and displaying my information as requested (vertically) , but i am having trouble with finding a way to display the results horizontally.

    I know i need a way to identify each result?in order to echo it out in between <td> </td> , but i am still unsure , a point in the right direction would be good as i am struggling to find a way thankyou.

       $title = $runrows['title'];
       $desc = $runrows['description'];
       $url = $runrows['url'];
       $img = $runrows['image']; 
       $id = $runrows['id'];
      
       
    
       echo "  <table width='100px'>
       <h4><a href='http://$url'><b>$title</b></a><br /> 
       $desc<br> 
       <font color='00CC00'>$url</font></h4> 
       <tr><img src='data:image/png;base64,$img' />
       $id
       ";
    
    
       

  3. You are correct. As to a specific name, not sure it really has one. 'Design/coding/psuedo code/ect'???

     

    simple example

    showing 3 pictures in a row
    as html...
    <table>
      <tr>
        <td><IMG SRC="/images/pic1.jpg"></td>
        <td><IMG SRC="/images/pic2.jpg"></td>
        <td><IMG SRC="/images/pic3.jpg"></td>
      </tr>
    </table>
    
    using php
    
    <table>
      <tr>
    <?PHP
    $picture_array[0] = "/images/pic1.jpg"; // you would actually get this info from the db table
    $picture_array[1] = "/images/pic2.jpg";
    $picture_array[2] = "/images/pic3.jpg";
    
    $i=0;
    while($i<3) {
      echo "<td>" . $picture_array[$i] . "</td>";
      $i ++;
    }
    ?>
    </tr>
    </table>
    

     

    Thankyou very much just made my world so much clearer , very fine example .I like the possibilty also of replacing th <tr> and using a css div, to me it's just so much more versatile.And the image structure looks good too, thank you again take care.

  4. Personal preference is to store image name in database, while the actual image is in a folder.

     

    As to displaying, keep in mind final output is client/browser side, sooo I usually start with what, where and how I want things displayed then work backwards to have php 'insert/echo' the 'data'. In other words - do the layout in html (using divs/tables/etc) and THEN start replacing with php.

     

    Make sense?

     

    Ok so i do the skeleton outlay of my page , with html & css as per standard , and then use php to fill in where i specify , for example within a table cell or within a Css div, and that should give me control over where my results land on my page? If this is correct please also tell me the name for this operation , thank you.

     

  5. hello everyone,

    I am about to start coding my pages to display results from a database but before i do i want to know information about the following :

     

    Is it best to upload images to a database?and display them accordingly? or is it best to use images from a directory? What is most commonly used and or more reliable?

     

    Another topic i have trouble finding information on is actually positioning the output from you mysql database, is this practice done with tables?fields and rows? What is this method called? And is there more then one way to go about controlling result layout on your page?

     

    Sorry about the 1001 questions , but i am unable to find a clear answer on the topic ..especially question two .

    Thanks in advance. ;)

     

     

     

     

  6. Yes, you need to replace the localhost domain with either the ip address or domain name of your mysql server database.

    So i can use for instance ;

    $dbhost = "http://www.mydatabase.com";   

    $dbuser = "root";

    $dbpassword = '';

     

    $dbdatabase = "productsdb";

    and so on ..

     

    Is this the correct method?Also can you help me find my ip address for my server , is it located in c-panel?Thank you very much for your hastly reply.cheers

     

  7. <?php

    $dbhost = "localhost";    <-(replace 'localhost' with server ip ?)

    $dbuser = "root";

    $dbpassword = '';

     

    $dbdatabase = "productsdb";

    and so on ..

     

    For remote access to my hosted database via another machine what do i replace "localhost" with ? is it the ip address for my server? How do i point this function to the remote server?

     

    I know i have to allow for the incoming ip address (users machine) in c-panel using the wild card feature , but i am not sure if i am meant to replace the "localhost" part in my connection function , with the ip address where my database is remotely living.

     

    If i am meant to be using the web host ip address , im guessing i have to find it on c-panel , how do i do this , any information would be good thankyou.

     

     

     

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