Jump to content

music_lp90

Members
  • Posts

    227
  • Joined

  • Last visited

About music_lp90

  • Birthday 12/23/1982

Contact Methods

  • Website URL
    http://
  • ICQ
    0

Profile Information

  • Location
    US

music_lp90's Achievements

Member

Member (2/7)

1

Reputation

  1. I like where you're going with this vchris. It might be a little bit too much on the light side. I like the large V in the second image better, except the bottom of the V looks a little odd. I absolutely love the simplicity and modern/contemporary look of this. It looks more sophisticated than your previous site, which was still great by the way. I too loved the sliding tab in your about page. The previous site was more cool, while this is more classy.Is there any way you could bring back some of the techy look from your previous design into this one? The other site design in a way said "I know both the technical side and the design side" This design (to me) mostly says "I know design" The technology isn't sticking out as much to me.
  2. Do you mean in the address bar where you type the URL? I don't know If I've actually seen it in the title bar.
  3. Thanks, I changed the way I submit the data into the table and it works now. I'm not sure exactly what I was doing wrong before, but it works now and I've got the poll just about finished. I just need to learn how to add a cookie to it to check if a user has already voted, but I think I can figure that out with some tutorials I've seen about cookies.
  4. Thanks for the response. I've ended up going about doing the poll in a different way and I've got it working well, except for one problem. I created the table differently in MySQL it looks like this now:id INT[11] not null default 0 auto_increment Primary Keyname VARCHAR[100] not nullanswer INT[11] not null default 0I created the name field so that I can use the table for many different polls. In order for it to work though, I need to be able to require the query to return only the results that match the name field that I specify and the answer that I specify. I can return the query properly for the answer but it won't work for the name field for some reason.here's the php that I'm returning the results with: <?php$con = mysql_connect("myHost","myDB","Password");if (!$con) { die('Could not connect: ' . mysql_error()); }mysql_select_db("myDB", $con);$yes = mysql_query("SELECT * FROM answers WHERE answer = 1 AND name = 'testing'");$no = mysql_query("SELECT * FROM answers WHERE answer = 2 AND name = 'testing'");$unsure = mysql_query("SELECT * FROM answers WHERE answer = 3 AND name = 'testing'");$row1 = mysql_num_rows($yes);$row2 = mysql_num_rows($no);$row3 = mysql_num_rows($unsure);$row1_percent = $row1/($row1 + $row2 + $row3) * 100;$row2_percent = $row2/($row1 + $row2 + $row3) * 100;$row3_percent = $row3/($row1 + $row2 + $row3) * 100;echo "People who said yes" . " " . number_format($row1_percent, 2) . "%";echo "<br />";echo "People who said no" . " " . number_format($row2_percent, 2) . "%";echo "<br />";echo "People who were unsure" . " " . number_format($row3_percent, 2) . "%";echo "<br />";echo "Total votes: " . ($row1 + $row2 + $row3);?> Like I said, it works when I remove the AND name = 'testing', but then I can't use the same table for multiple polls. Thanks for any help. Also, let me know if you need to see the code for the form or the php that inserts the form data into MySQL.
  5. Hi, I'm teaching myself php and mysql and I'm trying to make a simple poll, very basic. Here's what I've done so far:HTML form:<body><form method="post" action="update_poll.php"><input type="radio" name="answer_yes" value="1">yes</input><br /><input type="radio" name="answer_no" value="1">no</input><br /><input type="radio" name="answer_unsure" value="1">unsure</input><br /><input type="submit" value="submit"></form></body>php that inserts into MySQL:<?php//connect to database$con = mysql_connect("#####","#####","#######"); if (!$con) { die('Could not connect: ' . mysql_error()); }mysql_select_db("#####", $con);$sql="INSERT INTO poll (yes, no, unsure)VALUES('$_POST[answer_yes]','$_POST[answer_no]','$_POST[answer_unsure]')";if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); }echo 'Poll submitted'?>php to display results:<?php $con = mysql_connect("######","#####","######"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("#####", $con); $yes = mysql_query("SELECT sum('yes') FROM `poll`"); while($sum_yes = mysql_fetch_assoc($yes)) { echo $sum_yes; }mysql_close($con);?>my table is set as follows:yes INT default 0no INT default 0unsure INT default 0id INT default 0 auto_increment primary indexWhat works: The form submits data properly into my tableWhat doesn't work: I cannot figure out how to grab the numbers from the database to use in calculations to determine percents. I realize I have not included any calculations for determining poll percentages, that is because I am first trying to figure out how to assign the sum of each answer to a variable. With what I currently have, it displays "array" in the browser as the result.My other problem is that I am not sure how to make the radio buttons only allow users to select one option. Right now, since they are named differently users can select all three if they want, but if I make them all have the same name, then I don't know how I can get the answers from them.Sorry this is kind of long, any help would be greatly appreciated, thanks!
  6. Thankyou for the help with the date/time issue. I've got it working now. I couldn't get the timestamp to work for some reason and I don't think I figured out exactly how to do the date how you were saying you did it, but what I did was use $var = date("y/m/d") and inserted it into a VARCHAR column in the table and it works well enough for what I need now.
  7. Hey, thanks for the suggestion of using two tables. For what I'm using it for right now, its not something that would really be necessary, but I can definitely see using it in other cases and I probably will. I've come up with another question though. I'm trying to insert the date and time the message was submitted into the database. I created a new field in the mySQL table and made it's type set to timestamp and set it's attributes to ON UPDATE CURRENT_TIMESTAMP and set the default to 0000-00-00 00:00:00.here's the php that I have.<?php$con = mysql_connect("myHost","myUsername","myPassword");if (!$con) { die('Could not connect: ' . mysql_error()); }mysql_select_db("databaseName", $con);$sql="INSERT INTO request (FirstName, LastName, request)VALUES('$_POST[firstname]','$_POST[lastname]','$_POST[request]')";if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); }$to = "myEmail";$subject = $_POST[firstname].$_POST[lastname]."Request";$msg = $_POST[request];mail("$to", "$subject", "$msg");echo "Thankyou, your request has been added";mysql_close($con)?>I've been searching the web for how to enter the time here in the php, but so far I haven't had any luck. Thanks for any help!
  8. It works now. The tutorial was very helpful. Thanks.
  9. Thanks, it works now. I didn't really understand what the primary key was when I created the table in the database. I created a new column, called it id, and set it to auto_increment and it works now. Thanks for the help, both of you, I really appreciate it!
  10. Hi, I'm new to php and mySQL, but I've just learned how to create a form in html that links to a php page that sends the form data into a table in mySQL. The problem I'm having is that if someone tries to enter a message more than once, it won't let them because it won't allow duplicate names. How can I fix this?The table I created has the fields firstname VARCHAR(30)lastname VARCHAR(30)request LONGTEXTThis is the html<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd"><html><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><title>Untitled Document</title></head><body bgcolor="#ffffff"><form action="insert.php" method="post">Firstname: <input type="text" name="firstname" />Lastname: <input type="text" name="lastname" /><br><br>Request: <textarea name="request" cols="100" rows="10"></textarea><br><input type="submit" /></form></body></html>and this is the php that inserts the request into the mySQL<?php$con = mysql_connect("myHost","myUsername","myPasword");if (!$con) { die('Could not connect: ' . mysql_error()); }mysql_select_db("myDb", $con);$sql="INSERT INTO request (FirstName, LastName, request)VALUES('$_POST[firstname]','$_POST[lastname]','$_POST[request]')";if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); }echo "request added";mysql_close($con)?>Thanks, any help is greatly appreciated.
  11. Thanks, I'm sorry if I posted in the wrong forum. I'm fairly new to coding and I wasn't certain whether to post it in the php forum since I wasn't certain if php was the best way to go or if there was some other web standard that people used for submitting messages.
  12. Hi,I'm creating a website for a Church and they would like to be able to allow people to submit prayer requests. One oviously easy way is to use e-mail, but I would like to use a form instead if its not too difficult. I've made forms before in HTML, but they sent the information using e-mail, which I don't really like because a lot of people don't have outlook set up for their e-mail accounts and it usually tries to send the message using outlook. I've just begun learning php. From what I understand, I can create a form in html and link it to a php page that takes the data they entered by using the php $_POST variables and sends it into a mySQL database. I think I understand how to get this far, but I've never used mySQL, so I don't understand how to retrieve the requests that have been submitted. Can someone first tell me if using php and mySQL is a sensible way to create the submit a prayer request feature and second can you tell me how someone can retrieve the requests that have been submitted? It would be nice to be able to retrieve requests according to the date they were submitted.Thanks, I don't want to make it too difficult for those working on maintainging the site to check the requests, but I do want to make it as easy for people to submit requests as possible. If there is a different direction I should go to do this, please let me know.
  13. Thanks for the answers. The site is for my school and its hard to find people there that really know code. So this forum is great. There's actually someone that will be continuing the project next semester, and they are going to be creating a content management system, I believe. So, maybe this is something I should let him deal with and in the mean time the people updating the site can just deal with the extra work.
  14. Hi everyone, I'm fairly new to coding. I know html well and I know a fair amount of css and some javascript. I'm creating a newspaper site and I'm trying to make as little work as possible for those that update the site. My question is: I have a column on the right side of the page that displays when someone is reading an article. In that column will be blurbs from other articles that are in the same section. For instance, if they are reading an entertainment article, the column will show blurbs of the other entertainment articles. These blurbs will be the exact same blurbs that are displayed on the main entertainment page or whatever section they are in. How can I scrape (if that’s the right term) or copy automatically those blurbs that already exist and insert them into the column automatically in order to make less work for those updating the site? I’m not looking for someone to necessarily give me the exact script or whatever, but can you point me in the direction of what type of coding could do this, maybe php or is there javascript that will do this? Maybe RSS, I don’t know. Any help in pointing in the right direction would be greatly appreciated. Thanks!
×
×
  • Create New...