On our way....

V-PV-P State College, PA Member
edited October 2006 in Internet & Media
Well, my thinkquest team is finally doing work, thanks to air. Me, air, ParanoidIronMan, and 3 other friends are finally getting down to business, and we have a nice layout so far. We decided not to do a full flash site, but rather, just make the menu's, navigation, etc flash in the html site. I will post a link or a pic or something later on through the project, when it's safe from being stolen. Thanks Air!

P.S, I recieved your info PM, and it's saved in my inbox, and I'll give it to the coach as soon as school starts, and if you have a fax, PM the number so I can send it to you, since my scanner doesn't want to work, and mail takes too long.
«1

Comments

  • airbornflghtairbornflght Houston, TX Icrontian
    edited August 2006
    Scar, can you email the stuff as pdf's? I dont have a fax at my house, my the place I work does, I'll ask them if they care. how many pages is it?


    Ok, on another topic, I have some php problems. I am trying to make a little app so that we can submit work that we have done, and also work that needs to be done. but I have some problems with the code. I am uploading a zip with all of the files in it, and I am going to put this online also, so that you can see the errors that it is throwing when I try to submit the form, which adds entries to a table in the database. I'm sending data for about 14 fields I think. anyway, Im at a loss. I tried to find the error, I know this thing is far from secure, but it doesnt need to be secure, just useable. not to mention, i dont know how to code a user management system, nor do I want to for something as simple as this.


    here is what it say:
    f'in SQL wrote:
    Notice: Undefined index: Requested By in c:\program files\testing server\www\Request\request.php on line 9

    Notice: Undefined index: Requested To in c:\program files\testing server\www\Request\request.php on line 10

    Notice: Undefined index: Date Posted in c:\program files\testing server\www\Request\request.php on line 11

    Notice: Undefined index: Month Posted in c:\program files\testing server\www\Request\request.php on line 12

    Notice: Undefined index: Year Posted in c:\program files\testing server\www\Request\request.php on line 13

    Notice: Undefined index: Date Needed in c:\program files\testing server\www\Request\request.php on line 14

    Notice: Undefined index: Month Needed in c:\program files\testing server\www\Request\request.php on line 15

    Notice: Undefined index: Year Needed in c:\program files\testing server\www\Request\request.php on line 16

    Notice: Undefined index: File Requested in c:\program files\testing server\www\Request\request.php on line 17

    I've looked at the lines it says, and those are the lines where I assign the posted value to a variable, then it goes through the script. The thing is, it only does that on some of the assignments, not all of them.. and I am at a loss.
  • V-PV-P State College, PA Member
    edited August 2006
    Scar, can you email the stuff as pdf's? I dont have a fax at my house, my the place I work does, I'll ask them if they care. how many pages is it?
    I haven't received it yet. I will see what I can do when I get it, after school starts and our couch signs us up. Wow, switching between AIM and SM is hard.
  • airbornflghtairbornflght Houston, TX Icrontian
    edited August 2006
    V|P wrote:
    I haven't received it yet. I will see what I can do when I get it, after school starts and our couch signs us up. Wow, switching between AIM and SM is hard.

    slower
  • Park_7677Park_7677 Missouri Member
    edited August 2006
    here is what it say:
    Quote:
    Originally Posted by f'in SQL
    Notice: Undefined index: Requested By in c:\program files\testing server\www\Request\request.php on line 9

    ...

    Don't use spaces (or use underscores _) in the form input feilds. Fix all of them using the following way:

    [PHP]<input type="text" name="requestedby">
    ...
    $by = $_POST["requestedby"];[/PHP]
  • airbornflghtairbornflght Houston, TX Icrontian
    edited August 2006
    ok, thnx
  • airbornflghtairbornflght Houston, TX Icrontian
    edited August 2006
    Now I am being plagued with another problem.

    The database isnt throwing any errors or anything, but when I go to the page to view all of the current requests, "requests.php", it displays nothing. it is making me wonder if the values are actually getting into the database, because I have an if statement to check if any values are returned, and if there arent any, it is supposed to display a message that says none were found, and that is what it is displaying..



    [PHP]<?php
    //include connection data
    include("dbconnect.php"); ?>
    <?php
    //select the needed data form the db
    $sql="SELECT * FROM requests order by id DESC";
    $result=mysql_query($sql);
    if(mysql_num_rows($result) == 0){
    //If there are no requests, tell the visitor
    echo("<span class='style1'>There are no requests. Make a request</span> <a href='request.php'> here</a>");
    }
    ?>
    <link href="styles.css" rel="stylesheet" type="text/css" />

    <table align="center" width="850" border="0" cellspacing="1" cellpadding="0">
    <tr>
    <td>
    <table align="center" width="850" border="0" cellspacing="2" cellpadding="3">
    <tr>
    <td width="185" align="center" class="box_button"><div align="left">Requested From</div></td>
    <td width="564" align="center" class="box_button"><div align="left">Short Description</div></td>
    <td width="75" align="center" class="box_button"><div align="left">Done?</div></td>
    </tr>
    <?php
    //Display the requests, including who submitted it, why, and its status.
    while($rows=mysql_fetch_array($result)){
    ?>
    <tr>
    <td align="center" class="style1"><? echo $rows; ?></td>
    <td align="center" class="style1"><? echo $rows; ?></td>
    <td align="center" class="style1"><img src="images/<? echo $rows; ?>.jpg" /></td>
    </tr>
    <?php
    }
    ?>
    </table>
    </td>
    </tr>
    </table>
    <div align="center"><a href="admin.php">Admin panel</a> <span class="style1">|</span> <a href="request.php">Request a song</a></div>[/PHP]
  • Park_7677Park_7677 Missouri Member
    edited August 2006
    First:

    Re-structure the IF/THEN statements. As it stands now, if zero results are returned it displays the error but still goes through the WHILE to display the results that don't exist. Add an ELSE to display the results in.

    There's no sore thumb sticking out in the code you posted now. I believe it's possibly the INSERT code in request.php (line 25):
    $sql = mysql_query("INSERT INTO `requests` (`neededby` , `neededfrom` , `dateposted` , `monthposted` , `yearposted` , `dateneeded` , `monthneeded` , `yearneeded` , `fileneeded` , `shortd` , `longd` , `time` , `ampm` , `status`) VALUES ('$by', '$from', '$datep', '$monthp', '$yearp', '$daten', '$monthn', '$yearn', '$filen', '$shortd', '$longd', '$time', '$ampm', '$status',);");

    Note the extra "," inside your INSERT. That may be tripping it up. Also using VALUES ('{$by}',... helps PHP find the variables. It's good practice because you can be sure they'll be substituted for their value whereas leaving it how it is now isn't always a guarantee.

    Note: Make sure if the CODE is being judge, filter out the supplied content before putting it in SQL. I could put an invalid "needby" to make it execute my own SQL. Possible your whole DB could be dropped.
  • airbornflghtairbornflght Houston, TX Icrontian
    edited August 2006
    that was it....
  • airbornflghtairbornflght Houston, TX Icrontian
    edited August 2006
    hey, how do I do or statments with sql.

    I have a place in the admin page for incomlete requests, and complete requests.

    in the incomplete requests, I need it to display results from two different queies in it.

    would it be:

    $sql="SELECT * FROM requests WHERE status='0' or SELECT * FROM requests WHERE status='1'" ;
  • Park_7677Park_7677 Missouri Member
    edited August 2006
    hey, how do I do or statments with sql.

    I have a place in the admin page for incomlete requests, and complete requests.

    in the incomplete requests, I need it to display results from two different queies in it.

    would it be:

    $sql="SELECT * FROM requests WHERE status='0' or SELECT * FROM requests WHERE status='1'" ;
    You can UNION two results but they must have the same number of columns (selecting * from the same table that's a given).

    [PHP]SELECT * FROM requests WHERE status = '0' UNION ALL SELECT * FROM requests WHERE status = '1'[/PHP]

    I assume there are more than 2 states for 'status' or you'd be taking a long way to select everything.
  • airbornflghtairbornflght Houston, TX Icrontian
    edited August 2006
    yeh, there are three states.

    0, 1, and 2.

    0 is new
    1 is in progress
    2 is completed.

    so I have to categories, unfinished and finished, I want 0 and 1 in unfinished, and 2 in finished.

    is there a better way?


    by the way, you are being a HUGE HELP right now! :p
  • airbornflghtairbornflght Houston, TX Icrontian
    edited August 2006
    [PHP]<?php
    //include connection data
    include("dbconnect.php"); ?>
    <?php
    //select the needed data form the db
    $sql="SELECT * FROM requests order by id DESC";
    $result=mysql_query($sql);
    if(mysql_num_rows($result) == 0){
    //If there are no requests, tell the visitor
    echo("<span class='style1'><b>There Are No Requests.<b></span><br /> <a href='request.php'>Make a Request Here</a>");

    die;

    }else{
    ?>

    <link href="styles.css" rel="stylesheet" type="text/css" />

    <table align="center" width="850" border="0" cellspacing="1" cellpadding="0">
    <tr>
    <td>
    <table align="center" width="850" border="0" cellspacing="2" cellpadding="3">
    <tr>
    <td width="185" align="center" class="box_button"><div align="left">Requested From:</div></td>
    <td width="564" align="center" class="box_button"><div align="left">Short Description:</div></td>
    <td width="75" align="center" class="box_button"><div align="left">Statu:</div></td>
    </tr>
    <?php
    //Display the requests, including who submitted it, why, and its status.
    while($rows=mysql_fetch_array($result)){
    ?>
    <tr>
    <td align="center" class="style1"><? echo $rows; ?></td>
    <td align="center" class="style1"><? echo $rows; ?></td>
    <td align="center" class="style1"><img src="images/<? echo $rows; ?>.jpg" /></td>
    </tr>
    <?php
    }
    ?>
    </table>
    </td>
    </tr>
    </table>
    <div align="center"><a href="admin.php">Admin panel</a> <span class="style1">|</span> <a href="request.php">Make A Request</a></div>[/PHP]

    I tried to re arange the if/then statement, and I got myself some parse errors. Im not that good in debuggin php, as I am largely still a beginner in it. all the php tags open and close, and I dont know what else to check for. Im reading my php book. :buck: So I guess I am pulling a shorty, though he new more of what he was doing. this is all proceduraly (thank god) except for the dbconnect. because all of what I have done is procedural, this year we get too learn oop.
  • Park_7677Park_7677 Missouri Member
    edited August 2006
    Try this:
    [php]<?php
    //include connection data
    include("dbconnect.php"); ?>
    <?php
    //select the needed data form the db
    $sql="SELECT * FROM requests order by id DESC";
    $result=mysql_query($sql);
    if(mysql_num_rows($result) == 0){
    //If there are no requests, tell the visitor
    echo "<span class='style1'><b>There Are No Requests.<b></span> <a href='request.php'>Make a Request Here</a>";

    die;

    }else{
    ?>

    <link href="styles.css" rel="stylesheet" type="text/css" />

    <table align="center" width="850" border="0" cellspacing="1" cellpadding="0">
    <tr>
    <td>
    <table align="center" width="850" border="0" cellspacing="2" cellpadding="3">
    <tr>
    <td width="185" align="center" class="box_button"><div align="left">Requested From:</div></td>
    <td width="564" align="center" class="box_button"><div align="left">Short Description:</div></td>
    <td width="75" align="center" class="box_button"><div align="left">Statu:</div></td>
    </tr>
    <?php
    //Display the requests, including who submitted it, why, and its status.
    while($rows=mysql_fetch_array($result)){
    ?>
    <tr>
    <td align="center" class="style1"><? echo $rows; ?></td>
    <td align="center" class="style1"><? echo $rows; ?></td>
    <td align="center" class="style1"><img src="images/<? echo $rows; ?>.jpg" /></td>
    </tr>
    <?php
    }
    ?>
    </table>
    </td>
    </tr>
    </table>
    <?php
    }
    ?>
    <div align="center"><a href="admin.php">Admin panel</a> <span class="style1">|</span> <a href="request.php">Make A Request</a></div>[/php]
  • V-PV-P State College, PA Member
    edited August 2006
    Ok, I am trying to make a news ticker for the site in flash. I want this ticker to display the latest tech news, and I had two questions:
    1) Prime, can I link directly to SM or use your RSS feeds?
    2) If I can, how would I make flash update some dynamic text boxes according to the RSS feeds, which would include the title written in the textbox, and then automatically update the link according to SM, or whatever site I use.
  • airbornflghtairbornflght Houston, TX Icrontian
    edited August 2006
    Park_7677 wrote:
    Try this:

    my hero.

    hey, I just thought of somehting, does sql have a != operator? so instead of unioning them together, I could have just said != 2
  • V-PV-P State College, PA Member
    edited August 2006
    Thats not fair. How come he gets all his answers real quick and I have to wait a long time for an answer like "Sorry, I'd help but I don't know how." Thrax, if my changing names is bothering you, you can call me scar, or my real name vash. I'm not going to come and shoot you or anything. Well, maybe a few rounds...
  • ThraxThrax 🐌 Austin, TX Icrontian
    edited August 2006
    I don't do any interactive/dynamic programming of any kind. Languages can burn in hell.
  • edited August 2006
    Thrax wrote:
    I don't do any interactive/dynamic programming of any kind. Languages can burn in hell.
    If you've got a match, I'll bring the gas... :rarr:
  • airbornflghtairbornflght Houston, TX Icrontian
    edited August 2006
    Daxx wrote:
    If you've got a match, I'll bring the gas... :rarr:

    thats my future job your burning down there:mean:
  • airbornflghtairbornflght Houston, TX Icrontian
    edited August 2006
    Ok, I have run into a little snag.

    I have a page to edit entries, and everything works fine, except for the drop down menus.

    I have drop downs to select the date, as well as am/pm for the time. and when I want to call those values back into the edit page, as far as i know, you cant do that with drop downs.

    so this is what I figured out, and I think that there has to be an easier way.


    [PHP]<? if ( $rows == "1" ) {
    echo "selected value=\"1\""; } ?>[/PHP]

    if I do that, I would have to set both values for each one, and that seems redundant to me. I wish there was a way that I could put up in the main select tag that went like

    [PHP]<select size="10" selected value ="<? echo $rows; ?>" >[/PHP]

    that would be so much easier...
  • Park_7677Park_7677 Missouri Member
    edited August 2006
    The best way is to store everything as timestamps (number of seconds since the Unix Epoch). When you call back the time (dateposted) call a function to convert it to combo boxes. Create antoher function to convert Combos to stamp. Here is the beginning of my own function:
    [PHP]function stamp2combos ($timestamp) {

    // Check if there is a timestamp supplied. If not, use current time
    if ( $timestamp == "" ) {
    $timestamp = time();
    }

    // Start string that will be returned.
    $end_str = "";

    $month = date( "F" , $timestamp );
    $month_num = date( "n" , $timestamp );
    $day = date( "d" , $timestamp );
    $year = date( "Y" , $timestamp );

    $hour = date("g", $timestamp);
    $minute = date("i", $timestamp);
    $ampm = date("A", $timestamp);

    // MONTHS
    $end_str .= "\t<select name=\"month\" id=\"month\">\n";
    for ($i = 1; $i <= 12; $i++) {

    if ( $i == $month_num ) {
    $selected = "selected";
    } else {
    $selected = "";
    }
    $end_str .= "\t\t<option value=\"". $i ."\" ". $selected .">" . date ("F", mktime(0,0,0,$i,1,$year)) . "</option>\n";
    }

    // DAYS

    // YEAR

    // HOURS

    // MINUTES

    // AM/PM

    return $end_str;
    }
    [/PHP]See if you can finish it. It needs the "days", "years", "hours","minutes", "am/pm" sections. All follow the same structure as months, just change the details.

    You want to learn? You're gonna learn :crazy:
  • airbornflghtairbornflght Houston, TX Icrontian
    edited August 2006
    Im reading my php book trying to figure out your script. Is timestamp a built in variable?

    I have a fews ?'s though.


    [PHP]$end_str .= "\t<select name=\"month\" id=\"month\">\n";
    for ($i = 1; $i <= 12; $i++) {

    if ( $i == $month_num ) {
    $selected = "selected";
    } else {
    $selected = "";
    }
    $end_str .= "\t\t<option value=\"". $i ."\" ". $selected .">" . date ("F", mktime(0,0,0,$i,1,$year)) . "</option>\n";
    } [/PHP]

    I see that you are concatenating the lower string, but how come you put the . before the assignment operator?

    and I shouldnt have a problem with re-using the $end_str var, as it will never need to be recalled after it is used for each field, right?
  • Park_7677Park_7677 Missouri Member
    edited August 2006
    1) timestamp is not built in. you would call the function like so:
    [php]$comboHTML = stamp2combos($rows); // $comboHTML contains the HTML of the combo boxes[/php]

    2) Using ".=" appends (adds to the end) of a variable. It is the same as $endstr = $endstr . "add to end";
  • LincLinc Owner Detroit Icrontian
    edited August 2006
    V|P wrote:
    can I link directly to SM or use your RSS feeds?
    Yes, either is fine.
  • V-PV-P State College, PA Member
    edited August 2006
    Thanks Keebs. Also, we just found that the ORACLE servers don't support PHP, Perl, or any other server-side technologies. This pretty nuch rules out anything dynamic, so I was thinking, is there anyway to have Flash update likn to SM automatically according to whats in the news section without have PHP, or any other server side lang?
  • LincLinc Owner Detroit Icrontian
    edited August 2006
    If you had it parsing an RSS feed (which ActionScript/Flash can do since version 5), yes. Unfortunately, it looks like our RSS feed for the forum went kaput during the last upgrade, and there isn't currently one for the front page. In fact, without the RSS feed there's really no simple method for syndicating any of our site content without parsing the HTML output (which is ridiculous and likely to get fouled up sooner than later). Sorry :-/ I'll put that on "the list".
  • airbornflghtairbornflght Houston, TX Icrontian
    edited August 2006
    ok, so it is a simple way of saying

    $x = $x . $y

    I get it now. I went through, and I think I get it, but I think there might be a few probs, especially the am/pm selection.

    [PHP]<?
    function stamp2combos ($timestamp) {

    // Check if there is a timestamp supplied. If not, use current time
    if ( $timestamp == "" ) {
    $timestamp = time();
    }

    // Start string that will be returned.
    $end_str = "";

    $month = date( "F" , $timestamp );
    $month_num = date( "n" , $timestamp );
    $day = date( "d" , $timestamp );
    $year = date( "Y" , $timestamp );

    $hour = date("g", $timestamp);
    $minute = date("i", $timestamp);
    $ampm = date("A", $timestamp);

    // MONTHS
    $end_str .= "\t<select name=\"month\" id=\"month\">\n";
    for ($i = 1; $i <= 12; $i++) {

    if ( $i == $month_num ) {
    $selected = "selected";
    } else {
    $selected = "";
    }
    $end_str .= "\t\t<option value=\"". $i ."\" ". $selected .">" . date ("n", mktime(0,0,0,$i,1,$year)) . "</option>\n";
    }

    // DAYS

    $end_str .= "\t<select name=\"day\" id=\"day\">\n";
    for ($i = 1; $i <= 31; $i++) {

    if ( $i == $day ) {
    $selected = "selected";
    } else {
    $selected = "";
    }
    $end_str .= "\t\t<option value=\"". $i ."\" ". $selected .">" . date ("d", mktime(0,0,0,$i,1,$year)) . "</option>\n";
    }

    // YEAR

    $end_str .= "\t<select name=\"year\" id=\"year\">\n";
    for ($i = 2006; $i <= 2020; $i++) {

    if ( $i == $year ) {
    $selected = "selected";
    } else {
    $selected = "";
    }
    $end_str .= "\t\t<option value=\"". $i ."\" ". $selected .">" . date ("Y", mktime(0,0,0,$i,1,$year)) . "</option>\n";
    }

    // HOURS

    $end_str .= "\t<select name=\"hours\" id=\"hours\">\n";
    for ($i = 1; $i <= 12; $i++) {

    if ( $i == $hour ) {
    $selected = "selected";
    } else {
    $selected = "";
    }
    $end_str .= "\t\t<option value=\"". $i ."\" ". $selected .">" . date ("g", mktime(0,0,0,$i,1,$year)) . "</option>\n";
    }

    // MINUTES

    $end_str .= "\t<select name=\"minutes\" id=\"minutes\">\n";
    for ($i = 1; $i <= 60; $i++) {

    if ( $i == $minute ) {
    $selected = "selected";
    } else {
    $selected = "";
    }
    $end_str .= "\t\t<option value=\"". $i ."\" ". $selected .">" . date ("i", mktime(0,0,0,$i,1,$year)) . "</option>\n";
    }

    // AM/PM

    $end_str .= "\t<select name=\"ampm\" id=\"ampm\">\n";
    if ( $ampm == "am" ) {
    $i = "am";
    } else {
    $i = "pm";
    }

    $end_str .= "\t\t<option value=\"". $i ."\" ". $selected .">" . date ("i", mktime(0,0,0,$i,1,$year)) . "</option>\n";

    return $end_str;
    }
    ?>[/PHP]

    Keebs, if the RSS feeds get back up, would it be possible to to just grab the feeds from the news threads.
  • Park_7677Park_7677 Missouri Member
    edited August 2006
    I get it now. I went through, and I think I get it, but I think there might be a few probs, especially the am/pm selection.
    You are getting close. There are a few quirks you're going to have to work out and fix but it's very close to being right. For example, minutes go 0-59, not 1-60 ;) Stuff like that is found most of the time by using the code in example scripts. You can create a PHP file and put that code in it. Execute it by doing a simple 'echo stamp2combos(time());' Should output the current date and time.

    V|P, do you not have control of the servers? Most people think of databases when Oracle is mentioned. Do you mean the DB (which would have nothing to do with PHP/Perl/etc) or Oracle HTTP? (which does support PHP when enabled. It's based of Apache HTTP) In a competition I think it would be ignorant to only allow static content that doesn't interact or 'wow' anyone, it just sits there.
  • V-PV-P State College, PA Member
    edited August 2006
    Park_7677 wrote:
    In a competition I think it would be ignorant to only allow static content that doesn't interact or 'wow' anyone, it just sits there.
    Why can't we use PHP, Perl, or Java?
    Students around the world have vastly different access to technology and the internet. By placing the emphasis on educational content rather than sophisticated technical functionality, ThinkQuest enables students from a wide variety of backgrounds to participate and succeed in this competition. In addition, by limiting use of these technologies, we limit potential security issues that could threaten server stability and affect the competition and the ThinkQuest Library.
    So now, the only thing that will be really interactive is Flash and Javascript, and I don't know javascript. :mad2:
  • Park_7677Park_7677 Missouri Member
    edited August 2006
    I would think it would be opposite. Let people use what they know how to and really give it their all. They are handicapping everyone to a beginners level of design just because everyone doesn't use the same language? Why not make everything (in a reasonable manner) available? Web hosting companies do it. That's beyond the point, I just think it's stupid.

    Learn some JavaScript. There are enormous amounts of scripting sites dedicated to JavaScript which most are free. Get an idea of something to do and look for examples. Don't copy some one's code but take key features and make something new. I created a "MP3 DJ" application that heavily uses JavaScript to work and it's like nothing I've seen before on the web. Couldn't do it without JS.
Sign In or Register to comment.