Jump to content

Phate

Members
  • Posts

    11
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Phate's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thanks guys, the many to many relationship is new to me and now seems very logical. If I encounter any problems, I'll hop in on IRC. Thanks again!
  2. Hi, need some beginner help with my tournament script again. I have my db, with in there, 2 tables: users and tournaments. Now I need to kinda "link" those. There's a page that query's for all a tournaments info and displays it, and there a player can subscribe. But than they need to show on the tournament info page to. I've been thinking, and I've come up 2 ways (or atleast the logic part in it, not the practical work) 1. I place the player names in a text field in my tournaments table separated by comma's. But that way, I cannot make player pages that summons all a players info, including which tournaments he is attending. I also wouldn't be able to let them unsubscribe I think. 2. I add the tournament name to the usertable. But that seems even harder. So I need some way of linking those 2, a way that I can still have freedom with the data, so make a player page with all his tournaments, a tournament page with all the players, allow the play to unsubscribe, ... Can anyone tell me the best way to get this done?
  3. Hi, this might seem a stupid question, but well I kinda need the info I need to know where the username you logged in to phpbb with is stored (if it is being saved) and how I can recover it (I haven't used cookies before, only sessions) So all I need to be able to do is, get the username you logged in with, and echo it on a page. Thanks in advance. Phate
  4. Code: [code=php:0]<?php mysql_connect(localhost, quote, quote) or die(mysql_error()); mysql_select_db(quotes); $query = "SELECT quote FROM quote ORDER BY RAND() LIMIT 1"; $result= mysql_query($query); $row= mysql_fetch_array($result); echo $row['quote']; ?> [/code] Error: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in E:\chiemel\xampp\htdocs\ss\quote.php on line 7 MySQL dump: SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; -- -- Database: `quotes` -- CREATE DATABASE `quotes` DEFAULT CHARACTER SET latin1 COLLATE latin1_general_ci; USE `quotes`; -- -------------------------------------------------------- -- -- Table structure for table `quote` -- CREATE TABLE `quote` ( `id` int(11) NOT NULL auto_increment, `quote` varchar(60) collate latin1_general_ci NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=3 ; -- -- Dumping data for table `quote` -- INSERT INTO `quote` (`id`, `quote`) VALUES (1, 'Dissadump!'), (2, 'Test 1'); Thanks for trying to help me Edit: Sorry, made a stupid mistake in the code Everything works now! Thanks alot!
  5. Thanks, but I think I'm missing something in that query (complete noob here), maybe missing an arguement in the RAND() function? The code doesn't give me any errors, but well, it doesn't show anything at all. Don't worry about the passwords in there, it's on a computer that isn't connected to the web. <? mysql_connect(localhost, quote, quote) or die(mysql_error()); mysql_select_db(quotes); $query = "SELECT quote FROM quotes ORDER BY RAND() LIMIT 1"; $result= mysql_query($query); echo $result; ?> Any ideas?
  6. Hi, I'm building a small random quote script, and I'm having some troubles starting from the fetch_array. while($row = mysql_fetch_array($result, MYSQL_ASSOC)) { So starting from here, I need to determine how many results my query returned. I don't know how to do this.(for example, save it to $i) Than, it needs to randomly generate a number between 0 and $i. I don't know, how to do that . Than, it needs to select just that result from the query and display it. Any help would be appreciated. Thanks, Phate
  7. Boy do I feel stupid now. Thanks a bunch!
  8. Hi, Since I do most of my php coding on a computer that isn't connected to the net (and as a beginner) I'm looking for some sort of help file I can use when I'm offline, containing all the functions and a little bit of explanation, etc. Does anyone know if this exists; and if so, where I can find it? I tried google, no luck for me, sorry. Thanks, Phate
  9. Hi again. So now basically I have this script that gets info from my database. You can see the page here and you can view the code here. Now here's what I want to do: I want the edit button and delete button to work How would I get php to load a new page, when I click the edit button, with in that page all the info of that row of the db in there? There's also an ID column in my db if that could be of any help... Thanks in advance, Phate
  10. (I'm new to the whole php and php freaks scene, so I wasn't sure if I was supposed to post this here or on the mysql forum) Here's the error I get Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in add.php on line 78 Full code: Here Line 78: $query = "INSERT INTO " . $table . " (date, name, website, location, playersfee, maxplayers, level, description) VALUES('$_POST['date']', '$_POST['name']', '$_POST['website']', '$_POST['location']', '$_POST['fee']', '$_POST['maxplayers']', '$_POST['level']', '$_POST['description']')"; I'm thinking maybe because the $_POST variables aren't defined yet when I first load the page, it considers it as whitespace, but normally seen it should only be executed when I clicked the add button for the first, because it's in the If(!isset($_POST['add']) Else section. Does anyone see the problem? Thanks.
×
×
  • 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.