MySQL / PHP dating site
- Started
- Last post
- 40 Responses
- Orbit0
^ Someone who doesn't know what the thread is about, thinking he knows what the thread is about, and berating people who do know what the thread is about and are trying to help out.
My hourly rate for correcting mistakes like this is triple my normal rate.
- acescence0
i know the answer, but i think i'll keep it to myself. good luck!
- juhls0
Hey guys, I got half of it working now. Just some querying stuff to do and I also need to figure out how to let someone modify their own profile.
The next thing I am working on is to display some random profiles on the main page.
What can I do to make this work? I looked at various tutorials and information on the internet but all of them seem overly complicated.
http://pastebin.com/m20da394eNot sure if I should do two separate queries...
table: client_photos
column: file_name (or whatever displays the image)table: clients
columns: dob, cityThe client_id has to match from both tables so it's not a random photo being displayed with the dob and city.
I'll have to figure out how to display the age based on the dob later as well.
Thanks for any help again.
- I updated the PHP with some more code that I modified.juhls
- http://pastebin.com/…juhls
- SoulFly0
I want to sign up, how much you'll charge monthly fee?
I'm assuming it will be free within the first 6 months until it really kicks off correct?
- ukit0
A dating site for QBNers...I like it
- In this sausage factory??ETM
- http://www.prisondat…drgss
- It's not real.juhls
- prisondate.se? its swedish. They're planing to have one in norway, state-founded
http://www.dagbladet…drgss
- juhls0
Not sure if anyone is around right now, but last thing. See anything wrong with this?
- skt0
$600 a day.
- juhls0
Do you guys think I should have a separate include page for the username and password of existing members? Meaning: the login portion of the site?
Here is the code so far:
http://pastebin.com/m42e4ba92Also, for if($query), how do I add another query to that? is it
if($query && $query2) ?I'm getting an error with querying the database, and I have a feeling it's because of the interests (the code is right before the HTML starts) but I'm not getting any other error message.
"query" is still sent to the "clients" table, but the interests ("query2") are not sent to the interests table.
- nocomply0
Check out http://www.punkmatch.com/ for some good inspiration
- juhls0
This is what I have so far
$insert_id = mysqli_insert_id($oConn);
$query2 = "INSERT INTO client_interests(client_id, interest) ". "VALUES ('$insert_id', ')";
$result2 = mysqli_query($oConn, $query2) or die('Error querying database.');
In the $query2 area...how can I write it out (simplest way) so that the interests (which the user has written out with commas in-between) is exploded into multiple rows?
Something like this?
$interest_list = implode(',', $interests);
And/or an array?
- maybe a for loop? for($i = 0; $i <= strlen($string); $i++){
or is it simple...juhls
- maybe a for loop? for($i = 0; $i <= strlen($string); $i++){
- drgss0
Shouldn't it be if($result && $result2)? $query and $query2 are strings
Btw, $result2 returns success boolean only for the last interest insert, which is probably ok. If at least the last one is ok, then the rest are too, and if something is wrong with the client_interests table, the whole row should fail
But to be extra anal about it , to check if all interests are inserted
$result2 = TRUE;
$interests_array = array_map('trim', explode(',', $interests));
foreach ($interests_array as $interest) {
$query2 = "INSERT INTO client_interests(client_id, interest) ". "VALUES ('$insert_id', $interests')";
$result2 = $result2 && mysqli_query($oConn, $query2) or die('Error querying database.');
}Also, it should be "Your last name" on line 57
- BattleAxe0
line 150 you left out a ' on inserting the Vaules ('$insert_id', $interests') should be ('$insert_id', '$interests')
little gotchas like that will do ya
also why not try a SWITCH statement instead of all the if's same logic but more standard
- ETM0
If you allow people to type in their interests freeform, matching logic could be more difficult. Adding in multiple terms for similar activities, people's inability to spell etc, there are a lot of variables. A group of say 10 drop downs prepopulated with common activities may work better. Depends on how broad or detailed you want to have the answers be at that stage.
- lukus_W0
checkout http://www.kohanaphp.com/ - it might be worth learning if you're into building webapps with php
- moth0
Plenty of example data models out there Juhls:
http://www.databasedev.co.uk/dat…
- juhls0
Hmm...I may do it that way. I want to match the interests on a separate page where the user has to login first.
- moth0
You can put the login stuff into a separate include if you want to. There's no hard rules on this stuff - whatever helps you keep things organized.
If you find yourself repeating code, you're doing it wrong...
- vaxorcist0
for security, I highly suggest adding a hash reference field to the user table so that you are not doing the following:
edit_user.php?id=321
where user may try to hack and change "321" to anything else, and attempt to edit annother user's info. This can be prevented a number of ways, but seeing a URL like that in any referral logfile is an invitation to somebody to messs with your app....
whereas a hash like:
edit_hash?hash=sdf83767d9d376216...
is much cleaner... I use sha1 for a 40 character char field in the database and add a simple function id=lookup_id_from_hash($hash)