Jump to content

mjcoco

Members
  • Posts

    26
  • Joined

  • Last visited

    Never

Everything posted by mjcoco

  1. Another question. Say i am at http://www.example.com/view.php?id=1&dept=2&cat_id=5 And i wanted to make it to where i can co back from what has been selected and take out &dept=2 making it = http://www.example.com/view.php?id=1&cat_id=5 Is there a query that i can go about doing that or do i just have to rebuild the entire url?
  2. Exactly what i was looking for. THANKS!!! I guess i just wasnt thinking, i tried just adding &cat_id= $cid and it was messing up the url... but that works great.
  3. Maybe alittle more code? Make sure your table name is correct, as in case.
  4. I know this isnt the best question or anything but basically i need help with passing a second variable. As in www.example.com?id=32 and seperately have it to where it displays a new list of links and when they click on that it will add in &cat_id=14 etc Basically its like narrowing a search click the first link that narrows it down with the id's=32 then then on the next page it will have new links to narrow it down even further. I have it to where it does the first, but im not sure how to do the latter (&cat_id=14) Thanks
  5. Ok so i added SELECT DISTINCT h.File and it got rid of the odd error, sorry for all the reply's was too long before i could use the modify.
  6. Forgot to mention the output comes out odd also... out put example outone outone outtwo outtwo
  7. I never really learned how to properly join tables, i did find a way to hack together some sql for it to work together anyway. Here is what i have. $q = "SELECT * FROM Homework h, University s, department d, course c, professors p where h.Universe = s.id AND h.Depart = d.dept_id AND h.Cour = c.course_id AND h.Prof = p.prof_id"; Which will produce the correct information needed however when i run $result = mysql_query($q,$conn); while ($a = mysql_fetch_array($result)) It runs twice. My main question is the first code... I know i should use a join however im not sure exactly how it goes. Something like this? ??? SELECT * FROM Homework INNER JOIN University WHERE Univers=id INNER JOIN department WHERE Depart = depat_id Second could my while statement be running twice because i dont have properly joined tables? Or is there an error in the query itself? Thanks,
  8. Im alittle confused. In the form, does the user determine how many records will be formed. If so why not get the value they input from the textfield and create a loop? If the user chooses 6 entries, is it going to be the same data for all six data entries?
  9. try taking out the quotes from echo "$my_order_id", i think it should just be echo $my_order_id; also if your method is post use <?php $my_order_id= $_POST['order_id']; $my_note = $_POST['order_note']; echo $my_order_id; echo $my_note; ?>
  10. <tr> <td width="78">Username</td> <td width="6">:</td> <td width="294"><input name="login" type="text" id="login"></td> </tr> <tr> <td>Password</td> <td>:</td> <td><input name="password" type="text" id="password"></td> </tr> <tr> <td width="5%" > <input type="submit" name="login" value="login"></td> <td width="5%" > <input type="button" value="register" onclick="window.location.href='registrationbackup.php';"></td> </tr> first maybe change the login for each name, textfield and submit. Since you have login for the input for text and for the submit. second im not sure that onclick="window.location.href='registrationbackup.php';" is necessary, you can probably just use onclick="registrationbackup.php" Also try print 'alert($myusername);'; see what it gives you, if its giving you what you typed and whats in your database, its you query
  11. Ok, i figured it out. While i was calling the ajax function it was named wrong. Fixed it it worked perfect. Thought i checked it last night, oh well.
  12. Sorry this post might need to be in PHP rather than in mysql. :-\
  13. Im passing about 5 variables though post. Its sloppy, but im just trying to get it to work before i go back and make it run smooth. Anyway here is some code im having problems with.. Not sure if i need to post more of the code, but here is where, i believe the problem lies... <form id = "myform" enctype="multipart/form-data" action="upload_file.php" method="POST"> <table width="527" height="110" border="0" align="left" cellpadding="0" cellspacing="0"> <tr><td width="172" height="32">University:</td> <td width="262"><select name="Univers" onChange="getDepart(this.value)"> <?php displayUniversity();?> </select></td> </tr> <tr><td width="172" height="32">Department:</td> <td width="262"><div id="departdiv"><select name="Department" id="Department"> <option>Select University First</option> </select></div> </td> </tr> My sql statement $de = $_POST['Department']; $q = "select * from department WHERE dept_id = $de"; $result = mysql_query($q,$conn); $a = mysql_fetch_array($result); Getting the Warning Which of course means that it is not getting a result in the fetch. I understand that. Here is my problem. I am passing 3 other variables which all execute perfect. This one on the otherhand is not. I cant figure out what the problem is or where it is at. The Univers _POST works great. However when i try it with the Department it does not run. Its partial code. I have it running with ajax (along with the other 2 variables that work fine) which populates the Department dropdown box. Any insight would be helpful.
  14. while($row=mysql_fetch_array($result)) { $rand="{$row['random1']}"; } This is an example of a scope. if you put a variable inside a while loop for example it will only stay there.
  15. I was reciving this error before. It has to do with the way you are accessing your database from the site. Like Xurion said it deoends on the provider some you can just type in the table name some you have to do domain_table name etc.
  16. The easiest way around that is to send a new randomly generated password to the users email address and force them on first relogin to change their password. Once they have changed their password re-encrypt and start the process all over. (if they forget thier password again). Im sure there is a way around it, i use $md5pass, and thats the only way i know how to get around it.
  17. Ok im having trouble figuring this out. Here is my problem, say you have a table of Professors and a table of Courses Courses ex. COSC CPSC MATH HIST Professor ex. JOHN HARRY DAVE JIM JOHN can teach COSC and CPSC HARRY may only teach math etc... you get the point. Im having trouble with the logic. Im trying to figure out without having to make a column for every course ( COSC CPSC ) to be able to link Professors to many courses as in the JOHN example. Right now i have it to where they can only be associated with 1 course. For example 1 = COSC cour_id prof 1 JOHN But what im looking to do is for JOHN to be associated with COSC AND CPSC
  18. GetSecti(str) should not be there it should be GetSecti(this.value), but still am recieveing the same error.
  19. Right well my problem is within my php page itself... I guess I should have mentioned that before... <form action="insertfunc.php" method="post"> <table width="446" height="110" border="0" align="left" cellpadding="20" cellspacing="20"> <tr><td width="172" height="32">TAG:</td> <td width="262"><select name="Un" size="1" id="Un" onchange="GetSecti(str)"> <?php displayUn();?> </select> The php displayUn() calls a php page that inserts the options from a MySQL database and values as the same thing and inserts it into a listbox. In this one i added back the GetSecti(str) to test a few things. Or maybe this still needs to be moved? ???
  20. I have a tag in the page where the drop down lists are for the .js file <script src="selected.js" type="text/javascript"></script> and in the dropdown i have onchange="GetSecti()"> However in the GetSecti i had GetSecti(this.value) But i was getting errors saying If i took them out i recieved the same error. My .js file is as follows // JavaScript Document var xmlHttpfunction GetSecti() { xmlHttp=GetXmlHttpObject() if (xmlHttp==null) { alert ("Browser does not support HTTP Request") return } var url="getselected.php" url=url+"?q="+str url=url+"&sid="+Math.random() xmlHttp.onreadystatechange=stateChanged xmlHttp.open("GET",url,true) xmlHttp.send(null) }function stateChanged() { if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") { document.getElementById("txtHint").innerHTML=xmlHttp.responseText } }function GetXmlHttpObject() { var xmlHttp=null; try { // Firefox, Opera 8.0+, Safari xmlHttp=new XMLHttpRequest(); } catch (e) { //Internet Explorer try { xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); } } return xmlHttp; } which of course then calls the get getselected.php file. I had an alert in there which of course was not getting called since it seems as if the .js file is not being called. Any help on this at all? Thanks Michael
  21. Your the man rarebit worked like a champ. THANKS!!!!
  22. Maybe i wasnt clear, what i have is a table of members. And what im wanting is say for all of thier first names to display. If i use $i, it just displays the entire row.
  23. Nevermind i fixed it with adding a simple checklogin function with a if else statement.
  24. Im trying to auto populate a list box with information that is in the database. The problem im running into is that im only displaying 1 of the elements not all of them. <? session_start(); include("database.php"); function displayProf() { global $conn; $q = "select * from members"; $result = mysql_query($q,$conn); $row = mysql_fetch_array($result); $coun = mysql_num_rows( $result ); for($i = 0; $i < $coun; $i++) { echo $row[4]; } } ?> of course i realize this isnt putting anything into the combo box but i want it to display all the info before i put it in there.
  25. Ok, i figured it out... hostmonster has it set up odd. Anyway, i just needed to set the account_username and account_checklog oops anyway. I do have another question. I wanted to display the login form only when a user is not logged in. i know i need to use session_start() but im not sure exactly how to use it. Any help at all?
×
×
  • 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.