Jump to content

Call-911

Members
  • Posts

    51
  • Joined

  • Last visited

    Never

Posts posted by Call-911

  1. Hey All,

     

    I've tried everything...

     

    How can I add nl2br to this, so it fix's quotes and does nl2br.

     

    			<tr>
    			<td width='200px' valign='top'>Course Overview: </td>
    			<td valign='top'> " . fixQuotes($row['overview']) . "</td>
    		</tr>

  2. Hello All,

     

    In below script, I'm using another script called "SimpleImage.php" to upload and resize photos for a news site. The problem comes with renaming the photos. I need to name the photo based off of the story id. I have everything right to get the story id, but saving it as the variable is what's confusing me.

     

    Here's what I have:

     

    <?php include ("newsconnection.php");?>
    <?php
    $picturename = $_POST['newstoryid'];
    
          include('SimpleImage.php');
          $image = new SimpleImage();
          $image->load($_FILES['uploaded_image']['tmp_name']);
          $image->resizeToWidth(300);
          $image->save('$picturename');
    
    ?>

     

    It's the $image->save('$picturename'); line that's messing me up. Any help would be great!!

  3. Thanks for the help, but I think I did it wrong. It stops loading the rest of the page after the code. I think I put it in wrong....

     

    <?php
    include ("../../includes/connections/newsconnection.php");
    $id=$_GET['id'];
    //declare the SQL statement that will query the database
    $query = "
    SELECT *
    FROM news
    WHERE id='$id'
    ";
    //execute the SQL query and return records
    $result = mssql_query($query);
    //display the results
    //id, school, date, link, title, story, picture
    while($row = mssql_fetch_array($result))
    {
    echo "<span class='bodyb'>";
    echo $row["title"];
    echo "</span>";
    echo "<br /><i>";
    echo date('l, F j, Y', strtotime($row['date']));
    echo "</i>";
    echo "<br /><br />";
    echo fixQuotes($row["story"]);
    if ($row("picture")!='NULL') echo "<img src='../../images/news/";
    if ($row("picture")!='NULL') echo $row["picture"];
    if ($row("picture")!='NULL') echo "' align='left' class='imgspacer-left'>";
    }
    //close the connection
    mssql_close($dbhandle);
    ?> 

  4. Hello All,

     

    I tried searching here and google, but couldn't figure it out on my own... still

     

    Bellow is my code, I need some help figuring out how to tell PHP that "If picture is NULL, don't try to display it."

     

    Basically I have a dynamic news system set up. Some stories have pictures, some do not. I need PHP to not display the code for showing the picture if the picture value = NULL.

     

    Any help would be appreciated!

     

    <?php 
    include ("../../includes/connections/newsconnection.php");
    
    $id=$_GET['id'];
    
    //declare the SQL statement that will query the database
    $query = "
    SELECT *
    FROM news 
    WHERE id='$id'
    ";
    
    //execute the SQL query and return records
    $result = mssql_query($query);
    
    //display the results 
    
    //id, school, date, link, title, story, picture
    
    while($row = mssql_fetch_array($result))
    {
    echo "<span class='bodyb'>";
    echo $row["title"];
    echo "</span>";
    echo "<br /><i>";
    echo date('l, F j, Y', strtotime($row['date']));
    echo "</i>";
    echo "<br /><br />";
    //heres where I need to stop if picture is null
    echo "<img src='../../images/news/";
    echo $row["picture"];
    echo "' align='left' class='imgspacer-left'>";
    echo fixQuotes($row["story"]);
    
    }
    
    //close the connection
    mssql_close($dbhandle);
    ?> 

  5. Hello All,

     

    I am looking for a script/software/solution for my goal. I am a webmaster for a school district. We've been paying outside groups annual fees to make/host websites for our teachers. (Such as teacherweb.com, etc)

     

    We have plenty of server space, so we would like to save on those fees and offer the teachers to design/host their websites on the schools server. The hosting part is easy, it's the design part I can't figure out. Teacherweb uses an easy web-based design layout to upload, change, and create webpages. We want something like this, but on our own server.

     

    What I need:

    -a solution where I can make a folder on the schools server for the teacher

    -the teacher can then log in, and create/modify their websites

    -needs to be extremely user friendly

    -preferably free, or a one-time fee

     

     

    Thanks! I'm curious to hear your ideas!

  6. Hey All,

     

    I need some help finding a good news script, or at least a push in the right direction.

     

    What I need to do:

     

    Have a database for news stories.

     

    Make a basic CMS where the client can upload a title, picture, and the news story.

     

    Have the news story display on the "home page" with just the title and a small except of the story (maybe 100 words)

     

    On the news page, have a "read more" option, that when clicked links to another page where it has the whole story and picture.

     

     

    I can figure out the CMS stuff, I've done that before. What I don't get is the "read more" function. I can figure out how to link up a page to a database, draw the most recent story, and display the first 100 words. I just can't figure out how to make a "Read More" function where it will link to a different page that has the whole story. Obviously I don't want a million different pages, so I just want one page that will display different database information depending on what news story is clicked.

     

    I hope that makes sense. Maybe I am wording it wrong or am looking for the wrong thing. Any help would be appreciated. A tutorial would be wonderful, but I'll take any help I can get. This seems like it should be easy, but I'm just missing something...

     

    Thanks!!

  7. Hello all,

     

    I have a PHP email script that works great, it sends an email to every user in my database.

     

    What I need is a way to display a message (preferably a little message pop up box) after the script is finished sending out it's emails. Right now the only way to tell it's done is thing's stop loading and at the bottom of Firefox it says it stops saying "Loading" and changes to "Done"

     

    Any advice? This seems simple enough, but I just can't seem to figure it out.

     

    Below is my script.

     

    <?php
    // Start a session
    session_start();
    
    
    mysql_connect("localhost", "xxxxx", "xxxxxx") or die(mysql_error());
    mysql_select_db("xxxxxxxxx") or die(mysql_error());
    $id = $_POST['studentid'];
    $query="SELECT * FROM members";
    $result=mysql_query($query);
    $num=mysql_numrows($result); 
    
    $i=0;
    while ($i < $num) {
    $id=mysql_result($result,$i,"id");
    $username=mysql_result($result,$i,"username");
    $firstname=mysql_result($result,$i,"firstname");
    $lastname=mysql_result($result,$i,"lastname");
    $address=mysql_result($result,$i,"address");
    $city=mysql_result($result,$i,"city");
    $state=mysql_result($result,$i,"state");
    $zip=mysql_result($result,$i,"zip");
    $phone=mysql_result($result,$i,"phone");
    $email=mysql_result($result,$i,"email");
    $iba=mysql_result($result,$i,"iba");
    $mbd=mysql_result($result,$i,"marchingband_currentdue");
    $ctd=mysql_result($result,$i,"choir_currentdue");
    
    
    $fd = popen("/usr/sbin/sendmail -t","w") or die("Couldn't Open Sendmail");
    fputs($fd, "To: $email \n");
    fputs($fd, "From: \"LWE Music\" <lwemusic@lwemusic.org> \n");
    fputs($fd, "Subject: $firstname $lastname IBA \n");
    fputs($fd, "X-Mailer: PHP3 \n\n");
    fputs($fd, "To the parents of $firstname $lastname,
    
    
    This is your LWE Music IBA Statement.
    ---------------------------------------------------------------------
    
    Student Name: $firstname $lastname (Student ID: $id)
    
    Your current IBA is: $iba
    
    Your current Marching Band Fees are: $mbd
    
    Your current Choir Trip Fees are: $ctd
    
    ---------------------------------------------------------------------
    
    You can log into the Member Section by naviagting to lwemusic.org and click on Member Account Log In
    
    
    Any IBA Transfers can be completed online through the Member Section. 
    
    
    For any questions about your IBA Balance or current fees, please contact the treasurer through the lwemusic.org Member Section.
    
    
    If you have forgotten your password, or do not know how to log in, please contact Eric Nush at enush@lw210.org
    
    
    
    
    Thank You,
    LWE Music \n");
    pclose($fd);
    Echo "Emails sent to $email"
    ?>
    <br>
    
    <br>
    
    <?php
    ++$i;
    } 
    ?>

  8. Okay, changed up the form to use the SendMail method instead of the basic php mail. Works much better for me. So I have this working perfectly to send out the email if I specify the ID, now I need to figure out how it to go through the database row by row and send the specific email with the specific values.

     

    <?php
    // Start a session
    session_start();
    
    
    include("dbinfo.inc.php");
    mysql_connect(localhost,$username,$password);
    @mysql_select_db($database) or die( "Unable to select database");
    $id = $_POST['studentid'];
    $query="SELECT * FROM members WHERE id='200472'";
    $result=mysql_query($query);
    $num=mysql_numrows($result); 
    mysql_close();
    
    $i=0;
    while ($i < $num) {
    $id=mysql_result($result,$i,"id");
    $username=mysql_result($result,$i,"username");
    $firstname=mysql_result($result,$i,"firstname");
    $lastname=mysql_result($result,$i,"lastname");
    $address=mysql_result($result,$i,"address");
    $city=mysql_result($result,$i,"city");
    $state=mysql_result($result,$i,"state");
    $zip=mysql_result($result,$i,"zip");
    $phone=mysql_result($result,$i,"phone");
    $email=mysql_result($result,$i,"email");
    $iba=mysql_result($result,$i,"iba");
    $mbd=mysql_result($result,$i,"marchingband_currentdue");
    $ctd=mysql_result($result,$i,"choir_currentdue");
    
    $fd = popen("/usr/sbin/sendmail -t","w") or die("Couldn't Open Sendmail");
    fputs($fd, "To: $email \n");
    fputs($fd, "From: \"LWE Music\" <lwemusic@lwemusic.org> \n");
    fputs($fd, "Subject: $firstname $lastname IBA \n");
    fputs($fd, "X-Mailer: PHP3 \n\n");
    fputs($fd, "To the parents of $firstname $lastname,
    
    This is your monthly LWE Music IBA Statement.
    
    Your current IBA is: $iba
    Your current Marching Band Fees are: $mbd
    Your current Choir Trip Fees are: $ctd
    
    Thank You,
    LWE Music \n");
    pclose($fd);
    ?>
    <br>
    
    <br>
    
    <?php
    ++$i;
    } 
    ?>

  9. I put in an id so I could for sure get one result. I couldn't figure out how to get more then that one result.

     

    So you think I should do something like this?

     

    <?php
    // Start a session
    session_start();
    
    
    include("dbinfo.inc.php");
    mysql_connect(localhost,$username,$password);
    @mysql_select_db($database) or die( "Unable to select database");
    $id = $_POST['studentid'];
    $query="SELECT * FROM members'";
    $result=mysql_query($query);
    $num=mysql_numrows($result); 
    
    $i=0;
    while ($i < $num) {
    $id=mysql_result($result,$i,"id");
    $username=mysql_result($result,$i,"username");
    $firstname=mysql_result($result,$i,"firstname");
    $lastname=mysql_result($result,$i,"lastname");
    $address=mysql_result($result,$i,"address");
    $city=mysql_result($result,$i,"city");
    $state=mysql_result($result,$i,"state");
    $zip=mysql_result($result,$i,"zip");
    $phone=mysql_result($result,$i,"phone");
    $email=mysql_result($result,$i,"email");
    $iba=mysql_result($result,$i,"iba");
    $mbd=mysql_result($result,$i,"marchingband_currentdue");
    $ctd=mysql_result($result,$i,"choir_currentdue");
    
    
    while($row = mysql_fetch_array($num))
    {
    //define the receiver of the email
    $to = '$email';
    //define the subject of the email
    $subject = '$firstname $lastname IBA';
    //define the message to be sent. Each line should be separated with \n
    $message = "Hello $firstname $lastname. This is your monthly email reminder. Your IBA Account is $iba, for Marching Band you owe $mbd, and for Choir you owe $ctd. Thank You.";
    //define the headers we want passed. Note that they are separated with \r\n
    $headers = "From: lwemusic@lwemusic.org\r\nReply-To: lwemusic@lwemusic.orgl";
    //send the email
    $mail_sent = @mail( $to, $subject, $message, $headers );
    //if the message is sent successfully print "Mail sent". Otherwise print "Mail failed" 
    echo $mail_sent ? "Mail sent" : "Mail failed";
    }
    mysql_close($con)
    ?>
    <br>
    
    <br>
    
    <?php
    ++$i;
    } 
    ?>

  10. Here is my current coding:

     

    <?php
    // Start a session
    session_start();
    
    
    include("dbinfo.inc.php");
    mysql_connect(localhost,$username,$password);
    @mysql_select_db($database) or die( "Unable to select database");
    $id = $_POST['studentid'];
    $query="SELECT * FROM members WHERE id='200472'";
    $result=mysql_query($query);
    $num=mysql_numrows($result); 
    mysql_close();
    
    $i=0;
    while ($i < $num) {
    $id=mysql_result($result,$i,"id");
    $username=mysql_result($result,$i,"username");
    $firstname=mysql_result($result,$i,"firstname");
    $lastname=mysql_result($result,$i,"lastname");
    $address=mysql_result($result,$i,"address");
    $city=mysql_result($result,$i,"city");
    $state=mysql_result($result,$i,"state");
    $zip=mysql_result($result,$i,"zip");
    $phone=mysql_result($result,$i,"phone");
    $email=mysql_result($result,$i,"email");
    $iba=mysql_result($result,$i,"iba");
    $mbd=mysql_result($result,$i,"marchingband_currentdue");
    $ctd=mysql_result($result,$i,"choir_currentdue");
    ?>
    <?php
    //define the receiver of the email
    $to = '$email';
    //define the subject of the email
    $subject = '$firstname $lastname IBA';
    //define the message to be sent. Each line should be separated with \n
    $message = "Hello $firstname $lastname. This is your monthly email reminder. Your IBA Account is $iba, for Marching Band you owe $mbd, and for Choir you owe $ctd. Thank You.";
    //define the headers we want passed. Note that they are separated with \r\n
    $headers = "From: lwemusic@lwemusic.org\r\nReply-To: lwemusic@lwemusic.orgl";
    //send the email
    $mail_sent = @mail( $to, $subject, $message, $headers );
    //if the message is sent successfully print "Mail sent". Otherwise print "Mail failed" 
    echo $mail_sent ? "Mail sent" : "Mail failed";
    ?>
    <br>
    
    <br>
    
    <?php
    ++$i;
    } 
    ?>

     

    I'm pretty sure that's how you would send one email. I just need to figure out where it goes through the database and takes one username, attaches the values, sends, repeat.

     

    Thanks!

  11. Hello All,

     

    I have figured out how to get all the information from my member database into a table.

     

    Now what I need to do is take every entry, and send an email to that member with the information.

     

    For example, I have 150 users in my database, with columns for name, email address, and amount due.

     

    I can't figure out how to send an email to every user automatically, saying "Hello <name>, you currently owe <amountdue>."

     

    I can figure out how to send the same email to every user, but not to send specific values for each user in each email to the user.

     

    Any help would be great!! Thanks!

  12. Hello all,

     

    Sorry if this has been asked before, but I have tried searching here and Google and just can not find what I need.

     

    Basically, I have a database that includes names, emails, and the amount they owe.

     

    I would like to be able to send out a mass email to everyone in that database, and have it basically say:

     

    "Hello <name>, you currently owe <amountdue>."

     

    I can't figure out how to do this...

     

    Any help would be great!!  or just a shove in the right direction to the proper tutorial! THanks!

  13. pwnuspoints,

     

    Thanks so much. I've got the whole login system already set up and coded perfectly. What I can't figure out is how to display a popup message. Almost like an error message. A message like on MS Word when you exit it pops up a box saying "Are You Sure You Want To Quit Without Saving". That's the kind of box I need.

     

    I already have the email variable being read on the page, so if $email == "No Email On File"  to pop up a message box and say "Please Update Your Contact Information" ....  or I guess "Update your email fool!" works too. :-)

  14. Hello All,

     

    I have a login system on my website using a mySQL database. What I need to do is display a message to users upon logging to please update their contact information. I don't want to display this to every user, as that would be annoying, but only to the users that have no updated their information.

     

    For example, if John Doe's email address is "No Email On File"  then I would like upon John Doe logging in a message to pop up saying "Please update your contact information"

     

    Any help is great appreciated.

  15. Hello All,

     

    I have a database table named "iba"

     

    The table has the following columns:

    id (auto increment)

    studentid (which is equal to the session id of the current logged in user)

    date

    dep/wtd

    event

    ammount

    total

     

    Here's my question:

    I can figure out how to add up the values in the column "ammount", but I need the values from "ammount" to be interested automatically into the column "total". There are many different rows added for different events, and the ammount earned from each event needs to be added up in the total column.

     

    Hopefully this makes sense, thanks!

     

  16. Hello All,

     

    I tried searching for an answer, but to no avail.

     

    Basically, my script works GREAT, except for one small part, the user can change the password to be blank. I have tried everything including the empty() and the if ='null' commands, but can't get anything to work.

     

    So I need the script to make sure that the $newpassword or the $confirmnewpassword variables are not blank before processing the request. Thanks!!

     

     
    
    <?
    // Start a session
    session_start();
    
    // Sends the user to the login-page if not logged in
    if(!session_is_registered('member_ID')) :
    
    
    
    header('Location: index.php?msg=requires_login');
    endif;
    
    include("dbinfo.inc.php");
    mysql_connect(localhost,$username,$password);
    @mysql_select_db($database) or die( "Unable to select database");
    $user = $_SESSION["member_ID"];
    
    $username = $_POST['$user'];
    $password = $_POST['password'];
    $newpassword = sha1($_POST['newpassword']);
    $confirmnewpassword = sha1($_POST['confirmnewpassword']);
    
    if($newpassword=$confirmnewpassword)
        $sql=mysql_query("UPDATE members SET user_password='$newpassword' where username='$user'"); 
        if($sql) 
        { 
        echo "Your Password Has Been Changed."; 
        }
    else
    { 
    echo "The Passwords You Entered Do Not Match, Or You Have Not Entered A Password. Please Try Again."; 
    }  
    ?> 
    
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    </head>
    <body>
    <p><a href="members.shtml" title="Back">Back</a></p>
    </body>
    </html>
    

  17. Ah, I figured it out!!! Thanks Maq for pointing me in the right direction!!!

     

    For future reference here's the final code:

     

    Update Page:

    <?php
    // Start a session
    session_start();
    
    // Sends the user to the login-page if not logged in
    if(!session_is_registered('member_ID')) :
    header('Location: index.php?msg=requires_login');
    endif;
    
    include("dbinfo.inc.php");
    mysql_connect(localhost,$username,$password);
    @mysql_select_db($database) or die( "Unable to select database");
    $id = $_SESSION["member_ID"];
    $query="SELECT * FROM members WHERE id='$id'";
    $result=mysql_query($query);
    $num=mysql_numrows($result); 
    mysql_close();
    
    $i=0;
    while ($i < $num) {
    $id=mysql_result($result,$i,"id");
    $username=mysql_result($result,$i,"username");
    $firstname=mysql_result($result,$i,"firstname");
    $lastname=mysql_result($result,$i,"lastname");
    $address=mysql_result($result,$i,"address");
    $city=mysql_result($result,$i,"city");
    $state=mysql_result($result,$i,"state");
    $zip=mysql_result($result,$i,"zip");
    $phone=mysql_result($result,$i,"phone");
    $email=mysql_result($result,$i,"email");
    ?>
    
    <form action="updated.php" method="POST">
    <input type="hidden" name="ud_id" value="<?php echo "$id"; ?>">
    Student ID: <?php echo "$id"?><br>
    First Name: <?php echo "$firstname"?><br>
    Last Name: <?php echo "$lastname"?><br>
    Address: <input type="text" name="ud_address" value="<?php echo "$address"?>"><br>
    City: <input type="text" name="ud_city" value="<?php echo "$city"?>"><br>
    State: <input type="text" name="ud_state" value="<?php echo "$state"?>"><br>
    Zip: <input type="text" name="ud_zip" value="<?php echo "$zip"?>"><br>
    Phone: <input type="text" name="ud_phone" value="<?php echo "$phone"?>"><br>
    Email: <input type="text" name="ud_email" value="<?php echo "$email"?>"><br>
    <input type="Submit" value="Update">
    </form>
    
    <?php
    ++$i;
    } 
    ?>
    

     

     

    Action Script (updated.php):

    <?
    $ud_id=$_POST['ud_id'];
    $ud_address=$_POST['ud_address'];
    $ud_city=$_POST['ud_city'];
    $ud_state=$_POST['ud_state'];
    $ud_zip=$_POST['ud_zip'];
    $ud_phone=$_POST['ud_phone'];
    $ud_email=$_POST['ud_email'];
    
    include("dbinfo.inc.php");
    mysql_connect(localhost,$username,$password);
    
    $query="UPDATE members SET address='$ud_address', city='$ud_city', state='$ud_state', zip='$ud_zip', phone='$ud_phone', email='$ud_email' WHERE id='$ud_id'";
    @mysql_select_db($database) or die( "Unable to select database");
    mysql_query($query);
    echo "Thank You For Updating Your Records";
    mysql_close();
    ?>
    

  18. Sorry, I still can't figure out what you mean. I'm still new to all this PHP stuff. Should I be doing this:

     

    <?php

    include("dbinfo.inc.php");

    mysql_connect(localhost,$username,$password);

     

    $query="UPDATE members SET address='$ud_address', city='$ud_city', state='$ud_state', zip='$ud_zip', phone='$ud_phone', email='$ud_email' WHERE id='$ud_id'";

    $ud_address = mysql_real_escape_string($_POST['ud_address']);

    $ud_city = mysql_real_escape_string($_POST['ud_city']);

    $ud_state = mysql_real_escape_string($_POST['ud_state']);

    $ud_zip = mysql_real_escape_string($_POST['ud_zip']);

    $ud_phone = mysql_real_escape_string($_POST['ud_phone']);

    $ud_email = mysql_real_escape_string($_POST['ud_email']);

    @mysql_select_db($database) or die( "Unable to select database");

    mysql_query($query);

    echo "Record Updated";

    mysql_close();

    ?>

  19. Maq,

    I tried to PM you but it wouldn't work.

     

    Do you mean my action page needs to look like this:

     

    <?
    include("dbinfo.inc.php");
    mysql_connect(localhost,$username,$password);
    
    $query="UPDATE members SET
    $ud_address = mysql_real_escape_string($_POST['ud_address']);
    $ud_city = mysql_real_escape_string($_POST['ud_city']);
    $ud_state = mysql_real_escape_string($_POST['ud_state']);
    $ud_zip = mysql_real_escape_string($_POST['ud_zip']);
    $ud_phone = mysql_real_escape_string($_POST['ud_phone']);
    $ud_email = mysql_real_escape_string($_POST['ud_email']);
    @mysql_select_db($database) or die( "Unable to select database");
    mysql_query($query) or die(mysql_error());
    echo "Record Updated";
    mysql_close();
    ?>
    

  20. Hello All,

     

    So I've got a update user info form, the only problem is it's not updating. It draws the data from the database fine and displays it in the fields, but when you change the fields and click "update" it doesn't update.

     

    Here's the update page:

    <?
    // Start a session
    session_start();
    
    // Sends the user to the login-page if not logged in
    if(!session_is_registered('member_ID')) :
    header('Location: index.php?msg=requires_login');
    endif;
    
    include("dbinfo.inc.php");
    mysql_connect(localhost,$username,$password);
    @mysql_select_db($database) or die( "Unable to select database");
    $user = $_SESSION["member_ID"];
    $query="SELECT * FROM members WHERE id='$user";
    $result=mysql_query($query);
    $num=mysql_numrows($result); 
    mysql_close();
    
    $i=0;
    while ($i < $num) {
    $username=mysql_result($result,$i,"username");
    $firstname=mysql_result($result,$i,"firstname");
    $lastname=mysql_result($result,$i,"lastname");
    $address=mysql_result($result,$i,"address");
    $city=mysql_result($result,$i,"city");
    $state=mysql_result($result,$i,"state");
    $zip=mysql_result($result,$i,"zip");
    $phone=mysql_result($result,$i,"phone");
    $email=mysql_result($result,$i,"email");
    ?>
    
    <form action="updated.php">
    <input type="hidden" name="ud_id" value="<? echo "$id"; ?>">
    Student ID: <? echo "$username"?><br>
    First Name: <? echo "$firstname"?><br>
    Last Name: <? echo "$lastname"?><br>
    Address: <input type="text" name="ud_address" value="<? echo "$address"?>"><br>
    City: <input type="text" name="ud_city" value="<? echo "$city"?>"><br>
    State: <input type="text" name="ud_state" value="<? echo "$state"?>"><br>
    Zip: <input type="text" name="ud_zip" value="<? echo "$zip"?>"><br>
    Phone: <input type="text" name="ud_phne" value="<? echo "$phone"?>"><br>
    Email: <input type="text" name="ud_email" value="<? echo "$email"?>"><br>
    <input type="Submit" value="Update">
    </form>
    
    <?
    ++$i;
    } 
    ?>
    

     

     

    And here's the updated.php script:

    <?
    include("dbinfo.inc.php");
    mysql_connect(localhost,$username,$password);
    
    $query="UPDATE members SET address='$ud_address', city='$ud_city', state='$ud_state', zip='$ud_zip', phone='$ud_phone', email='$ud_email' WHERE id='$ud_id'";
    @mysql_select_db($database) or die( "Unable to select database");
    mysql_query($query);
    echo "Record Updated";
    mysql_close();
    ?>
    

     

    Any help would be great!! Thanks!!

  21. Well, I actually solved it myself. I took another suggestion from an entirely different subject I randomly found while browsing the these threads. It's amazing, I've tried for three days to figure this out, have posted the same thread on about 5 PHP help forums, and I find the right answer by skimming through something totally unrelated. :-) It's crazy.

     

    In case you're interested, I used this:

    $username = $_SESSION["member_ID"];
    

     

    Then did my quarry as:

    $data = mysql_query("SELECT * FROM iba WHERE studentid ='$username'") 
    

     

    Works like a charm!!

     

     

    Here's the final code:

    <?php
    // Start a session
    session_start();
    
    // Sends the user to the login-page if not logged in
    if(!session_is_registered('member_ID')) :
    header('Location: index.php?msg=requires_login');
    endif;
    
    // Include database information and connectivity
    include 'db.php';
    
    // We store all our functions in one file
    include 'functions.php';
    $username = $_SESSION["member_ID"];
    $data = mysql_query("SELECT * FROM iba WHERE studentid ='$username'") 
    or die(mysql_error());
    Print "<table border cellpadding=3>";
    while($info = mysql_fetch_array( $data ))
    {
    Print "<tr>";
    Print "<th>Student ID:</th> <td>".$info['studentid'] . "</td> ";
    Print "<th>Date:</th> <td>".$info['date'] . "</td> ";
    Print "<th>DEP/WTD:</th> <td>".$info['dep/wtd'] . "</td> ";
    Print "<th>Event:</th> <td>".$info['event'] . "</td> ";
    Print "<th>Ammount:</th> <td>".$info['ammount'] . "</td> ";
    Print "<th>Total:</th> <td>".$info['total'] . " </td></tr>";
    }
    Print "</table>";
    ?> 
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <title>Members Only</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    </head>
    <body>
    <p><?php print user_info('firstname'); ?> <?php print user_info('lastname'); ?> (Student ID: <?php print user_info('username'); ?>)</p>
        <p>Welcome <?php print user_info('user_password'); ?></p>
        <p>Welcome <?php print user_info('firstname'); ?> <?php print user_info('lastname'); ?></p>
    <p><a href="logout.php" title="Log out of the member area">Log out</a></p>
    </body>
    </html>
    

     

    If anyone sees and problems or weaknesses doing it this way, please let me know!! But I'm happy that it finally works the way I want it to! :-)

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