-
Posts
337 -
Joined
-
Last visited
Everything posted by Clinton
-
Are you posting a form at all or just trying to query the location if the page switches?
-
I've got a table that lists office locations by city and state. Sometimes there are several offices in one city. Right now I am using the following code to pull up the citys City: <select name="city" onchange='this.form.submit()'> <?php $sql = "SELECT city FROM thelist WHERE state = '$state' ORDER BY city"; $rs = mysql_query($sql); while($row = mysql_fetch_array($rs)) { extract($row); echo "<option value='$city'>$city</option>"; } ?> </select> But if there is three offices in one city then it will echo out that same city 3 times in the drop down list. What's the best way to correct this so it only shows once?
-
Thanks Cy, that worked perfectly.
-
Thanks Gevans, that worked. Now one more question. If the state variable hasn't been selected I want them to be able to view all states. Do I have to do an if isset statement or can I use a * or a wildcard variable of somesort? I've tried both * and % to no avail.
-
I didn't think it was that complicated but everytime I add another variable it seems to not work. This time it's the state variable. I added it and my query is pretending like it's not there and displaying the rest of the result. ANy ideas? $sql = "SELECT * FROM $tbl_name WHERE dtype = '$dtype' OR dtypewc = '$dtype' AND dmajorp = '$smajor' OR dmajorc1 = '$smajor' OR dmajorc2 = '$smajor' OR dmajorc3 = '$smajor' AND state = '$state' ORDER BY jpted LIMIT $start, $limit";
-
So if bob logs in then I store a 'yes', for example, in a table specifically designed to indicated bob's logged in status. But again, what happens if he closes his browser without logging out? How does the db update then? I thought I was just setting sessions but my sessions weren't dying when I unset them so I used the whole cookie deal and wah-lah it works. See http://www.phpfreaks.com/forums/index.php/topic,232287.0.html
-
Well regardless of cookie time if a browser is closed the sessions generally kill, at least most websites I have been on. Mine's not doing that and I prefer it that way. Other than that they could stay logged in for eternity, which is fine with me hence the unusually long time.
-
Ok, thanks guys, yea, both of those work. :-)
-
I did the code below because I'm going to replace dtype = * with dtype = $variable and I wanted to get it to work... which it's not. Basically, I want to be able to narrow down the search by dtype AND the dmajors but if there is no specific dtype selected I want to show all of the dtypes. Make sense? <?php $query = "SELECT COUNT(*) as num FROM $tbl_name WHERE dtype = * AND dmajorp = '$smajor' OR dmajorc1 = '$smajor' OR dmajorc2 = '$smajor' OR dmajorc3 = '$smajor' ORDER BY jpted"; ?>
-
Ok, when I click the logout button this gets executed and the session ends. if (isset($_COOKIE[session_name()])) { setcookie(session_name(), '', time()-42000, '/'); However, if the browser closes, or even when the computer restarts, the session still remains if I do not logout. How do I fix this? Do I have to put the setcookie on every page...???
-
Apparently all sorts of ways I could have done it. LoL. Thanks Premiso... once again. :-)
-
It's an option on a form, text type, then the form INSERTS all info into the db. It's actually being populated by SELECT then extract_row().
-
Ok, Premiso... I did not enter anything into that line (dtypewc) so why did it "set"? How does something "set"? I looked up in the manual but it doesn't say how a variable set's. Thanks for the empty link btw.
-
I have this... <?php if (isset($dtypewc)) { ?> <tr><td id='header'> Will Consider a <?php echo $dtypewc; ?>. </td></tr> <?php } ?> Now, my $dtypewc variable is empty but it's still returning the "Will Consider a"... Any ideas why? Thanks.
-
I've been scouring the internet up and down and have found a lot of pieces about mysql, php, and pictures and have tried to put them together to form my code.... but... it's failing. So a couple of questions... I've got this on the page (we will call showimage.php) I want to show the picture: <h3><img src="getimage.php?name=<?php echo $username ?>" width=100 Height=125></h3> I've got this on the getimage.php page: <?php include 'connect/project.htm'; $name = $_GET['name']; $result=mysql_query("SELECT clogo FROM employers WHERE username='$name'") or die(mysql_error()); $row=mysql_fetch_object($result); Header( "Content-type: image/png"); echo $row->content; ?> Now, the showimage.php page is just displaying a broken link. The getimage.php page is displaying the text "http://localhost/project/getimage.php?name=hunna03" as an image and not the actual image. So the questions... 1) I am saving images as a BLOB in mysql. How do I know they are saving correctly? I can't find any way to see them in MySQL. 2) What am I doing wrong with this code? Thanks.
-
Can you show us your code?
-
You're right, my apologies.
-
How long is this supposed to go on?
-
Got it. Just had by variable names wrong. :-p Thank you.
-
No, gevans, you're hiding the button. He wants: <form> <input type="hidden" name="uid" value="<?php echo $rows['UID']; ?>" /> <input type="submit" name="edit" value="EDIT"> Then on the next form you justget $_POST['uid'] and go from there.
-
I was messing with that but it's not working... let me play with it a little bit more.
-
What exactly is the question here? What are you trying to do?
-
Let's say I've got three fields that keep track of a persons skills. These are Bobs skills... Field 1 is his primary skill, say a Carpenter. Field 2 is his secondary skill, say a Hair Dresser. Field 3 is his tertiary skill, say a Window Washer. These are Joes skills... Field 1 is his primary skill, say a Hair Dresser. Field 2 is his secondary skill, say a Carpenter. Field 3 is his tertiary skill, say a Window Washer. Now lets say I wanted to pull up all the people who are qualified to be a carpenter. How do I do this? Right now I've got: SELECT * FROM thelist WHERE pskill = 'carpentry' But this only lists the ones who have the primary skill of carpentry. If I do: SELECT * FROM thelist WHERE pskill = 'carpentry' AND sskill = 'carpentry' then it leaves out anybody who just has the primary skill (or secondary if I include the third). How do I make it so it finds all carpenters in any of those three fields without excluding everyone if one doesn't have it?
-
If you know exactly what category then yes, that's correct.
-
Well, I wouldn't say that I've got it but I would say that it makes more sense. :-) Thanks for taking the time to explain it.