Jump to content

Twister1004

Members
  • Posts

    201
  • Joined

  • Last visited

Everything posted by Twister1004

  1. I posted everything relivent to all the PHP stuff. Thats everything. The reast of the index is completely unnessarry. and thats all in the community.php.
  2. Thats what I said too. Could it be in the while code? I have no idea why it would be doing it twice. Unless I was echoing twice. Which I'm not. Any other ideas?
  3. Hi everyone. I'm just having a little bit of trouble, confusion, and.... you can guess. Objective: For this site, I'm trying to do this for a FBLA group at my school. (FBLA is a club) and I'm trying to make it like a "forum" in a way. This is just so they can post and reply to topics that are made. Problem: When I'm joining tables (I doubt I did them right) I'm echoing it out through an array. However it is posting it twice, rather than just once. What Can I do? community.php <body> <?php $jointable = mysql_query("SELECT post.topic_id, topic.topic_id, post.date, post.name, post.content, topic.topic_name FROM `post` INNER JOIN `topic` ON post.topic_id=topic.topic_id") or die("Error 70. Please contact Mrs.Dochety." . mysql_error()); //$thread = mysql_query("SELECT `topic_id`, `topic_name` FROM `topic` WHERE `topic_id` = '$topic'"); //$post = mysql_query("SELECT `topic_id`, `name`, `date`, `content` FROM `post` WHERE `topic_id` = '$thread'"); ?> <div class = "body"> <div class = "post"> <?php while($getinfo = mysql_fetch_array($jointable)){ echo $getinfo[3] . " Posted on " . $getinfo[2] . "<br/><br/>"; } ?> </div> </div> </body> index.php section <div id = "questions"> <center>Threads created</center><hr/> <?php $sqlthread = mysql_query("SELECT * FROM `topic` ORDER BY `topic_id` DESC LIMIT 7"); while($getthread = mysql_fetch_array($sqlthread)){ echo $getthread[3]; echo "<a href='./community.php?topicid=$getthread[0]&topic=$getthread[1]'>"; echo $getthread[1]; echo "</a>"; echo " - by " . $getthread[2]; echo "<br/>"; } ?> </div> view the site at: http://twistablepie.servegame.com/fbla/ any hints, tips, reading, posting, etc. is appreciated.
  4. Or you could do this, ./mypage.php It works all the time =) (Not two dots, but one)
  5. Ill look through it, and post random comment signs. Honestly, there wasnt much to fix. the only thing i fixed was the while loop. <?php if(mysql_num_rows($result) > 0){ ?> <!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" /> <link rel="stylesheet" href="dropdown2.css" type="text/css" /> <script type="text/javascript" src="dropdown.js"> </script> <script type="text/javascript" src="calendar.js"> </script> <script type="text/javascript" src="enablefield.js"> </script> <script type="text/javascript"> function greyText(one_way, return_date) { if (document.form1[one_way].checked) { document.form1[return_date].disabled=true; document.form1[return_flight].disabled=true; } else { document.form1[return_date].disabled=false; document.form1[return_flight].disabled=false; } } <title>Webair Contact Us</title> <link rel="StyleSheet" href="./mainstyle.css"type="text/css" media="screen"> </script> </head> <body> <div id="wrapper"> <table> <tr> <td> <img src="Webair--logo.gif" height= "65" width="240" align="top" /> </td> <td background="Banner--background.gif" height="60" align="right" width="817" > <a class="hyperlink" href="http://www.cems.uwe.ac.uk/~wbennett/webair/main_logon.php"> <b> Staff login </b> </a> | <a class="hyperlink" href="http://www.cems.uwe.ac.uk/~wbennett/webair/index.html" > <b> Home </b> </a> | <a class="hyperlink" href="http://www.cems.uwe.ac.uk/~wbennett/webair/index.html" > <b> Booked Flights &nbsp </b> </a> </td> </tr> </table> <dl class="dropdown" > <dt id="one-ddheader" onmouseover="ddMenu('one',1)" onmouseout="ddMenu('one',-1)" > Home </dt> <dd id="one-ddcontent" onmouseover="cancelHide('one')" onmouseout="ddMenu('one',-1)" > <ul> <li> <a href="http://www.cems.uwe.ac.uk/~wbennett/webair/index.html" class="underline" > Home </a> </li> </ul> </dd> </dl> <dl class="dropdown" > <dt id="two-ddheader" onmouseover="ddMenu('two',1)" onmouseout="ddMenu('two',-1)" > Contact us </dt> <dd id="two-ddcontent" onmouseover="cancelHide('two')" onmouseout="ddMenu('two',-1)" > <ul> <li> <a href="http://www.cems.uwe.ac.uk/~wbennett/webair/webair_contact" class="underline" > Contact us </a> </li> </ul> </dd> </dl> <dl class="dropdown" > <dt id="three-ddheader" onmouseover="ddMenu('three',1)" onmouseout="ddMenu('three',-1)" > Flights </dt> <dd id="three-ddcontent" onmouseover="cancelHide('three')" onmouseout="ddMenu('three',-1)" > <ul> <li> <a href="http://www.cems.uwe.ac.uk/~wbennett/webair/webair_refunds.html" class="underline" > Refund Policy </a> </li> </ul> </dd> </dl> <dl class="dropdown" > <dt id="four-ddheader" onmouseover="ddMenu('four',1)" onmouseout="ddMenu('four',-1)" > Travel Information </dt> <dd id="four-ddcontent" onmouseover="cancelHide('four')" onmouseout="ddMenu('four',-1)" > <ul> <li> <a href="http://www.cems.uwe.ac.uk/~wbennett/webair/webair_flight_fares.html" class="underline" > Flight Timetable </a> </li> <li> <a href="http://www.cems.uwe.ac.uk/~wbennett/webair/webair_baggage.html" class="underline" > Baggage Information </a> </li> <li> <a href="http://www.cems.uwe.ac.uk/~wbennett/webair/webair_airport_info.html" class="underline" > Airport information </a> </li> <li> <a href="http://www.cems.uwe.ac.uk/~wbennett/webair/webair_travel_info.html" class="underline" > Travel documentation requirements </a> </li> </ul> </dd> </dl> <dl class="dropdown" > <dt id="five-ddheader" onmouseover="ddMenu('five',1)" onmouseout="ddMenu('five',-1)" > About Webair </dt> <dd id="five-ddcontent" onmouseover="cancelHide('five')" onmouseout="ddMenu('five',-1)" > <ul> <li> <a href="http://www.cems.uwe.ac.uk/~wbennett/webair/webair_about.html" class="underline" > About Webair </a> </li> <li> <a href="http://www.cems.uwe.ac.uk/~wbennett/webair/webair_contact.html" class="underline" > Contact us </a> </li> </ul> </dd> </dl> <div style="clear:both" /> </div> <div id="content" > <div class="inner" > <table border="1"> <?php while($row = mysql_fetch_array($result)){ echo "<tr>"; echo "<td>"; echo ".$row['flight_num']."; echo "</td>"; echo "</tr>"; } ?> </table> </div> </div> <div id="footer"> <div id="inner"> <div id="footer2"> <p><hr class="line"></hr> <a class="hyperlink2" href="http://www.cems.uwe.ac.uk/~wbennett/webair/main_logon.php"><b>Staff login</b></a> | <a class="hyperlink2" href="http://www.cems.uwe.ac.uk/~wbennett/webair/index.html"><b>Home</b></a> | <a class="hyperlink2" href="http://www.cems.uwe.ac.uk/~wbennett/webair/webair_contact.html"><b>Contact us</b></a> | <a class="hyperlink2" href="http://www.cems.uwe.ac.uk/~wbennett/webair/webair_about.html"><b>About Webair</b></a> <hr class="line2"></hr> </p> </div> </div> </div> <?php } else{ echo 'Sorry, couldn\'t find any flights'; } mysql_free_result($result); ?> </body> </html>
  6. I have to also play around with the quotes for this to happen. But think of it this way. " " - double quotes should always start a Echo.then anywhere in the echo with double quotes you can use single quotes. while($row = mysql_fetch_array($result)){ echo '<table border="1">'; echo '<tr>'; echo '<td>'; echo "'$row['flight_num']'"; //changed this row. Look at it. echo '</td>'; echo '</tr>'; echo '</table>'; //Also you forgot the ending } sign. }
  7. NEVER MIND! I just realized you made a variable inside the while statement O_o. Didn't know that was possible. Edit2: Is there any way where I can make it into a table when it gets it out of the database? Also thank you dclamp.
  8. Hey, another crises im facing. Objective: I have about 61 songs in my database and I want it to come out in the form of a TABLE. However, I keep getting massive errors, and I don't understand how to fix it. It could be because im not experienced enough and never delt with it. Error: Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in C:\Documents and Settings\Compaq_Owner\Desktop\Server Files\XAMPP\xampp\htdocs\songs.php on line 38 It also just keeps on going on and on acting like the Loop will never end. code: $sel = 'SELECT DISTINCT `id`, `song`, `artist` FROM `music`'; $sel2 = mysql_query($sel) or die("WTH! " . mysql_error()); $get = mysql_fetch_row($sel2); while (mysql_num_rows($get) <= 61){ ++$get; echo "<table><tr><td>" . $get[0] . "</td><td> " . $get[1] . "</td><td> " . $get[2] . "</td></tr></table>"; } Any hints tips posts (You know the drill) Thanks =D
  9. To be starting your own script and post it here so we can then help you.
  10. Thank you very much. It helped me. I've seen the (int) But, I've never seen it used before. That will actually come in handy now. =). although, I'm getting a notice, it wont matter since it forces it anyways XP. Thank you very much!
  11. Hey, I'm having a bit of a problem. I'm trying to get a check box to work 2 ways. When the user registers, I'm trying to get the checkbox to work as a DEFAULT as 0 or if it is checked, it will be set to 1. Objective: Check box is not working correctly. I want it to equal 0 if its not checked, but I want it to set to 1 when its checked. Issue: It doesn't want to set to the default (which in the database is set to 0 for the default). It either works as "1" or it just says it can't work. <?php session_start(); error_reporting(E_ALL); include("config.php"); ?> <html> <head> <title>FBLA | Allumni Registration</title> <link href="style.css" rel="stylesheet" type="text/css" /> <style> body{ background:#fdd017; background-image:url("images/test2.png"); background-repeat:repeat-x; color:#FFFFFF; } .body{ position:absolute; top:24px; left:39px; width:900px; height:700px; border: solid #FFFFFF; } #box{ text-align:right; } </style> </head> <body> <div class="body"> <table> <form method="POST" action=""> <tr><td> Name: </td><td> <input type="text" name="name" maxlength="30" /></td></tr> <tr><td> Password:</td><td> <input type="password" name="pass" maxlength="25" /> </td></tr> <tr><td> Verify Password: </td><td> <input type="password" name="pass2" maxlength="25" /> <tr><td> Age: </td><td> <input type="text" name="age" maxlength="2" /></td></tr> <tr><td> E-mail: </td><td> <input type="text" name="email" maxlength="35" /><td></tr> <tr><td> Verify E-mail: </td><td> <input type="text" name="vemail" maxlength="35" /></td></tr> <tr><td> Sex: </td><td> <input type="radio" name="sex" value="Male" />Male <input type="radio" name="sex" value="Female" />Female</td></tr> <tr><td> Year Graduated: </td><td> <input type="text" name="date" maxlength="4" /></td></tr> <tr><td id="box"><input type="checkbox" name="activities" /></td><td> Yes, I would like updates on future FBLA activities.</td></tr> <tr><td> <input type=submit name=submit value="Register" /> </td></tr> </form> <?php if(isset($_POST['submit'])){ $name = mysql_real_escape_string($_POST['name']); $pass = mysql_real_escape_string($_POST['pass']); $pass2 = mysql_real_escape_string($_POST['pass2']); $password = hash('sha512' , $pass); $age = mysql_real_escape_string($_POST['age']); $sex = $_POST['sex']; $email = mysql_real_escape_string($_POST['email']); $email2 = mysql_real_escape_string($_POST['vemail']); $date = mysql_real_escape_string($_POST['date']); $activities = $_POST['activities']; $ip = $_SERVER['REMOTE_ADDR']; // users ip is stored in the variable ip /*$sel = 'SELECT * FROM `allumni` WHERE `name`="' . $_POST['name'] . '"'; $result = mysql_query($sel) or die(mysql_error()); $data = mysql_fetch_assoc($result); if(mysql_num_rows($result) >0){ echo "The username currently exists. Please select another username."; exit(); }*/ if($name == ""){ echo "You did not enter a username. Please re-enter your username."; exit(); } elseif($password == ""){ echo "You did not enter a password. Please re-enter your password."; exit(); } elseif($pass != $pass2){ echo "Your passwords do not match! Please check your passwords."; exit(); } elseif($age == ""){ echo "You did not enter your age. Please re-enter your age."; exit(); } elseif($email == ""){ echo "You did not enter your E-mail. Please re-enter your E-mail."; exit(); } elseif($email2 != $email){ echo "Your E-mails do not match. Please check your E-mails."; exit(); } elseif($date == ""){ echo "You did not enter your graduation year. Please re-enter your graduation year."; exit(); } elseif($sex == ""){ echo "You need to enter your gender."; exit(); } else{ $sql = ('INSERT INTO `allumni` (name, password_sha512, age, sex, email, date_registered, year_grad, get_updates, ip) VALUES '. '("'.$name.'", "'.$password.'", "'.$age.'", "'.$sex.'", "'.$email.'", NOW(), "'.$date.'", "'.$activities.'", "'.$ip.'" )'); $result = mysql_query($sql); if($result){ echo "Your account was created successfully!"; } else{ echo "Your account was NOT created due to an error. Please report this to the Mrs. Dochety or Mr. King " . mysql_error(); } } } ?> </table> </div> </body> </html> Any help, hints, tips, reading, posting, etc would be helpful! Thanks =)
  12. Well, I dont see where "Admin" is declared. Just from my perspective, I would make a new row in your "account" table and name it with admins, and use an SQL statement there.
  13. That code you posted did not alter anything.
  14. I don't know if its legal in SQL, but I was trying to make a point
  15. Lol, I kinda forgot to move the link X_X, my bad. http://abysmalwow.servebbs.org/wow/testing.php
  16. Yes the picture showed up, it just didn't expand though the whole browser.
  17. Well, lets say I have a database called, "game" and a table called "monsters". The table will probably look like this, name| Health | damage | | | ------------------------ nin1| 50 | 3 | nin2| 600 | 10 | nin3| 2400 | 20 | nin4| 7500 | 26 | nin5| 21500 | 32 | nin6|100000 | 50 | Now look at that. 50 damage!? We need to change that. So an UPDATE query would be necessary. //Change the value from 50 to 42 //define the table UPDATE `game` (Tablename) //now SET the value SET `damage` = '42' //Where at? WHERE `name` = 'nin6' There you go There is an update for you =).
  18. Try and create a simple login script and we'll help guide you from there. You dont need a "sesson" page. You can type it in on the top of every page BEFORE anything. <?php session_start(); ?> Try to do your own login script and we'll help you from there =).
  19. Well, Honestly I don't know what I just did, because I didn't really do anything, and it just.... worked O_o.creepy, if you ask me.
  20. Well, apparently the table doesn't exist.... lol. I have no idea why it wouldent if the above table worked xD. Exact error code: Table 'lamyth2.1amyth_account' doesn't exist And ideas?
  21. From what I think, you should be able to do this. However it will be easier if you just made a person select the country then link it to the same page, only in this case another drop down menu where it will have all the cities.
  22. Hey everyone! I've been having a little trouble with this script, however I don't see why. I've ran tests but I've not received an error. It also doesn't want to work. Objective: Figure out why this Query wont work. Problem: $loginchange = mysql_query("UPDATE `1amyth_account` SET `loggedin` = '1' WHERE `username` = '$username'"); You can see I'm trying to UPDATE the table "loggedin" to 1 from 0 showing the account is logged in and can be tracked. Then I'm going to, later, turn it back to 0 when they log out. Whole Code <?php error_reporting(E_ALL); include("inc/config2.php"); if (isset($_POST['username'])) { $username = mysql_real_escape_string(trim($_POST['username'])); $password = mysql_real_escape_string(trim($_POST['password'])); /*-------------------------------Attempt to Login--------------------------------------------*/ $sql = mysql_query("SELECT * FROM `lamyth_account` WHERE `username` = '$username' AND `password` = '$password' LIMIT 1") or die("Contact the Admin with this id / code " . mysql_error()); if (mysql_num_rows($sql) == 0) die("Invalid Username or Password. <br/>Please go back and re-enter your information."); while ($data = mysql_fetch_assoc($sql)) { if (!isset($_SESSION['login_id'])) { $_SESSION['login_id'] = $data['accountid']; $_SESSION['login_user'] = $data['username']; $_SESSION['login_pass'] = $data['password']; $lastlogin = mysql_query("UPDATE `lamyth_account` SET `last_login`= NOW() WHERE `username` = '$username'"); $loginchange = mysql_query("UPDATE `1amyth_account` SET `loggedin` = '1' WHERE `username` = '$username'"); } else break; } } @$user = $_SESSION['login_id']; if (isset($_SESSION['login_user'])){ ?> <div style=""> <?php echo "Welcome, {$_SESSION['login_user']}.";?> <br/> <div id="logout_in"> <img src="images/logout.png" onClick="parent.window.location = './logout.php'" /> </div> </div> <?php } else{ ?> <form method="POST" action=""> <table> <tr> <td>Username:</td><td><input type="text" name="username" id="username" maxlength="20" size="10" /></td></tr> <tr><td>Password:</td><td><input type="password" name="password" id="password" maxlength="20" size="10" /></td></tr> </table> <div id="logout_in"> <input type="image" src="images/loginchange.png" name="submit" /> <?php } ?> </div> </form> Any hints, tips, posts, reading, etc helps. Thanks =).
  23. Hey everyone! I'm just facing difficulties. How do I get a picture say about a 600*400 picture on a website to just expand to the WHOLE web browser? Its kinda difficult to explain what I want xD. If you wanna see what i'm talking about go here, http://twistablepie.servegame.com/wow/ And help, hints, tips, or etc, is very appreciated.
×
×
  • 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.