Jump to content

maztrin

Members
  • Posts

    16
  • Joined

  • Last visited

    Never

Everything posted by maztrin

  1. the spcs are ( i copied and pasted not really sure what was relevant): Processor Intel Core 2 Duo ( T8100 ) 2.1 GHz CPU Bus Speed 800 MHz Motherboard Sony VAIO AR Series Chipset Intel PM965 Express ExpressCard Slots 1 x ExpressCard 34 Slot Memory (Maximum) 3072 MB ( 4096 MB) 667 MHz DDR2 SDRAM Hard Disk 200 GB ( 1 x 200 GB) 5400 RPM Serial ATA Hard Drive Graphics Device ATI Mobility Radeon X2300 128 MB Dedicated
  2. smashing magazine that site is amazing...thanks for the links
  3. ive been using wamp but i find i think it makes my laptop run really slowly. so im after a more lightweight bundle. i came across easyphp was wondering if anyone has ever used it? is it really lightweight? meaning not so much use of system resources. i know about xampp but am just wondering if there are any other bundles out these that specifically include apache, mysql, phpmyadmin, php? cheers all
  4. i should also point out that the username field will have to be taken from another table using a join.
  5. would you be able to explain this a little please
  6. hi i am trying to create a league table that shows who has the most votes in a forum. the system works like this: every topic that is created by a member is given a topic id AND a member id of who started the topic. every time a topic is voted for the counter will update for that topic. so in the database every topic created has a unique id, but a member id will show up various times depending on how many topics that member started. so then that means there is more than one counter for each member (see the table example below) table: mysql table topic id member id counter 1 23 2 2 34 3 3 22 7 4 23 3 5 34 2 so what i was trying to figure out was - is there a way in mysql or php to select all the members. then if there member id occurs more that once just add the counter result together then display this in the league table? like this: member id username votes 23 john 5 22 sally 7 34 jack 5 so i want somehthing like this: query - select all the member id; query - where the member id occurs more than once add the counters together for that member query - show only the 5 highest members with the most votes i am thinking that maybe i would need to create some sort of variable in php to hold the counts for each member but this seems impractical. i hope i exlpained what i was looking for properly any help is appreciated thanks
  7. ok thanks everyone i have got it working now, i decided not to use the duplicate key as it just wasnt working. so i used an if else statement instead. thanks all
  8. so then how would i fix this. i need the id to auto_increment when it inserts a new record
  9. ok ive changed it so that it uses a function to check if an id exists, so if the returned result is > than 0 then a record exists so update otherwise insert but now that doesnt work, is the function ok? function check_debate_ID_exists($id) { #select the book id and see if it already exists in the table $query2 = "SELECT id FROM book WHERE id like \"$id\" "; $result2 = mysql_query($query2); if (mysql_num_rows($result2) > 0)#if greater than 0, then $id exists { #update row that is = to $id $query3 = "UPDATE book SET counts = counts+ 1 WHERE id = $id AND userid = $uid"; $result3 = mysql_query($query3); } else #no id exists { #insert a record by creting a vote $query4 = "INSERT INTO book(id, userid, datetime) VALUES ('$id', '$uid', NOW() )"; $result4 = mysql_query($query4); } }
  10. Hi, i am trying to insert a record into a table, but if the record exists i want it to update the record instead of creating a new one, so i tried to use the on duplicate key update my php code: $query3 = "INSERT INTO book(id, userid, datetime) VALUES ('$id', '$uid', NOW() ) ON DUPLICATE KEY UPDATE counts= counts + 1"; $result3 = mysql_query($query3); but instead of updating it just inserts a new record. when i want it to update i just want the count field to update. could it be that because i havent initially inserted anything into the counts field it wont update? i have not initialized count as a variable. the default value for counts is 0 which is in the mysql. my id is an auto incremenet value. i tried reading the manual about the duplicate key but i got a bit confused any help is appreciated, thanks
  11. man alive! i can believe what a dunce i was being...it was getting cut off as well thanks guys all sorted
  12. hi, i have created a simple registration and login system where i have used sha to encrypt the password when it goes into mysql i can create a new user just fine and the password saved in mysql is for exameple: 'e6f2bcf372ca793b829a' but when it comes to logging in a user it does not recognize the password. unless i type in the exact value that was created when using SHA. so i figured there was somethign wrong with the way i was using sha my code: register.php $query = "SELECT ID FROM users WHERE email='$emailadd' "; $result = mysql_query($query); if (mysql_num_rows($result) == 0) { $query = "INSERT INTO users(username, email, password,) VALUES ('$username', '$emailadd',SHA('$pass') )"; $result = @mysql_query ($query); //rest of my code and login.php $query = "SELECT ID, username FROM users WHERE email='$emailladd' AND password=SHA('$pass')"; $result = @mysql_query ($query); $row = mysql_fetch_array($result, MYSQL_NUM); //rest of my code in my mysql database the password field settings are: type: Char, size: 20 am i not supposed to be using sha again in the login form? any help would be appreciated on this thanks
  13. ah well i have tried this but it didn't work at all so i tried testing the first if statement and commented out the rest. and i noticed that it didn't even work...so its probably not the elseif statement at all. so do you think that maybe the get isn't getting the topic my adapted code: <?php $t = $_GET['topic']; if ($t == '0') { ?> //the code that i want it do display <?php } else { echo 'something went so wrong'; } when i use this it goes straight to the else statement.
  14. hi i am having a little trouble with an if else statement basically in my forum type application is this sort of format with an elseif statement ok? as i keep opening and closing the the php statements basically depending on what state $t is at will determine whether a form or message is presented to the user. $t = $_GET['topic']; if ($t == 0) { ?> //a html form goes here <?php } #end of if elseif ($t == 'c') { //code ?> //A MESSAGE IS DISPLAYED HERE INSTEAD OF A FORM <?php } else { //JUST A DEFAULT MSG OR SOMETHING } ?> end of html code and page what's happening at the moment is that depending on the status of '$t' it is showing only the first if statement any help is appreciated thanks MazTrin
  15. i am already using get i just dont know how to implement it. my code: $id=$_GET['post_ID']; // rest of my code does other stuff $query = "INSERT INTO postReplies(post_ID, postreply) VALUES ('$id', '$reply' )"; $result = @mysql_query ($query); the post_ID is from another table. but when a user posts it will take the post_ID and post it into the postReplies table. note: the post_ID that i am trying to get to post to the Database is already being used once in the script (in another block of code) to display the post already. could this be affecting it?
  16. hi, i am trying to create my own simple post/comments scripts. i have managed to set up all the topics so that they each have their own id. eg: www.site.com/topic.php?id=4 i am trying to associate the posts and replies using an id. i have 2 mysql tables:1) - posts and 2) - postReplies in the posts table there is a post_ID that each post is given. when a user makes a reply to a post it saves to the database postReplies but how do i get it so that when a user makes a reply the post_ID that was made for the original post is saved in the post_ID column that is also in the postReplies column. im using php and mysql i hope i described my problem accurately. any help would be appreciated. thanks trin edit: ive looked into it a little bit and i think i need to use this $_GET method which i have used before but am a little stumped about how to use it to post the id to the database
×
×
  • 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.