Results 1 to 26 of 26

Thread: How to display database records on screen?
      
   

  1. #1
    Join Date
    Apr 2008
    Posts
    32

    Default How to display database records on screen?

    I have successfully created forms with ABVFP and now they are working nice. My problem is how to display back the information to the screen. Like if someone wants to see their profile or query a list. how are these information displayed. I appreciate any input. thanks.

  2. #2
    Join Date
    Oct 2005
    Location
    Italy
    Posts
    12,082

    Default Re: How to display database records on screen?

    You need a script to do this. Especially to query the database. There are many programing and security issues involved. In any case, you need to study a bit about MySQL and php. Google it, there are hundreds of online free tutorials.
    Navaldesign
    Logger Lite: Low Cost, Customizable, multifeatured Login script
    Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart
    DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more....
    Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!


  3. #3
    Join Date
    May 2008
    Posts
    10

    Default Re: How to display database records on screen?

    Well heres a nice code that should work for displaying a users data.
    PHP Code:
    function displayUsersData($username$table) {
     
    $con connect() // <--- THIS LINE IS JUST FOR THE CODE, REPLACE IT WITH YOUR DB CONNECTION
     
    $query "SELECT * FROM " .$table" WHERE username='$username'"//SELECTS ALL INFO FROM THE DB WHERE THE USERNAME IS THE USERS USERNAME, thats weird to say
     
    $result mysql_query($query$con) or die(mysql_error()); //THE QUERY
     
    while($data mysql_fetch_array($result)){
      echo 
    $data['email']; //This will echo the row in the database called email, replace this with whatever row you want and you can add more lines, see below
      
    echo $data['id']; //And more
      
    echo $data['something']; //And so on...
     
    }
    }
    //TO CALL THE FUNCTION
    displayUsersData($username$table_name); //Replace with your values 
    Does this answe your question?

  4. #4
    Join Date
    May 2008
    Posts
    10

    Default Re: How to display database records on screen?

    Sorry forgot the ';' This is the code you should use
    PHP Code:
    function displayUsersData($username$table) { 
     
    $con connect(); // <--- THIS LINE IS JUST FOR THE CODE, REPLACE IT WITH YOUR DB CONNECTION 
     
    $query "SELECT * FROM " .$table" WHERE username='$username'"//SELECTS ALL INFO FROM THE DB WHERE THE USERNAME IS THE USERS USERNAME, thats weird to say 
     
    $result mysql_query($query$con) or die(mysql_error()); //THE QUERY 
     
    while($data mysql_fetch_array($result)){ 
      echo 
    $data['email']; //This will echo the row in the database called email, replace this with whatever row you want and you can add more lines, see below 
      
    echo $data['id']; //And more 
      
    echo $data['something']; //And so on... 
     


    //TO CALL THE FUNCTION 
    displayUsersData($username$table_name); //Replace with your values 

  5. #5
    Join Date
    Apr 2008
    Posts
    32

    Default Re: How to display database records on screen?

    Thanks, Phouber. I appreciate it.

    I also got other codes for login, querying, etc. but where will I put them on the page?
    Should i put them on the ACTION part of the form, or no need to make a form?
    The BVBuilder icon for script is only good for VBScript not php.

    Just need a little help here.
    Appreciate any input from anyone.
    Thanks.

  6. #6
    Join Date
    Sep 2005
    Location
    Cincinnati, Ohio
    Posts
    2,116

    Default Re: How to display database records on screen?

    The action of your form should link to another page (or the same page if you know how to do it, but that add complexity, its easier to set the action to a separate page). On the page that the action leads to you insert the php code.

    You can insert the php code as if it was html code, keeping in mind the page needs to have a .php extension, and the code needs to be surrounded with <? and ?>

    Register/Login Script
    Do you use a Password Protected Directory? Need a way to allow users to make their own account, try my .htaccess Login Script

  7. #7
    Join Date
    Jul 2007
    Location
    Oporto - Portugal
    Posts
    129

    Default Re: How to display database records on screen?

    Hi,

    Be careful because it has ocurred to me with WAMP that the php entrance tag <? did not work and forced me to change all my code to tag <?php.

    About showing the table content I would suggest to use a class that would show that content no matter the fields/sizes/etc/etc of that table.
    This class would read all tables no matter what.

    This is an example of the code:

    <?php
    include("include/config.php");
    $table = $_GET['t'];
    $lines = $_GET['l'];
    $page = $_GET['p'];
    require ("classes/class_pagination.php");
    $page= new pagination;
    $page->conect_to("$hostname", "$user_db", "$pass_db","$database");
    $page->setLines($lines);
    $page->setTable("$table");
    $page->showLines();
    $page->showPagelinks($lines);
    ?>

    File config.php would contain Your database info.
    File classe_pagination.php would contain the class program.

    With this example You can consult/list all Your tables.

    The syntax at the browser would be:
    www.yourdomain.com/list_table.php?t=tablename&l=linesperpage&p=pagenu mber

    Hope I've helped,
    pipesportugal

  8. #8
    Join Date
    Apr 2008
    Posts
    32

    Default Re: How to display database records on screen?

    Thanks all.
    You know I am not even there yet.
    I mean displaying the record on screen because I am still on the login page.
    The site would ask for the username and password, then the record will be located and displayed on screen.
    That's how its supposed to work.
    I thought I would pass this easy but turns out I am stuck here.
    Here is the site:http://www.godhearme.org/GHM/ProfileAccess.php
    It just would not pull the record to populate another screen.
    keeps coming back to the login page.
    Whats wrong?
    Need help here.. appreciate it. thanks.

    sample username: ana password:112233

    Here are the codes for the login script:
    <?
    require_once "ghm_conn.php";

    if(isset($s1))
    {
    if(!empty($username1) && !empty($password1))
    {
    $sql = "SELECT * FROM _Form_Nr_2 WHERE username = '$username1' AND password = '$password1'";
    $result = mysql_query($sql);
    if(mysql_num_rows($result) == "1")
    {
    $a = mysql_fetch_array($result);
    $username1 = $a['username'];
    $_SESSION[username] = $username1;
    header("location:Profile.php");
    exit();
    }

    }
    }
    include_once "ProfileMain.php";
    ?>
    <center>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <span class=HeaderClass>Members Login </span>
    <p class=BlackLink>You must log in to access this area of the site.<br> If you are
    not a registered user, <a href="http://www.godhearme.org/GHM/Register.html" class=TNA> click here</a> to sign up.</p>
    <p>

    <form name=jsl method="post" action="ProfileAccess.php">
    <table align=center class=BlackText>
    <tr>
    <td align=right>Username:</td>
    <td> <input type="text" name="username1" size="30" maxlength=30></td>
    </tr>
    <tr>
    <td align=right>Password:</td>
    <td><input type="password" name="password1" size="30" maxlength=30></td>
    </tr>
    <tr>
    <td>&nbsp;</td>
    <td>
    <input type=hidden name=job_id value=<? echo $_GET[job_id]?>>
    <input type="submit" name=s1 value=" Login " style="font-family:verdana; font-weight:bold; color:#993300; background-color:white">
    </td>
    </tr>

    <tr>
    <td colspan=2 align=center>
    <br>
    <a class=TNA href=forgot.php> Forgot your username/password? </a></td></tr>

    </table>
    </form></p>
    </center>

    <?

  9. #9
    Join Date
    Oct 2005
    Location
    Italy
    Posts
    12,082

    Default Re: How to display database records on screen?

    As a main problem, i can say that you are retrieving the row (as $a) but yiu are not setting the $username to be $a['username'] which is necessary. See part in red in your post.

    Since other pieces of your code are nor included in your post, i can't know if they are correct or not.
    Navaldesign
    Logger Lite: Low Cost, Customizable, multifeatured Login script
    Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart
    DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more....
    Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!


  10. #10
    Join Date
    Apr 2008
    Posts
    32

    Default Re: How to display database records on screen?

    well, it didnt really help. the logon screen still keeps on looping.
    other codes with this login script is below.

    Appreciate any help. thanks.

    The ghm_conn.php are the following :
    (password is xxx for security)
    <?
    $db_host = "localhost";
    $db_username = "rhidsrn_maryfil";
    $db_password = "xxx";
    $db_name = "rhidsrn_GHM";
    $script_dir = "GHM";
    //////////////////////////////////////////////////////
    //////////////////////////////////////////////////////
    //////////////////////////////////////////////////////
    //connect to the database server
    $connection = mysql_connect($db_host, $db_username, $db_password) or die(mysql_error());

    //select database
    $db = mysql_select_db($db_name, $connection);
    session_start();
    if(!empty($script_dir))
    {
    $dir = "/".$script_dir;
    }
    $t = time();
    ?>

  11. #11
    Join Date
    Sep 2005
    Location
    Cincinnati, Ohio
    Posts
    2,116

    Default Re: How to display database records on screen?

    The connection looks fine, whats the code on "ProfileMain.php"

    and..
    Quote Originally Posted by pipesportugal View Post
    Be careful because it has ocurred to me with WAMP that the php entrance tag <? did not work and forced me to change all my code to tag <?php.
    Thats just because short tags are disabled, you need to configure your php.ini for WAMP, I guess short tags are disabled by default. (The majority of web hosts have it enabled so its not a problem normally)

    Register/Login Script
    Do you use a Password Protected Directory? Need a way to allow users to make their own account, try my .htaccess Login Script

  12. #12
    Join Date
    Apr 2008
    Posts
    32

    Default Re: How to display database records on screen?

    i think the ProfileMain.php is working fine. It is the background form.
    The loop happens when you enter the username and password.
    it just never got to the next page.

    Thanks.

    anyways, below is ProfileMain
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <title>ProfileMain</title>
    <meta name="KEYWORDS" content="prayers, God, problem, suicide, 'group prayer', angels, problems">
    <meta http-equiv="Page-Enter" content="revealTrans(Duration=1,Transition=1)">
    <meta name="GENERATOR" content="Created by BlueVoda">
    <style type="text/css">
    div#container
    {
    width: 769px;
    position: relative;
    margin-top: 0px;
    margin-left: auto;
    margin-right: auto;
    text-align: left;
    }
    body
    {
    text-align: center;
    margin: 0;
    }
    </style>
    <script type="text/javascript">
    <!--
    function SwapImage()
    {
    var doc=document, args=arguments;
    doc.$imgSwaps = new Array();
    for(var i=2; i<args.length; i+=2)
    {
    var elem=FindObject(args[i]);
    if(elem)
    {
    doc.$imgSwaps[doc.$imgSwaps.length]=elem;
    elem.$src=elem.src;
    elem.src=args[i+1];
    }
    }
    }
    // -->
    </script>
    <script type="text/javascript">
    <!--
    function FindObject(id, doc)
    {
    var child, elem;
    if(!doc)
    doc=document;
    if(doc.getElementById)
    elem=doc.getElementById(id);
    else
    if(doc.layers)
    child=doc.layers;
    else
    if(doc.all)
    elem=doc.all[id];
    if(elem)
    return elem;
    if(doc.id==id || doc.name==id)
    return doc;
    if(doc.childNodes)
    child=doc.childNodes;
    if(child)
    {
    for(var i=0; i<child.length; i++)
    {
    elem=FindObject(id,child[i]);
    if(elem)
    return elem;
    }
    }
    var frm=doc.forms;
    if(frm)
    {
    for(var i=0; i<frm.length; i++)
    {
    var elems=frm[i].elements;
    for(var j=0; j<elems.length; j++)
    {
    elem=FindObject(id,elems[i]);
    if(elem) return elem;
    }
    }
    }
    return null;
    }
    // -->
    </script>
    </head>
    <body bgcolor="#FFE4E1" text="#000000">
    <div id="container">
    <div id="bv_" style="position:absolute;left:0px;top:0px;width:76 8px;height:108px;z-index:0" align="left">
    <img src="bv01302.gif" id="Shape3" align="top" alt="" border="0" width="768" height="108"></div>
    <div id="bv_" style="position:absolute;left:24px;top:0px;width:2 88px;height:81px;z-index:1" align="left">
    <img src="bv01301.gif" id="Shape2" align="top" alt="" border="0" width="288" height="81"></div>
    <div id="bv_" style="position:absolute;left:384px;top:27px;width :240px;height:38px;z-index:2" align="left">
    <font style="font-size:27px" color="#000000" face="Comic Sans MS">Your Profile</font></div>
    <div id="bv_" style="position:absolute;left:48px;top:0px;width:2 37px;height:46px;z-index:3" align="center">
    <font style="font-size:19px" color="#000000" face="Lucida Sans Unicode"><b><br>
    www.GodHearMe.org</b></font></div>
    <div id="bv_" style="position:absolute;left:48px;top:81px;width: 648px;height:19px;z-index:4" align="left">
    <font style="font-size:16px" color="#000000" face="Times New Roman"><b> &quot;Surely the arm of the LORD is not too short to save, nor his ear too dull to hear.&quot;&nbsp; Isaiah 59</b></font></div>
    <img src="j0423103[1].jpg" id="Image2" alt="" align="top" border="0" width="120" height="108" style="position:absolute;left:24px;top:432px;width :120px;height:108px;z-index:5">
    <a href="http://www.godhearme.org/index.html"><img src="homepage.jpg" id="Image1" alt="" align="top" border="0" width="40" height="45" style="position:absolute;left:672px;top:27px;width :40px;height:45px;z-index:6"></a>
    <div id="bv_" style="position:absolute;left:24px;top:161px;width :131px;height:220px;z-index:7" align="center">
    <table border="0" cellpadding="0" cellspacing="0" id="NavigationBar1">
    <tr>
    <td align="left" valign="top" width="131" height="30"><a href="http://www.godhearme.org/index.html"><img id="bv01310" src="bv01310.gif" alt="Home" title="Home" align="top" border="0" width="131" height="30" onmouseover="SwapImage(1,0,'bv01310','bv01310_over .gif')" onmouseout="SwapImage(0,0,'bv01310','bv01310.gif') "></a></td>
    </tr>
    <tr><td height="8"></td></tr><tr>
    <td align="left" valign="top" width="131" height="30"><a href="http://www.godhearme.org/Request.html"><img id="bv01312" src="bv01312.gif" alt="Edit Profile" title="Edit Profile" align="top" border="0" width="131" height="30" onmouseover="SwapImage(1,0,'bv01312','bv01312_over .gif')" onmouseout="SwapImage(0,0,'bv01312','bv01312.gif') "></a></td>
    </tr>
    <tr><td height="8"></td></tr><tr>
    <td align="left" valign="top" width="131" height="30"><a href="http://www.godhearme.org/Profile.html"><img id="bv01311" src="bv01311.gif" alt="Your Profile" title="Your Profile" align="top" border="0" width="131" height="30" onmouseover="SwapImage(1,0,'bv01311','bv01311_over .gif')" onmouseout="SwapImage(0,0,'bv01311','bv01311.gif') "></a></td>
    </tr>
    <tr><td height="8"></td></tr><tr>
    <td align="left" valign="top" width="131" height="30"><a href="http://www.godhearme.org/Testimony.html"><img id="bv01315" src="bv01315.gif" alt="YourTestimony" title="YourTestimony" align="top" border="0" width="131" height="30" onmouseover="SwapImage(1,0,'bv01315','bv01315_over .gif')" onmouseout="SwapImage(0,0,'bv01315','bv01315.gif') "></a></td>
    </tr>
    <tr><td height="8"></td></tr><tr>
    <td align="left" valign="top" width="131" height="30"><a href="http://www.godhearme.org/PrayForSomeone.html"><img id="bv01313" src="bv01313.gif" alt="Your Prayers" title="Your Prayers" align="top" border="0" width="131" height="30" onmouseover="SwapImage(1,0,'bv01313','bv01313_over .gif')" onmouseout="SwapImage(0,0,'bv01313','bv01313.gif') "></a></td>
    </tr>
    <tr><td height="8"></td></tr><tr>
    <td align="left" valign="top" width="131" height="30"><a href="http://www.godhearme.org/AnsweredPrayers.html"><img id="bv01314" src="bv01314.gif" alt="Commitments" title="Commitments" align="top" border="0" width="131" height="30" onmouseover="SwapImage(1,0,'bv01314','bv01314_over .gif')" onmouseout="SwapImage(0,0,'bv01314','bv01314.gif') "></a></td>
    </tr>
    </table>
    </div>
    <div id="bv_" style="position:absolute;left:24px;top:540px;width :144px;height:19px;z-index:8" align="center">
    <font style="font-size:16px" color="#000000" face="Arial"><b>God loves you!</b></font></div>
    </div>
    </body>
    </html>

  13. #13
    Join Date
    Sep 2005
    Location
    Cincinnati, Ohio
    Posts
    2,116

    Default Re: How to display database records on screen?

    Hey

    I'm sorry I asked for the code of the wrong page. Whats the code for "Profile.php"

    I'm thinking there is a condition on this page that has it redirect back to your login, and because of some bug or logical error that condition is being met, which is causing the loop. That is to say your login form is redirecting to profile.php because it just logged you in. When you get to profile.php, its not validating that login to its redirecting back to the login page.

    On a side note:
    In your script, all of your posted variables are not being properly registered. (As it is now they will still work, I will explain this in the next paragraph). For each variable like $s1, $username1, or $password1 you need to either change each to $_POST['s1'], or before they are used in the script assign each to their posted value, such as $s1 = $_POST['s1'];

    As it is now, it is using what is called register_globals, which is obsolete feature. A feature disabled by default in php5, and a feature that won't be present at all in php6. Using it will very likely cause your script to not work at some point. If you plan on using this script (once working that is) for an extended period of time (for years to come) you need to make sure it doesn't rely on register globals.

    Register/Login Script
    Do you use a Password Protected Directory? Need a way to allow users to make their own account, try my .htaccess Login Script

  14. #14
    Join Date
    Oct 2005
    Location
    Italy
    Posts
    12,082

    Default Re: How to display database records on screen?

    Why don't you start by changing this line:

    if(!empty($_POST['$username1']) && !empty($_POST['$password1]))

    and

    if(isset($_POST['s1']))

    and see how this is?

    Most probably register_globals is ALREADY disabled in your server.
    Navaldesign
    Logger Lite: Low Cost, Customizable, multifeatured Login script
    Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart
    DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more....
    Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!


  15. #15
    Join Date
    Jul 2007
    Location
    Oporto - Portugal
    Posts
    129

    Default Re: How to display database records on screen?

    Quote Originally Posted by navaldesign View Post
    Thats just because short tags are disabled, you need to configure your php.ini for WAMP, I guess short tags are disabled by default. (The majority of web hosts have it enabled so its not a problem normally)
    naval, Thanks for the explanation, I have never even opened that file to see what's inside.
    Have You seen my other thread about the new user to reserved area link ? Can You help? Please.

    Cheers,

    pipesportugal

  16. #16
    Join Date
    Oct 2005
    Location
    Italy
    Posts
    12,082

    Default Re: How to display database records on screen?

    Thank you, though it has ben Watdaflip to point the above.

    Didn't see the other thread, will look now.
    Navaldesign
    Logger Lite: Low Cost, Customizable, multifeatured Login script
    Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart
    DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more....
    Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!


  17. #17
    Join Date
    Apr 2008
    Posts
    32

    Default Re: How to display database records on screen?

    phew! i dont even know where and what is WAMP?
    where

  18. #18
    Join Date
    Apr 2008
    Posts
    32

    Default Re: How to display database records on screen?

    phew! i dont even know where and what is WAMP?
    where in cpanel should i disable or enable this?
    maybe thats causing this.

    (i've not done programming for loooong time now, i was good at it before... oh what a shame!)

    thanks, i appreciate it.

  19. #19
    Join Date
    Sep 2005
    Location
    Cincinnati, Ohio
    Posts
    2,116

    Default Re: How to display database records on screen?

    WAMP is an environment to run essentially a webserver locally on your own computer. Mainly so you don't need to have access to the internet to develop a project. It an abbreviations for Windows, and the three environments int includes Apache, MySQL, PHP. It doesn't have anything to do with the problem you are having, you don't need it, you don't need to know anything about it if you don't want to.

    EDIT:

    I'm not sure if you are refering to enabling/disabling smart tags, or register_gloabals.. but either way its isn't done though cpanel, and either way for you they are already set as they should be.

    Register/Login Script
    Do you use a Password Protected Directory? Need a way to allow users to make their own account, try my .htaccess Login Script

  20. #20
    Join Date
    Dec 2007
    Location
    Santo Domingo, Dominican Republic
    Posts
    53

    Default Re: How to display database records on screen?

    I want to know how to configure php.ini and where is located in my site.
    I will appreciate this info in order to start learning and writing php scripts

  21. #21
    Join Date
    Oct 2005
    Location
    Italy
    Posts
    12,082

    Default Re: How to display database records on screen?

    The php.ini file is NOT in your site but in one of the server's root paths, and it's values are set by the VH staff. It is NOT advisabble that you mess with local php.ini files as it seems that you don't have the necessary knowledge and experiense. You don't even need to modify it, in order to load and run 99% of the common php scripts.
    If there are specific tasks that you need to accomplish, post your requirements and i will see to provide you a specific script for that purpose, if it is within the limits allowed by the VodaHost TOS
    Navaldesign
    Logger Lite: Low Cost, Customizable, multifeatured Login script
    Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart
    DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more....
    Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!


  22. #22
    Join Date
    Apr 2008
    Posts
    32

    Default Re: How to display database records on screen?

    hi there again.
    goodnews first, i have progress with log-in screen and displaying records. After so much readings, trial and errors, still can't find answers to the following questions :

    1. How to display submission_date with format mm/dd/yy, as it is now it shows May 23, 2008. I ve gone thru the php manuals and read some thread but no luck. i still get errors. if someone can show me the syntax to echo this field with mm/dd/yy format, greatly appreciated.
    2. How to limit the size of the of the field displayed. Seems like echo <td WIDTH=50> dont work. for example a field with length of 500, but to display only the first 50 characters. kind of equivalent to substr in VB.
    3. How to select 2 tables using 2 match keys, joining them together. one table is master where if none found in other table, it will still display that record. Appreciate any sample codes, please.
    4.How to limit records on a screen page, sample codes please...

    well, i still have other issues but this is it for now.

    hope to hear from anyone, thanks.

  23. #23
    Join Date
    Apr 2008
    Posts
    32

    Default Re: How to display database records on screen?

    hi there.
    i think i have the answers to #1,2,4 of the above so please dont bother responding to them. Im still struggling with #3 issue but progressing, appreciate any inputs. thanks.

  24. #24
    Join Date
    Apr 2008
    Posts
    32

    Default Re: How to display database records on screen?

    hi there again.
    why do i have this error when the page is displayed:
    "Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started
    at /home/rhidsrn/public_html/GHM/ProfileMain.php: in /home/rhidsrn/public_html/GHM/ghm_conn.php on line 41"


    On all of the php pages I put:
    require_once "ghm_conn.php";

    line 41 is session_start();

    I tried to take this out on "ghm_conn_next.php" for the next page to open up but it will not populate or the text fields will be blank.




    The following is the ghm_conn.php:

    <?
    $db_host = "localhost";
    $db_username = "rhidsrn_maryfil";
    $db_password = "xx"
    $db_name = "rhidsrn_ABVFP";
    $script_dir = "GHM";
    //////////////////////////////////////////////////////
    //////////////////////////////////////////////////////
    //////////////////////////////////////////////////////
    //connect to the database server
    $connection = mysql_connect($db_host, $db_username, $db_password) or die(mysql_error());

    //select database
    $db = mysql_select_db($db_name, $connection);
    session_start();
    if(!empty($script_dir))
    {
    $dir = "/".$script_dir;
    }
    $t = time();
    ?>

    I appreciate any help, thanks.

  25. #25
    Join Date
    Sep 2005
    Location
    Cincinnati, Ohio
    Posts
    2,116

    Default Re: How to display database records on screen?

    session_start() needs to be executed before any output, whether it is echo'd or just normal html code. You just have to move session_start() to be before any output.

    Register/Login Script
    Do you use a Password Protected Directory? Need a way to allow users to make their own account, try my .htaccess Login Script

  26. #26
    Join Date
    Apr 2008
    Posts
    32

    Default Re: How to display database records on screen?

    Thanks, Watda.
    It works!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Posting Permissions

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