Jump to content

cripin

Members
  • Posts

    12
  • Joined

  • Last visited

cripin's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. i copied it and it remained like that for some reason. Also how would I go about to do it?
  2. REATE TABLE tops( id INT NOT NULL AUTO_INCREMENT, users_id INTEGER NOT NULL, title varchar(80), details varchar(250), type varchar(30) NOT NULL, site varchar(50), votes INT NOT NULL, facebook varchar(80), image varchar(100) NOT NULL, CONSTRAINT tops_pk PRIMARY KEY(id), CONSTRAINT user_fk FOREIGN KEY(users_id) REFERENCES users(id)); PHP Code: CREATE TABLE users( id int AUTO_INCREMENT NOT NULL, username varchar(60), password varchar(60), email varchar(80), premium enum('0','1') NOT NULL, timestamp int NOT NULL, CONSTRAINT users_pk PRIMARY KEY(id); When I register the data goes to the users table [working fine] Then when I add a server the data goes to tops table [working fine] However, users_id field in tops table doesn't update to the id of the user that added the server, it just remains 0. Could anyone help me find a problem here please
  3. no lol this script that i posted works, but it doesn't do what i want it to do, read my message next time before posting
  4. Hello, i added a vote button to my site (on local host still developing) it now appears on all rows basically as soon as the row gets created it appears, but the voting button only lets you vote for 1website, you can click any of them it takes you to the same page and when u enter and press vote the votes only add to one site, how can i make it so that the vote would add up to a specific site. I am guessing it should depend on an id but cant figure out how the query and code should look for this. As you can see it only votes for 1 because the id is set 1, how should i change it so that each topsite would have vote button with specific id? if(isset($_POST['code'])) { $vote_code = $_POST['code']; if(!empty($vote_code)) { $query = "SELECT count FROM users WHERE id=1"; if ($query_run = mysqli_query($con, $query)) { list($k) = mysqli_fetch_row($query_run); $jr = $k + 2; $voteup = "UPDATE users SET count ='$jr' WHERE id =1"; $updatevote = mysqli_query($con, $voteup); echo 'your vote has been added" "'; } }else{ echo 'hi'; } }
  5. so say if the function has 3 parameters and the one you wanna use is the 3rd one, would it calling the function look something like this: myfunction('','',$myparameter); or my function($myparameter) ; or something else?
  6. Can i include it inside the function parameter even if I already have a parameter inside it? the parameter is the name of another function. Basically can i have 2 paramaters in a function and if so should the connection one come before or after
  7. started learning php last week, at first didn't know anything about it so used mysql, now yesterday reading some article i saw that i should be using mysqli instead of mysql, so i changed all the code for my registration and login pages every works fine. However can't figure out the mysql_result to mysqli, couldn't find it on google too the code: the error im getting: Warning: mysql_result() expects parameter 1 to be resource, object given in /Applications/XAMPP/xamppfiles/htdocs/index.php on line 12 <?php require 'conect.php'; $user_ip = $_SERVER['REMOTE_ADDR']; function update_count() { global $dbconnect; $query = "SELECT count FROM hits_count"; if ($query_run = mysqli_query($dbconnect, $query)) { $count = mysql_result($query_run, 0, 'count'); echo $count; } } update_count(); ?>
  8. user would first of all register like her: http://topofgames.com/index.php?register and all the information would be displayed on the homepage like this one: http://topofgames.com
  9. Hello all, basically I am trying to create a top site, i was wondering how should i start off writing my php so that when user clicks on the register.php page and fills in the fields such as the username, password and other information about their server such as the title and description it would automatically appear on the homepage list, also how can I make every other server listing have different background colour, for example 1server -light yellow background 2.dark yellow and repeat thanks a lot
  10. yeah thanks a lot, will try it now, will get back if I get stuck, thanks again
  11. I want to create an advertising website basically a game top list and want to add premium accounts this is how it would work: 1.login or register at (registration.php) 2. go to (premium.php) - to access it user needs to be logged in if not show the login screen. - display information about premium - have a column of available premium type accounts allowing users to tick the chosen one - user selects the type of premium account and clicks buy - user selects payment type paypal or bank - user pays ****************************************************** now what should happen to users account once the payment is complete? How to turn the account into premium, add a separate field to regular users table or create a new table for premium accounts. Thanks a lot
×
×
  • 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.