SitePoint Sponsor

User Tag List

Results 1 to 21 of 21

Thread: PHP with HTML

  1. #1
    SitePoint Guru laflair13's Avatar
    Join Date
    Nov 2004
    Location
    TN
    Posts
    619
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    PHP with HTML

    I am trying to design a dating site. I have a few pages done in HTML but need to know how to add php for data. Like members names, emails, ect. heres a little bit of the html I have.

    Code:
    <!--Begin Header -->
    
        <table border="0" cellpadding="0" cellspacing="0" width="100%" height="200" align="center" style="background-image: url(images/bg_head.jpg); background-repeat:repeat-x;">
            <tr>
                <td height="200" width="21%"><!-- left top-->
                    <table border="0" cellpadding="0" cellspacing="0" height="200" width="100%">
                        <tr><td height="185" align="center"><img src="images/spacer.gif" width="1" height="185"></td></tr>
                        <tr><td bgcolor="#4B4F52" align="center"><img src="images/spacer.gif" width="1" height="15"></td></tr>
                    </table>
                </td><!-- /left top-->
                <td height="200"><!-- Middle top-->
                    <table align="center" height="200" cellpadding="0" cellspacing="0" border="0">
                        <tr>
                            <td height="127">
                                <table cellpadding="0" cellspacing="0" border="0" height="127" width="100%">
                                    <tr>
    <!--**************************************** Logo ******************************************** -->
                                           <td width="205">
                                            <table cellpadding="0" cellspacing="0" border="0">
                                                <tr><td align="left" class="text1" height="10"></td></tr>
                                                <tr><td><img src="images//spacer.gif" width="205" height="20"></td></tr>
                                                <tr><td>
                                                    <img src="images/logo2.gif" width="205" height="61" border="0"></td></tr>
                                                <tr><td><img src="images/spacer.gif" width="205" height="24"></td></tr>
                                            </table>
                                        </td>
    <!--**************************************  End Logo  #E0C0C0 *******************************************-->
                                        <td width="100%"><img src="images/spacer.gif"></td>
    <!-- Login Area-->
                                        <td width="323" height="127" style="background-image: url(images/rings.gif); background-repeat:no-repeat;">
                                            <table cellpadding="0" cellspacing="0" border="0" width="323" height="127">
                                                <tr>
                                                    <td height="83" align="right" valign="middle">
                                                        <table cellpadding="0" cellspacing="5" border="0"><tr><td><form method=post action="http://www.sexxhunt.com/member.php">
                    <tr>
                        <td align=right colspan=2 class=button> <a class="button" href="http://www.sexxhunt.com/forgot.php">Forgot?</a></td>
                    </tr>
                    <tr>
                        <td class=head> Name: </td>
                        <td><input class=menub type=text name=ID size=12 value=""></td>
                    </tr>
                    <tr>
                        <td  class=head> Pass: </td>
                        <td><input class=menub type="password" value="" name="Password" size=12></td>
                    </tr>
                    <tr>
                        <td><img src="images/spacer.gif" width"1" height="1"></td>
                        <td class=small align=right>
                            <input style="border: 0px solid red; height: 22px; background-color: #4B4F52; font-family: Verdana; font-size: 10px; color: #ffffff;" type="submit" value=" LOG IN ">
                        </td>
                    </tr>
                </form></td></tr></table>
                                                    </td>
                                                    <td width="46" height="127" rowspan="2" valign="bottom"><img src="images/girl_top_left.jpg"></td>
                                                </tr>
                                            </table>
                                        </td>
                                    <!-- End Login Area> -->
                                    </tr>
                                </table>
                            </td>
                        </tr>
                        <tr>
                            <td width="770" height="58" style="background-image: url(images/bk_top_menu.gif); background-repeat:repeat-x;">
    <!--top menu area -->
                                <table cellpadding="0" cellspacing="0" border="0"  width="770" height="58" valign="middle">
                                    <tr>
                                        <td width="1"><img src="images/point.gif" width="1" height="58"></td>
                                        <td class="mouse_out" id="tm_1" align="center" valign="middle">
                                        <a class="menu" OnMouseOver="javascript: z=document.getElementById('tm_1'); z.className='mouse_over'" OnMouseOut="javascript: z=document.getElementById('tm_1'); z.className='mouse_out'" href="join.html">JOIN</a></td>
                                        <td width="4"><img src="images/button_top_1.gif"></td>
                                        <td class="mouse_out" id="tm_2" align="center" valign="middle"><a class=menu href="http://www.sexxhunt.com/member.php" OnMouseOver="javascript: z=document.getElementById('tm_2'); z.className='mouse_over'" OnMouseOut="javascript: z=document.getElementById('tm_2'); z.className='mouse_out'" >LOG IN</a></td>
                                        <td width="4"><img src="images/button_top_1.gif"></td>
                                        <td class="mouse_out" id="tm_3" align="center" valign="middle"><a class=menu href="http://www.sexxhunt.com/aechat.php" target=_blank OnMouseOver="javascript: z=document.getElementById('tm_3'); z.className='mouse_over'" OnMouseOut="javascript: z=document.getElementById('tm_3'); z.className='mouse_out'" >CHAT</a></td>
                                        <td width="4"><img src="images/button_top_1.gif"></td>
                                        <td class="mouse_out" id="tm_4" align="center" valign="middle"><a class=menu href="http://www.sexxhunt.com/search.php" OnMouseOver="javascript: z=document.getElementById('tm_4'); z.className='mouse_over'" OnMouseOut="javascript: z=document.getElementById('tm_4'); z.className='mouse_out'" >SEARCH</a></td>
                                        <td width="4"><img src="images/button_top_1.gif"></td>
                                        <td class="mouse_out" id="tm_5" align="center" valign="middle"><a class=menu href="http://www.sexxhunt.com/rate.php" OnMouseOver="javascript: z=document.getElementById('tm_5'); z.className='mouse_over'" OnMouseOut="javascript: z=document.getElementById('tm_5'); z.className='mouse_out'" >RATE</a></td>
                                        <td><img src="images/spacer.gif" width="60" height="1"></td>
                                        <td width="16"><a href="http://www.sexxhunt.com/contact.php" class="button"><img src=images//envelope.gif border=0></a></td>
                                        <td width="70" align="center">
                                        <a href="http://www.sexxhunt.com/contact.php">
                                        C</a><nobr><a href="http://www.sexxhunt.com/contact.php" class="button">ontact 
                                        Us</a></nobr></td>
                                        <td width="53" height="58"><img src="images/buts.gif" ></td>
                                    </tr>
                                </table>
                                <!--end top menu area -->
                            </td>
                        </tr>
                        <tr>
                            <td width="770" height="15">
                                <table cellpadding="0" cellspacing="0" border="0" width="770" height="15">
                                    <tr>
                                        <td bgcolor="#4B4F52"><img src="images/spacer.gif" width="1" height="15"></td>
                                        <td width="56" height="15" align="right"><img src="images/foot.jpg"></td>
                                    </tr>
                                </table>
                            </td>
                        </tr>
                    </table>
                </td>
            <!--/ middle top -->
            <!-- right top -->
                <td height="200" width="21%">
                    <table border="0" cellpadding="0" cellspacing="0" height="200" width="100%" align="left">
                        <tr>
                            <td height="200"  width="121" rowspan="2" background="images/girl_top.jpg"><img src="images/spacer.gif" width="1" height="200"></td><td height="185"><img src="images/spacer.gif" width="1" height="15"></td>
                        </tr>
                        <tr>
                            <td bgcolor="#4B4F52"><img src="images/spacer.gif" width="1" height="15"></td>
                        </tr>
                    </table>
                </td>
            </tr>
        </table>
    <!--/ right top -->
    <!-- End Header-->
    <!-- middle Table -->
        <table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#E0C0C0" style="background-image:url(images/bc_main.gif); background-repeat:repeat-x; top;">
            <tr>
                <td width="20%" valign="bottom">
                    <table border="0" cellpadding="0" cellspacing="0" width="100%">
                        <tr>
                            <td><img src="images/spacer.gif" width="1" height="100%"></td>
                            <td background="images/girl_bottom.jpg" height="355" width="145"><img src="images/spacer.gif" width="1" height="100%"></td>
                        </tr>
                    </table>
                 </td>
    Thank You in advance
    Thanks In Advance

    David

  2. #2
    SitePoint Guru enygmadae's Avatar
    Join Date
    Sep 2002
    Location
    Dallas, Tx.
    Posts
    795
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    PHP can be dropped in anywhere on the HTML - that's one of the great things about it.
    Too add PHP into a file you just use something like:
    PHP Code:
     <?php echo "name"?>
    PHP News, Views and Community: http://www.phpdeveloper.org

  3. #3
    SitePoint Guru laflair13's Avatar
    Join Date
    Nov 2004
    Location
    TN
    Posts
    619
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by enygmadae
    PHP can be dropped in anywhere on the HTML - that's one of the great things about it.
    Too add PHP into a file you just use something like:
    PHP Code:
     <?php echo "name"?>

    Thank you for the tip. What about database for members names, emails, ext,

    How would that be laid out in the html? Also would I save the file as .php or .html?
    Thanks In Advance

    David

  4. #4
    Internet Business Optimizer KCgame's Avatar
    Join Date
    Mar 2005
    Location
    Singapore
    Posts
    929
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by laflair13
    Thank you for the tip. What about database for members names, emails, ext,
    How would that be laid out in the html? Also would I save the file as .php or .html?
    Hi laflair13,

    You can add in the database queries like the following
    PHP Code:
    <?
    $get_members
    =mysql_query("SELECT membername FROM membertable WHERE memberage<='20'",$link ) or die(mysql_error());

    $memberarray=mysql_fetch_array($get_members);
    ?>
    The above example will save all the members with age younger or equal to 20 into the array, memberarray. You can then output any values in the array using the method mentioned by enygmadae.

    The script has to be saved in .php if it contains any PHP codes.

    Hope it helps

  5. #5
    SitePoint Guru laflair13's Avatar
    Join Date
    Nov 2004
    Location
    TN
    Posts
    619
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That makes no sense to me..lol...I am a very new beginner to php. I do though know how to set up the databases in phpmyadmin but thats as far as I know
    Thanks In Advance

    David

  6. #6
    SitePoint Evangelist Jedi007's Avatar
    Join Date
    Aug 2005
    Posts
    463
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You must not know much about MySQL, here,
    Put this anywhere in your page...

    <?php echo "test">

    so lets say your page source is:

    <html>
    <body>
    <?php echo "test" ?>
    </body>
    </html>

    it would output

    <html>
    <body>
    <?php echo "test" ?>
    </body>
    </html>

    (very simple)

    Now, $_POST["thenameofyourinput"] holds the data for what the person entered so,

    <?php echo $_POST["email"] ?>

    would output the email that the guy sent in.

    Read this for example:


    http://www.w3schools.com/php/php_forms.asp

  7. #7
    SitePoint Guru laflair13's Avatar
    Join Date
    Nov 2004
    Location
    TN
    Posts
    619
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If this is my html code.

    HTML Code:
    <td align="center" valign="middle">
    									<input name="ProfileType" id="ProfileTypeCouple" value="couple"  type="radio" nClick="javascript: window.location.href = 'join_form.php?ProfileType=couple'">
    								</td>
    	<td align="left" valign="middle">
    couple
    </td>
    </tr>
    </table>
    <br>&nbsp;
    	</td>
    		</tr><tr class=panel><td align=center  colspan='3'  class=join_header_first><b>
    		Personal details</b></td></tr><tr><td  class=join_td_1>
    					NickName</td><td class=join_td_2>
    <input class=no type=text size='40' maxlength='20' name="NickName" value="" >
    </td><td class=join_td_2>Nickname must be unique and from 5 to 20 characters 
    					long.</td></tr>
    <tr><td  class=join_td_1>Real name</td><td class=join_td_2>
    <input class=no type=text size='40'  name="RealName" value="" >
    </td><td class=join_td_2>Use latin set</td></tr>
    <tr><td  class=join_td_1>Sex</td><td class=join_td_2>
    <select name="Sex" id="Sex" >
    <option value="female" >female</option>
    <option value="male" >male</option>
    </select>
    </td><td class=join_td_2>&nbsp;</td></tr>
    <tr><td  class=join_td_1>State</td><td class=join_td_2>
    <select name="state">
                        <option selected></option>
                        <option value="International">International</option>
                        <option value='Alabama'>Alabama</option>
                     
                      </select>
    
    </td><td class=join_td_2>&nbsp;</td></tr>
    <tr><td  class=join_td_1>City</td><td class=join_td_2>
    <input class=no type=text size='40'  name="City" value="" >
    </td><td class=join_td_2>Use latin set</td></tr>
    <tr><td  class=join_td_1>Zip/Postal Code</td><td class=join_td_2>
    <input class=no type=text size='23'  name="zip" value="" >
    </td><td class=join_td_2>&nbsp;</td></tr>
    <tr><td  class=join_td_1>Children</td><td class=join_td_2>
    <select name='Children'>
    <option value="0" >0</option>
    
    </select>
    <select name="WhereChildren" id="WhereChildren" >
    <option value="living with me" >living with me</option>
    <option value="not living with me" >not living with me</option>
    <option value="sometimes living with me" >sometimes living with me</option>
    <option value="I will tell you later" >I will tell you later</option>
    </select>
    </td><td class=join_td_2>&nbsp;</td></tr>
    <tr><td  class=join_td_1>Want children</td><td class=join_td_2>
    <select name="WantChildren" id="WantChildren" >
    <option value="No" >No</option>
    <option value="Yes" >Yes</option>
    <option value="Maybe" >Maybe</option>
    <option value="No matters" >No matters</option>
    </select>
    </td><td class=join_td_2>&nbsp;</td></tr>
    <tr><td  class=join_td_1>Date of birth</td><td class=join_td_2>
    <select name='YearOfBirth'>
    Where would the php come in and save the entered data in the database?

    Thanks again for all your help. Greatly appreciated.

    Is there maybe a site where I can see if I can get this done for me. Seems all to colpicated for me to do?
    Thanks In Advance

    David

  8. #8
    SitePoint Addict
    Join Date
    Jul 2005
    Posts
    215
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    You need to Learn a lot...for couple of months

    I thinks you need to learn PHP. Good place to start is at Google, type in PHP Tutorials.

    Here are Two Links, they are very good. Thats how I learned it:
    http://www.freewebmasterhelp.com/tutorials/php
    http://www.php-mysql-tutorial.com/

    Once you get better understanding, then you come to places like Sitepoint.com, and just checkout what people are posting. Other people's question and answers will help you. Finally, with better understanding, you can post your own question and get answers.

    Its a lot of work, but it pays off. By following two links above, I became good with PHP and Database.

  9. #9
    SitePoint Guru laflair13's Avatar
    Join Date
    Nov 2004
    Location
    TN
    Posts
    619
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by jjdave
    I actually strating reading that yesterday. Pretty complex but interesting things.

    Guess I just need PHP for dummies.

    I see where it says

    The first step is to download the packages :

    Apache : www.apache.org
    PHP : www.php.net
    MySQL : www.mysql.com
    If these are already with my hosting co., in the cpanelx. Will I need to download these again?
    Thanks In Advance

    David

  10. #10
    SitePoint Addict jkassemi's Avatar
    Join Date
    Jan 2005
    Location
    Albuquerque
    Posts
    268
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You're going to want to use a local server for all of your testing. It makes things MUCH easier than accessing your host every time you need to make a change... Also, you're going to want a local install so you can start learning how to tweak certain settings and such without causing a big problem on your main server.

    If you're on windows, you should look into the following:
    http://www.apachefriends.org/en/xampp.html

    I haven't used it, but a lot of people here say it's a really quick and easy way to get everything set up.

    If you're on linux, take a look at your distro's manual, many include instructions for setting LAMP up... If you can though, I'd recommend compiling from source and learning everything along the way. You'll have to recompile several times over your PHP learning course.

    -James

  11. #11
    SitePoint Guru laflair13's Avatar
    Join Date
    Nov 2004
    Location
    TN
    Posts
    619
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    http://www.apachefriends.org/en/xampp.html

    This will install
    apache
    PHP
    mysql

    Correct?
    Thanks In Advance

    David

  12. #12
    SitePoint Zealot
    Join Date
    Jul 2005
    Location
    Houston, TX
    Posts
    167
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by jkassemi
    You're going to want to use a local server for all of your testing. It makes things MUCH easier than accessing your host every time you need to make a change... Also, you're going to want a local install so you can start learning how to tweak certain settings and such without causing a big problem on your main server.

    If you're on windows, you should look into the following:
    http://www.apachefriends.org/en/xampp.html

    I haven't used it, but a lot of people here say it's a really quick and easy way to get everything set up.

    If you're on linux, take a look at your distro's manual, many include instructions for setting LAMP up... If you can though, I'd recommend compiling from source and learning everything along the way. You'll have to recompile several times over your PHP learning course.

    -James
    James, I politely disagree with that a little bit. I made a huge mistake earlier this year by installing Apache, MySQL, and PHP on my computer so I could test my files before I uploaded them. Of course, I uploaded and didn't test again (why test twice, right?). A few weeks later after I had finished a portion of the site I pulled it up so I could admire my work. Nothing worked. My host was demanding to include a text file that had no business there, my includes were not working, and several libraries (FTP and PDF in particular) were not available on my server. Then I discovered while I was using PHP 5 on my comp, my host was on 4.1.

    I know most of you guys can read the info file and adjust your local PHP compiler to match your server, but I was somewhat new to PHP and had no idea of how to do that. Laflair, I'd suggest uploading your files to your server just to avoid problems later on. Unless you want to go through a long process of making sure your local compiler is installed exactly like your server's.

    My $0.02.

    Tim

  13. #13
    SitePoint Guru laflair13's Avatar
    Join Date
    Nov 2004
    Location
    TN
    Posts
    619
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I am so new to this I am affraid of doing anything...lol.. I guess I will have to get the book "PHP for dummies or just keep reading and hope I understand something along the way.


    Anyone know a service that will install php code on my html poages. I can manage the database inputs?


    Thanks to all those for trying to help.
    Thanks In Advance

    David

  14. #14
    SitePoint Addict
    Join Date
    Jul 2005
    Posts
    215
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    EasyPHP

    If these are already with my hosting co., in the cpanelx. Will I need to download these again?
    Here is more Info:
    Use following link and download -> http://www.easyphp.org/
    This package will install everything you need. Yes, it is better to install in your computer and then test it locally, makes much more sense. Then upload it to your Hosting service and then check it to see it works accordingly. If not, make few tweeks.

    You got all the info that you need. it will be Trial & Error process from here on...

  15. #15
    SitePoint Guru laflair13's Avatar
    Join Date
    Nov 2004
    Location
    TN
    Posts
    619
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If I could get someone to tell me how I would intergrate this html code with php to where it saves all the information in the mysql database I would be more than greatful.

    This is where my problem is. I don't know how to get the members information saved in the database using php as code. I do understand now that I would have to use the code

    PHP Code:
    <?php 
    // print output 
    echo 'index.html.'
    ?>
    I hope. But thats as far as I have gotten.

    Please help a very newcomer in this situation.

    Thanks in advance.

    HTML Code:
    <tr class=panel><td align=center  colspan='3'  class=join_header_first><b>
    					Personal details</b></td></tr><tr><td  class=join_td_1>
    					NickName</td><td class=join_td_2>
    <input class=no type=text size='40' maxlength='20' name="NickName" value="" >
    </td><td class=join_td_2>Nickname must be unique and from 5 to 20 characters 
    					long.</td></tr>
    <tr><td  class=join_td_1>Real name</td><td class=join_td_2>
    <input class=no type=text size='40'  name="RealName" value="" >
    </td><td class=join_td_2>Use latin set</td></tr>
    <tr><td  class=join_td_1>Sex</td><td class=join_td_2>
    <select name="Sex" id="Sex" >
    <option value="female" >female</option>
    <option value="male" >male</option>
    </select>
    </td><td class=join_td_2>&nbsp;</td></tr>
    <tr><td  class=join_td_1>State</td><td class=join_td_2>
    <select name="state">
                        <option selected></option>
                        <option value="all states below">International</option>
                       
                      </select>
    
    </td><td class=join_td_2>&nbsp;</td></tr>
    <tr><td  class=join_td_1>City</td><td class=join_td_2>
    <input class=no type=text size='40'  name="City" value="" >
    </td><td class=join_td_2>Use latin set</td></tr>
    <tr><td  class=join_td_1>Zip/Postal Code</td><td class=join_td_2>
    <input class=no type=text size='23'  name="zip" value="" >
    </td><td class=join_td_2>&nbsp;</td></tr>
    <tr><td  class=join_td_1>Children</td><td class=join_td_2>
    <select name='Children'>
    <option value="number of members choice" >0</option>
    
    </select>
    <select name="WhereChildren" id="WhereChildren" >
    <option value="living with me" >living with me</option>
    <option value="not living with me" >not living with me</option>
    <option value="sometimes living with me" >sometimes living with me</option>
    <option value="I will tell you later" >I will tell you later</option>
    </select>
    </td><td class=join_td_2>&nbsp;</td></tr>
    <tr><td  class=join_td_1>Want children</td><td class=join_td_2>
    <select name="WantChildren" id="WantChildren" >
    <option value="No" >No</option>
    <option value="Yes" >Yes</option>
    <option value="Maybe" >Maybe</option>
    <option value="No matters" >No matters</option>
    </select>
    </td><td class=join_td_2>&nbsp;</td></tr>
    <tr><td  class=join_td_1>Date of birth</td><td class=join_td_2>
    <select name='YearOfBirth'>
    <option value="1930" >1930</option>
    <option value="1931" >1931</option>
    <option value="1932" >1932</option>
    <option value="1933" >1933</option>
    <option value="1934" >1934</option>
    And so on.....
    Thanks In Advance

    David

  16. #16
    Internet Business Optimizer KCgame's Avatar
    Join Date
    Mar 2005
    Location
    Singapore
    Posts
    929
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi laflair13,
    In order to save user input into your database, you need to follow the steps:

    1. Connecting to your database
    PHP Code:
    $mysqlhost=your host;// most likely would be localhost
    $mysqluser=1234567//mysql username
    $mysqlpasswd=password//mysql password
    $mysqldbname="databasename"// this is the database that you want to connect to

    $link=@mysql_connect($mysqlhost,$mysqluser,$mysqlpasswd);
            if(
    $link==FALSE){
                     echo 
    '<p><b>Unfortuantely, no link to the database can be made. Therefore, no results. Try later.</b></body></html>\n';
                     exit();
                     }                    
    mysql_select_db($mysqldbname,$link); 
    Place the above codes near the start of your script.
    NOTE: It is not advisable to place sql password and username in the same script for security reasons, however, we will use it here as an example.

    2. Next step, insert into the respective tables. I am assuming that you have already validate the user input and tables have been set up in Mysql. You can place the following code in the loop where it executes after user press submit button
    PHP Code:
    if(isset($_POST[submit]){ //detect user clicks submit after all fields filled up
    // after validating the user input
    $insert=mysql_query("INSERT INTO tablename (nick,real) VALUES('$_POST[NickName]','$_POST[RealName]' ",$link ) or die(mysql_error());

    The above example will insert the user's real and nickname into the table named tablename. There are other sytnax which you can use to insert. Pease refer to the insert explanation for more details.

    3. It's done

    Just want to highlight something here as what timothytrice has mentioned. Please take note of the version of PHP and MySQL between your testing platform and of the server. Eventually, you will need to use much complicated queries statement other than just SELECT. Therefore, it will be beneficial to you if you know the difference between the versions to avoid running into compability problem later..
    Just one example to illustrate, sub-queries do not work in Mysql version 4.0.xx and earlier. So database designer has to use other workarounds like JOINS.

    Hope the above helps and facilitate your script integration. Do pop over to MySQL forum for any database questions and i'm sure the database gurus will be more than willing to help you out

    Good luck

  17. #17
    SitePoint Guru laflair13's Avatar
    Join Date
    Nov 2004
    Location
    TN
    Posts
    619
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Would any sitepoint members be willing to either take me hand in hand through it or help out by scripting the site? Willing to pay for the help.
    Thanks In Advance

    David

  18. #18
    SitePoint Zealot
    Join Date
    Jul 2005
    Location
    Houston, TX
    Posts
    167
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    David, if I were you, I'd buy a couple of books. "PHP for Dummies" has a decent script where it validates user input and then inserts form data into MySQL. That was the very first book I bought. Though it is basic (and in some cases, not very clear in describing code), it will help you get started. The only other two books I have dealing w/ PHP are "PHP and MySQL Web Development" by Luke Welling and Laura Thomson, and "PHP Functions" published by New Riders.

    Bottom line is there are several things you'll need to learn to handle the process you're wanting to do. Paying someone to do it doesn't benefit you much if you're trying to learn. Go to hotscripts.com or phpbuilder.com and look up some form scripts. Then use the PHP manual to try and get a better understanding of what's going on. Beware, though...many times the manual will leave you lost.

    Most importantly, be patient.

    Tim

  19. #19
    SitePoint Guru laflair13's Avatar
    Join Date
    Nov 2004
    Location
    TN
    Posts
    619
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I actually just purchased php for dummies of ebay. I hope that helps.

    Thanks for the advice.
    Thanks In Advance

    David

  20. #20
    SitePoint Zealot
    Join Date
    Jun 2003
    Location
    New York City
    Posts
    117
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sitepoint has some very good PHP articles and tutorials, and sells some books on the subject, too. The book I used to learn PHP several years ago was called "PHP and MySQL Web Development" by Wellington and Thomson (Publisher: SAMS). They may have a newer, revised edition now, but, it did a good job of teaching a PHP newcomer how to get started.

  21. #21
    SitePoint Enthusiast hussainak's Avatar
    Join Date
    Jul 2005
    Location
    CIA's Terminal
    Posts
    37
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hi use db like this....juss u need to call one function in ur pages

    Code:
    <?php
    //dbauth.php
    
    $user="root";//put ur username here
    $passwd="password";//ur passwd
    $host="localhost";//host address //youraddress.com
    $db="database";
    $table="sometable";//if u want to generalize it...dont use this var.
    
    function db_connect(){
    global $user, $passwd, $host, $db,$table;
    
    	if(mysql_connect($host, $user, $passwd)){
    		if(mysql_select_db($db)){
    			return 1;
    		}
    		else {
    		 die('Invalid query: ' . mysql_error());
    		}
    	}
    
    		else {
    		 die('Invalid query: ' . mysql_error());
    		}
    		
    }
    
    ?>
    juss include this file in ur php pages and call the db_connect() function
    Play god in programming
    http://www.pcorner.net


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •