
heldenbrau
Members-
Posts
159 -
Joined
-
Last visited
Everything posted by heldenbrau
-
I wouldn't mind a critique of how it looks and how it works. I will put it in the other one too.
-
Tut, posted the wrong page, the homepage is: http://www.kangercourt.com/index.shtml
-
This is my forum I have been working on. I have just finished it today, apart from a few things that need to be sorted out. http://www.kangercourt.com/cases.php To test the settings the username is: kanger and the password is: test The settings are saved in a database, so the test account settings will be constantly changing if lots of people try it out at once.
-
On the login screen, the username and password fields don't clear the heading. Text boxes are over the heading. I couldn't get passed the login screen.
-
How do you keep the text to stay in the text box
heldenbrau replied to heldenbrau's topic in PHP Coding Help
but most online forms keep the text in the box. Like order forms, when you put your name and address in. -
If somebody fills out a form and they click the back button by mistake and go back, the text is gone from the text box. On this forum, if I do that, the text is still here when I come back. How can I get my text boxes to do this?
-
I have sorted it out now and have joined the two tables, thanks a lot for your help.
-
I get an error from using that. You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'casenum'
-
JOIN looks like what I need. But if I join the 2 tables, there will be 2 fields showing numposts and lastpost. Should I delete those feilds from mythreads and then use JOIN?
-
I have a forum which displays a list of all the threads. There are 4 tables, 1 for each category of the forum. There is another table, numposts, which lists every single thread on the whole site including private threads. Users can choose if they want to watch a thread, if they watch the thread it is shown on their settings page as their own custom list of threads. I want this list to be sorted by the thread with the most recent post on it and also display the number of posts on each thread. So the list needs to show. Date of last post, Title, number of posts, and then be sorted by the most recent thread. The list of watched threads is stored in a table called mythreads$username. I can only update the number of posts and time of last post by updating postnum and then referencing the fields in mythreads. Otherwise I would have to save the info to every single mythread$username table.
-
-- Table structure for table `postnum` -- CREATE TABLE IF NOT EXISTS `postnum` ( `casenum` int(20) NOT NULL, `numposts` int(10) NOT NULL, `lastpost` int(20) NOT NULL, PRIMARY KEY (`casenum`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `postnum` -- INSERT INTO `postnum` (`casenum`, `numposts`, `lastpost`) VALUES (8, 8, 1251929065), (9, 11, 1251930016), (10, 13, 1251929877), (1251832641, 6, 1251929258); Table structure for table `mythreadskev2009` -- CREATE TABLE IF NOT EXISTS `mythreadskev2009` ( `heading` varchar(100) NOT NULL, `casenum` int(20) NOT NULL, `lastpost` int(20) NOT NULL, `replies` int(10) NOT NULL, `type` int(1) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1; -- -- Dumping data for table `mythreadskev2009` -- INSERT INTO `mythreadskev2009` (`heading`, `casenum`, `lastpost`, `replies`, `type`) VALUES ('Hello everybody', 1251832641, 1251836225, 4, 4);
-
table postnum "8";"8";"1251929065" "9";"11";"1251930016" "10";"13";"1251929877" "1251832641";"6";"1251929258" table mythreads "Hello everybody";"1251832641";"1251836225";"0";"0" Column 2 in mythreads is the thread number. In numposts column 2 is the number of posts on the thread and column 3 is the time of the last post. Mythreads is a list of the members watched threads. I want to display the table mythreads as a list to display. The title, the time of the last post, and the number of posts on the thread. And I need it to be sorted by most recent post first. So columns 4 and 5 of threadnum, need to display the info from columns 2 and 3 of numposts (which is a table of every thread)
-
The problem is, I want to reference a field on the other table that is not the primary key. The primary key on the table is casenum, which is a unique number, the number of a thread on a forum. But the field I want to reference is the number of posts on that thread, a field called postnum. So what I want to see in the field is the data in postnum where casenum=$casenum
-
I have worked out that I can put the data from the 4 databases into one table in the same database. So I only need to reference a different table. But I don't know what to type to insert it. Do I type: $sql = "INSERT INTO mythreads$username (heading, casenum, lastpost, replies, type) VALUES ('$heading', '$casenum', '$date', 'field TYPE REFERENCES users postnum ON UPDATE CASCADE ON DELETE CASCADE WHERE casenum="$casenum"', '4')"; Sorry I am new to this, but I can't find the info anywhere
-
I've just realised that depending on the type 1-4 the field needs to reference a different table on a different database for each type. I have read and tried to understand the info that you gave me, but it looks as if the tables need to be in the same database to use the foreign key. I wish I had put all the tables in the same database now.
-
I have a table in a database called users, that is constantly changing. I have another table called mythreads in another database which I need to update when the users table updates. Is there a way of inserting into the mythreads table a reference to a feild in the other database. So that when the field in the second database is selected it shows data from a field in the first database. If there is a way to do this, how do you insert the field with PHP this is where I want to insert the field, it needs to reference the feild in users.users numposts where casenum=$casenum $sql = "INSERT INTO mythreads$username (heading, casenum, lastpost, replies, type) VALUES ('$heading', '$casenum', '$date', 'HERE', '4')";
-
That looks like a better way, but still getting the same error message. What does the error message mean?
-
I want to check if a table exists and if it doesn't then create it. I have tried this code: $sql = "SELECT * FROM mythreads$username"; if ($mysqli->query($sql)===TRUE){ } else{ $sql = "CREATE TABLE mythreads$username (heading VARCHAR(100) NOT NULL, casenum INT(20) NOT NULL, lastpost INT(20) NOT NULL, replies INT(10) NOT NULL, type INT(1) NOT NULL)"; if ($mysqli->query($sql))===TRUE{ }else die("could not create database" . $mysqli->error); } But I get Parse error: syntax error, unexpected T_IS_IDENTICAL
-
[SOLVED] Fatal error: Function name must be a string
heldenbrau replied to heldenbrau's topic in PHP Coding Help
:o :'( Not again, every time it is something like this. At least I am learning because every time I don't spot the missing bracket or semicolon I end up reading 10 pages of my php book trying to find what I have done wrong. Thanks for the help. -
[SOLVED] Fatal error: Function name must be a string
heldenbrau replied to heldenbrau's topic in PHP Coding Help
The } was on the next line, I missed it out of the C&P The line number is 17 where the function is called. But I didn't realise that until I looked again. I called it like this: $headline = headingsafe($_POST('headline')); -
function headingsafe($hin) { $S1= array('£',"'",'?','>','<','"',':',';'); $S2= array('£',''','?','>','<','"',':',';'); return str_replace($S1, $S2, $hin); This is the first time I have tried to use a function and of course there is an error. Is there something wrong with my function?
-
My font sizes were working on my webpage. I tried to change a font size and it didn't work, then I noticed that when I change any font sizes, they no longer change. Everything else works, like alignment and div settings. Just not font size. body{ padding:0px; font-family : Helvetica,Arial,sans-serif; margin-top:0px; } p.main { font-family:Helvetica,Arial,sans-serif; font-size:16pts; text-align:center; } p.text { font-family:Helvetica,Arial,sans-serif; font-size:16pts; text-align:justify; } a { font-family:Helvetica,Arial,sans-serif; font-size:20pts; text-align:center; } h1{ font-family:Helvetica,Arial,sans-serif; font-size:100pts; text-align:center; } h2{ font-family:Helvetica,Arial,sans-serif; font-size:10pts; text-align:center; } li.main { font-family:Helvetica,Arial,sans-serif; font-size:20pts; font-weight:100; text-align:justify; } li.text { font-family:Helvetica,Arial,sans-serif; font-size:16pts; font-weight:100; text-align:justify; } div#top{ float:top; width:100%; padding:2px; border:1px solid #000; } div#left{ float:left; width:36%; padding-left:40px; padding-right:5px; padding-top:0px; border:1px solid #000; } div#right{ float:right; width:56%; padding-left:5px; padding-right:40px; padding-top:0px; border:1px solid #000; }
-
the values in the database are either y for yes they are registered n for no and s for suspended. If they have not activated their account, or their account is suspended, then I want the program to die.
-
In the database the field active is set to y It always dies with this code if ($row['active']!="y"){ die (header("location:forgotten.php?notactive=f")); But if I use this it doesn't if ($row['active']=="n"){ die (header("location:forgotten.php?notactive=f")); Shouldn't they both produce the same result?
-
How do you get the encrypted password to send password reminder.
heldenbrau replied to heldenbrau's topic in PHP Coding Help
Thanks a lot for typing all that out, I was using a hash and not encryption. I think I will try and use encryption if it is not as much hassle as doing what you have suggested because I am lazy. This password encryption is to protect users on a forum from having their passwords stolen. It is just a general forum no personal details are stored. I am the only person who accesses the database. Is there any need for me to encrypt the password? I can only see that it would need protecting by encryption if other people had access to the database and it contained personal details.