Jump to content

ngreenwood6

Members
  • Posts

    1,356
  • Joined

  • Last visited

Everything posted by ngreenwood6

  1. When I do my mysql query it looks like this: "SELECT AVG(rating) from 'rate_picture'" but it returns nothing. When i take out the ' around rate_picture it says resource id #5. Any help.
  2. No prob. Glad to help out.
  3. Well how would I do it in mysql.
  4. Could you elaborate a bit more. I am trying to do it in php not through the mysql which is how it shows you. If anyone has a better method please let me know. Thanks
  5. You would have to set the action to another page maybe search.php. Your search.php would look something like this <?php $host = "mysqlhost"; $user = "user"; $pass = "pass"; $db = "db"; $table = "table" $search = $_POST['search']; $connect = mysql_connect($host, $user, $pass); mysql_select_db($db); $query = "SELECT * from $table WHERE search"; //You would want to put in your specific search here! if(!$search) { echo "Please enter a search"; } else { $result = mysql_query($query); } while($row = mysql_fetch_array($result)) { extract($row) echo $row['data']; //you would change data to the data that you want displayed. } ?> This is kind of a rough draft but you should get the point and can modify for your needs.
  6. I have a question that will help me solve alot of my problems. I have a table in my database that stores numbers (ratings for pictures). I want to be able to get the average of these numbers. For example if there is 5 ratings in the database and the numbers are all 5 the average would be 5. I know that I can divide the numbers by mysql_num_rows but I do not know how to add the numbers in the database individually. I can display them on a page but am lost when it comes to adding them. Any help is appreciated. Thanks
  7. I am trying to create just a plain main page. I am having some problems though. I am having a problem where the page does not start at the top of the screen (about a 1 inch gap from the top to the start of my page). Another issue that I am having is where the side bar comes in it is about 1/4 of an inch off from the left side. The last issue that I have noticed so far is that the the right bar is about 6 inches off from the right side. I am new to html so please take it easy on me. Any help is appreciated. <table width=100% border="0" cellpadding="0" cellspacing="0"> <tr> <td height="52" style="background:#990000">This is Great</td> </tr> <tr> <td height="39" style="background:#FF3399">Buttons Would Go Here</td> </tr> <tr> <td> <table> <td width="123" style="background:#0000FF">This is the sidebar! <br /> <br /> This is where the links would be! <br /> <br /> </td> <td width="749"><center> <p>The main content for your site would go here!</p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> </center></td> <td width="94" style="background:#FFFF00; color:#FFFFFF; margin-right:0px;">The additional info for your site would go here!</td> </table> </td> </tr> <tr> <td style="background:#000000; color:#FFFFFF;"><center>This would be the footer!</center></td> </tr> </table> Thanks
  8. Cool i've got it now.
  9. It will display it if I do it like that, but I am trying to get it so that it will display it when I do it with the $myusername. Anyone know how to accomplish this?
  10. I am in need of some help with sessions. I have 3 files: index.php (the form): <table border="1"> <form name="session" method="post" action="session.php"> <tr> <td>Username <td>: <td><input name="username" type="text"> </tr> <tr> <td>Email <td>: <td><input name="email" type="text"> </tr> <tr> <td> <td> <td><input name="submit" type="submit" value="submit"> </form> </table> sessions.php (registering the session variable): <?php session_start(); $myusername = $_POST['username']; $_SESSION['username'] = $myusername; $_SESSION['email'] = $_POST['email']; echo "Go to <a href='test.php'>Test</a>"; ?> test.php (showing the variable): <?php session_start(); echo $myusername; ?> Whenever I submit the form it goes to the sessions page. Then i go to the test page where it should display the username that was submitted but it isn't showing anything. I am trying to get it so that I can set variables (ex. $myusername) in the page so that it is easier to call at another time. If anyone can tell me why this isnt showing the username that would be great.
  11. Thanks for the response. That worked out perfectly, sometimes you just miss the little things lol.
  12. I am trying to make a 4 columns named "username, firstname, lastname, and email". Under these columns I want it to list all of the users in the database. I have come up with this: <table> <tr> <td>Username: <td>First Name: </tr> <? while ($info = mysqli_fetch_array($result)) { ?> <tr> <td><? echo $info['username']; ?> <td><? echo $info['firstname']; ?> </tr> </table> <? } ?> However, this displays the first entry correct, but the entries below that display on the same line. Any help is appreciated.
  13. Thanks for the reply. Its helpful to know the terms. Got some good stuff googling.
  14. I am trying to create some errors for for forms that will be submitted. I need to find out how to make sure the errors are what I want them to be. If someone can provide me with some errors or the way to format the errors it would be very helpful, even a guide or something would be great. I am trying to create errrors for email, phone, etc. Example-this one is for email (!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $Email)) I don't quite understand how to make that do what i want to do. If someone can explain that would be great. thanks in advance
  15. Can anyone help me out with this it would be very helpful for future coding?
  16. crayon violent thanks for the example. However, i am trying to allow the user to update their profile. the problem that I am running into is that I can check the database for the email, but if the user decides to keep it the same it gives them the error that email is already there. I want it to not check the database if they keep it the same. How would i go about doing that?
  17. I have a statement that i am trying to figure out how to write out. I want it to check that the username isn't in the database ($username > 0) and that it isnt the same as it is now (!= $oldusername) . This is what I have come up with. if ($username > 0 && $username != $oldusername) { do this } Is that correct because it is not going past that point if the username is the same.
  18. yes the variables contain values. I just put down some sample code that is not actually my code I am just trying to figure out how to correctly put an if statement inside of an if statement.
  19. I need some help with an if statement that I am trying to get accomplished. It's kind of confusing but bare with me here. I basically need an if statement inside of an if statement. It just keeps taking me to a blank screen. if($session_username != $new_username)//session username is from their session and new username comes from a form { if ($username_from_db > 0) //if the username is in the database { echo "do this"; } else { echo "do the rest of the first if statement"; } } else { process form } Any help is appreciated.
  20. Thanks for the help!
  21. I am trying to echo something but I want it to be in color. any help is appreciated. Also change the font size if you can.
  22. You should code it to be something like this also: $refemail1 = $_POST['refemail1']; $refemail2 = $_POST['refemail2']; $refemail3 = $_POST['refemail3']; $refemail4 = $_POST['refemail4']; $refemail5 = $_POST['refemail5']; $to = ("'$refemail1', '$refemail2', '$refemail3', '$refemail4', '$refemail5'") Looks alot cleaner.
  23. First thing I can see is that the code should look like this: $to=("".$_POST['refemail1'].",".$_POST['refemail2'].",".$_POST['refemail3'].",".$_POST['refemail4'].",".$_POST['refemail5'].","); You were missing the (').
  24. Thanks for the reply. I got it working with your suggestion.
  25. Are you on your local machine? If so I would check out wamp or xxamp. Comes with php, apache, mysql, and phpmyadmin already embedded into.
×
×
  • 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.