Hey,
Ik heb weer een nieuwe vraag, Ik heb nu het forum (zonder layout dan), maar daar heb ik eventjes ingesteld dat je je email en naam moet invullen, alleen ik wil dat dat automatisch gaat, via een login systeem. Maar dan wil ik ook dat ik inlog op de website, en dat ik dan zo naar het forum kan gaan, een post maken, en dat je nog steeds ingelogd bent.... Dus niet zoals GHED (bah, wálgelijk
), dat je geen apart nieuw acount moet aanmaken. maar dat je gewoon op de site registreerd en je kan op mijn forum.... eigenlijk net zoals hier.
ik kan wel ff de codes plaatsen:
View_topic.php:main_topic:create_topic:add_topic:add_answer:link: http://jail.comyr.com/Forum/main_topic.php
Ik hoop dat iemand me kan helpen!
Groet, Bram.
Ik heb weer een nieuwe vraag, Ik heb nu het forum (zonder layout dan), maar daar heb ik eventjes ingesteld dat je je email en naam moet invullen, alleen ik wil dat dat automatisch gaat, via een login systeem. Maar dan wil ik ook dat ik inlog op de website, en dat ik dan zo naar het forum kan gaan, een post maken, en dat je nog steeds ingelogd bent.... Dus niet zoals GHED (bah, wálgelijk
), dat je geen apart nieuw acount moet aanmaken. maar dat je gewoon op de site registreerd en je kan op mijn forum.... eigenlijk net zoals hier.ik kan wel ff de codes plaatsen:
View_topic.php:
Spoiler tonen
[COLOR= #0000BB]<?php
$host[/COLOR][COLOR= #007700]=[/COLOR][COLOR= #DD0000]"mysql6.000webhost.com"[/COLOR][COLOR= #007700];[/COLOR] [COLOR= #FF8000]// Host name [/COLOR]
[COLOR= #0000BB]$username[/COLOR][COLOR= #007700]=[/COLOR][COLOR= #DD0000]"a6671097_bram"[/COLOR][COLOR= #007700];[/COLOR] [COLOR= #FF8000]// Mysql username [/COLOR]
[COLOR= #0000BB]$password[/COLOR][COLOR= #007700]=[/COLOR][COLOR= #DD0000]"wachtwoord"[/COLOR][COLOR= #007700];[/COLOR] [COLOR= #FF8000]// Mysql password [/COLOR]
[COLOR= #0000BB]$db_name[/COLOR][COLOR= #007700]=[/COLOR][COLOR= #DD0000]"a6671097_forum"[/COLOR][COLOR= #007700];[/COLOR] [COLOR= #FF8000]// Database name [/COLOR]
[COLOR= #0000BB]$tbl_name[/COLOR][COLOR= #007700]=[/COLOR][COLOR= #DD0000]"forum_question"[/COLOR][COLOR= #007700];[/COLOR] [COLOR= #FF8000]// Table name
// Connect to server and select database.[/COLOR]
[URL="http://www.php.net/mysql_connect"]mysql_connect[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"mysql6.000webhost.com"[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]"a6671097_bram"[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]"wachtwoord"[/COLOR][COLOR= #007700])[/COLOR]or [URL="http://www.php.net/die"]die[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"cannot connect"[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/mysql_select_db"]mysql_select_db[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"a6671097_forum"[/COLOR][COLOR= #007700])[/COLOR]or [URL="http://www.php.net/die"]die[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"cannot select DB"[/COLOR][COLOR= #007700]);[/COLOR]
[COLOR= #FF8000]// get value of id that sent from address bar [/COLOR]
[COLOR= #0000BB]$id[/COLOR][COLOR= #007700]=[/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]id[/COLOR][COLOR= #007700]];[/COLOR]
[COLOR= #0000BB]$sql[/COLOR][COLOR= #007700]=[/COLOR][COLOR= #DD0000]"SELECT * FROM $tbl_name WHERE id=$id"[/COLOR][COLOR= #007700];[/COLOR]
[COLOR= #0000BB]$result[/COLOR][COLOR= #007700]=[/COLOR][URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$sql[/COLOR][COLOR= #007700]);[/COLOR]
[COLOR= #0000BB]$rows[/COLOR][COLOR= #007700]=[/COLOR][URL="http://www.php.net/mysql_fetch_array"]mysql_fetch_array[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$result[/COLOR][COLOR= #007700]);[/COLOR]
?>
<table width="400" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
<tr>
<td><table width="100%" border="0" cellpadding="3" cellspacing="1" bordercolor="1" bgcolor="#FFFFFF">
<tr>
<td bgcolor="#F8F7F1"><strong>[COLOR= #0000BB]<?[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$rows[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]topic[/COLOR][COLOR= #007700]];[/COLOR] ?></strong></td>
</tr>
<tr>
<td bgcolor="#F8F7F1">[COLOR= #0000BB]<?[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$rows[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]detail[/COLOR][COLOR= #007700]];[/COLOR] ?></td>
</tr>
<tr>
<td bgcolor="#F8F7F1"><strong>By :</strong> [COLOR= #0000BB]<?[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$rows[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]name[/COLOR][COLOR= #007700]];[/COLOR] ?> <strong>Email : </strong>[COLOR= #0000BB]<?[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$rows[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]email[/COLOR][COLOR= #007700]];[/COLOR]?></td>
</tr>Spoiler tonen
[COLOR= #0000BB]<?php
$host[/COLOR][COLOR= #007700]=[/COLOR][COLOR= #DD0000]"mysql6.000webhost.com"[/COLOR][COLOR= #007700];[/COLOR] [COLOR= #FF8000]// Host name [/COLOR]
[COLOR= #0000BB]$username[/COLOR][COLOR= #007700]=[/COLOR][COLOR= #DD0000]"a6671097_bram"[/COLOR][COLOR= #007700];[/COLOR] [COLOR= #FF8000]// Mysql username [/COLOR]
[COLOR= #0000BB]$password[/COLOR][COLOR= #007700]=[/COLOR][COLOR= #DD0000]"wachtwoord"[/COLOR][COLOR= #007700];[/COLOR] [COLOR= #FF8000]// Mysql password [/COLOR]
[COLOR= #0000BB]$db_name[/COLOR][COLOR= #007700]=[/COLOR][COLOR= #DD0000]"a6671097_forum"[/COLOR][COLOR= #007700];[/COLOR] [COLOR= #FF8000]// Database name [/COLOR]
[COLOR= #0000BB]$tbl_name[/COLOR][COLOR= #007700]=[/COLOR][COLOR= #DD0000]"forum_question"[/COLOR][COLOR= #007700];[/COLOR] [COLOR= #FF8000]// Table name
// Connect to server and select database.[/COLOR]
[URL="http://www.php.net/mysql_connect"]mysql_connect[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"mysql6.000webhost.com"[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]"a6671097_bram"[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]"wachtwoord"[/COLOR][COLOR= #007700])[/COLOR]or [URL="http://www.php.net/die"]die[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"cannot connect"[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/mysql_select_db"]mysql_select_db[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"a6671097_forum"[/COLOR][COLOR= #007700])[/COLOR]or [URL="http://www.php.net/die"]die[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"cannot select DB"[/COLOR][COLOR= #007700]);[/COLOR]
[COLOR= #0000BB]$sql[/COLOR][COLOR= #007700]=[/COLOR][COLOR= #DD0000]"SELECT * FROM $tbl_name ORDER BY id DESC"[/COLOR][COLOR= #007700];[/COLOR]
[COLOR= #FF8000]// OREDER BY id DESC is order result by descending[/COLOR]
[COLOR= #0000BB]$result[/COLOR][COLOR= #007700]=[/COLOR][URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$sql[/COLOR][COLOR= #007700]);[/COLOR]
?>
<table width="90%" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#CCCCCC">
<tr>
<td width="6%" align="center" bgcolor="#E6E6E6"><strong>#</strong></td>
<td width="53%" align="center" bgcolor="#E6E6E6"><strong>Topic</strong></td>
<td width="15%" align="center" bgcolor="#E6E6E6"><strong>Views</strong></td>
<td width="13%" align="center" bgcolor="#E6E6E6"><strong>Replies</strong></td>
<td width="13%" align="center" bgcolor="#E6E6E6"><strong>Date/Time</strong></td>
</tr>
[COLOR= #0000BB]<?php[/COLOR]
[COLOR= #FF8000]// Start looping table row[/COLOR]
[URL="http://www.php.net/while"]while[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$rows[/COLOR][COLOR= #007700]=[/COLOR][URL="http://www.php.net/mysql_fetch_array"]mysql_fetch_array[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$result[/COLOR][COLOR= #007700])){[/COLOR]
?>
<tr>
<td bgcolor="#FFFFFF">[COLOR= #0000BB]<?[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$rows[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]id[/COLOR][COLOR= #007700]];[/COLOR] ?></td>
<td bgcolor="#FFFFFF"><a href="view_topic.php?id=[COLOR= #0000BB]<?[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$rows[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]id[/COLOR][COLOR= #007700]];[/COLOR] ?>">[COLOR= #0000BB]<?[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$rows[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]topic[/COLOR][COLOR= #007700]];[/COLOR] ?></a><BR></td>
<td align="center" bgcolor="#FFFFFF">[COLOR= #0000BB]<?[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$rows[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]view[/COLOR][COLOR= #007700]];[/COLOR] ?></td>
<td align="center" bgcolor="#FFFFFF">[COLOR= #0000BB]<?[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$rows[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]reply[/COLOR][COLOR= #007700]];[/COLOR] ?></td>
<td align="center" bgcolor="#FFFFFF">[COLOR= #0000BB]<?[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$rows[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]datetime[/COLOR][COLOR= #007700]];[/COLOR] ?></td>
</tr>
[COLOR= #0000BB]<?php[/COLOR]
[COLOR= #FF8000]// Exit looping and close connection [/COLOR]
[COLOR= #007700]}[/COLOR]
[URL="http://www.php.net/mysql_close"]mysql_close[/URL][COLOR= #007700]();[/COLOR]
?>
<tr>
<td colspan="5" align="right" bgcolor="#E6E6E6"><a href="create_topic.php"><strong>Create New Topic</strong> </a></td>
</tr>
</table>Spoiler tonen
<table width="400" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
<tr>
<form id="form1" name="form1" method="post" action="add_topic.php">
<td>
<table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF">
<tr>
<td colspan="3" bgcolor="#E6E6E6"><strong>Create New Topic</strong> </td>
</tr>
<tr>
<td width="14%"><strong>Topic</strong></td>
<td width="2%">:</td>
<td width="84%"><input name="topic" type="text" id="topic" size="50" /></td>
</tr>
<tr>
<td valign="top"><strong>Detail</strong></td>
<td valign="top">:</td>
<td><textarea name="detail" cols="50" rows="3" id="detail"></textarea></td>
</tr>
<tr>
<td><strong>Name</strong></td>
<td>:</td>
<td><input name="name" type="text" id="name" size="50" /></td>
</tr>
<tr>
<td><strong>Email</strong></td>
<td>:</td>
<td><input name="email" type="text" id="email" size="50" /></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td><input type="submit" name="Submit" value="Submit" /> <input type="reset" name="Submit2" value="Reset" /></td>
</tr>
</table>
</td>
</form>
</tr>
</table>Spoiler tonen
[COLOR= #0000BB]<?php
$host[/COLOR][COLOR= #007700]=[/COLOR][COLOR= #DD0000]"mysql6.000webhost.com"[/COLOR][COLOR= #007700];[/COLOR] [COLOR= #FF8000]// Host name [/COLOR]
[COLOR= #0000BB]$username[/COLOR][COLOR= #007700]=[/COLOR][COLOR= #DD0000]"a6671097_bram"[/COLOR][COLOR= #007700];[/COLOR] [COLOR= #FF8000]// Mysql username [/COLOR]
[COLOR= #0000BB]$password[/COLOR][COLOR= #007700]=[/COLOR][COLOR= #DD0000]"wachtwoord"[/COLOR][COLOR= #007700];[/COLOR] [COLOR= #FF8000]// Mysql password [/COLOR]
[COLOR= #0000BB]$db_name[/COLOR][COLOR= #007700]=[/COLOR][COLOR= #DD0000]"a6671097_forum"[/COLOR][COLOR= #007700];[/COLOR] [COLOR= #FF8000]// Database name [/COLOR]
[COLOR= #0000BB]$tbl_name[/COLOR][COLOR= #007700]=[/COLOR][COLOR= #DD0000]"forum_question"[/COLOR][COLOR= #007700];[/COLOR] [COLOR= #FF8000]// Table name
// Connect to server and select database.[/COLOR]
[URL="http://www.php.net/mysql_connect"]mysql_connect[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"mysql6.000webhost.com"[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]"a6671097_bram"[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]"wachtwoord"[/COLOR][COLOR= #007700])[/COLOR]or [URL="http://www.php.net/die"]die[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"cannot connect"[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/mysql_select_db"]mysql_select_db[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"a6671097_forum"[/COLOR][COLOR= #007700])[/COLOR]or [URL="http://www.php.net/die"]die[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"cannot select DB"[/COLOR][COLOR= #007700]);[/COLOR]
[COLOR= #FF8000]// get data that sent from form [/COLOR]
[COLOR= #0000BB]$topic[/COLOR][COLOR= #007700]=[/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]topic[/COLOR][COLOR= #007700]];[/COLOR]
[COLOR= #0000BB]$detail[/COLOR][COLOR= #007700]=[/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]detail[/COLOR][COLOR= #007700]];[/COLOR]
[COLOR= #0000BB]$name[/COLOR][COLOR= #007700]=[/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]name[/COLOR][COLOR= #007700]];[/COLOR]
[COLOR= #0000BB]$email[/COLOR][COLOR= #007700]=[/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]email[/COLOR][COLOR= #007700]];[/COLOR]
[COLOR= #0000BB]$datetime[/COLOR][COLOR= #007700]=[/COLOR][URL="http://www.php.net/date"]date[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"d/m/y h:i:s"[/COLOR][COLOR= #007700]);[/COLOR] [COLOR= #FF8000]//create date time[/COLOR]
[COLOR= #0000BB]$sql[/COLOR][COLOR= #007700]=[/COLOR][COLOR= #DD0000]"INSERT INTO $tbl_name(topic, detail, name, email, datetime)VALUES($topic, $detail, $name, $email, $datetime)"[/COLOR][COLOR= #007700];[/COLOR]
[COLOR= #0000BB]$result[/COLOR][COLOR= #007700]=[/COLOR][URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$sql[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$result[/COLOR][COLOR= #007700]){[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"Successful<BR>"[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"<a href=main_forum.php>View your topic</a>"[/COLOR][COLOR= #007700];
}[/COLOR]
[URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"ERROR"[/COLOR][COLOR= #007700];
}[/COLOR]
[URL="http://www.php.net/mysql_close"]mysql_close[/URL][COLOR= #007700]();[/COLOR]
?>Spoiler tonen
[COLOR= #0000BB]<?php
$host[/COLOR][COLOR= #007700]=[/COLOR][COLOR= #DD0000]"mysql6.000webhost.com"[/COLOR][COLOR= #007700];[/COLOR] [COLOR= #FF8000]// Host name [/COLOR]
[COLOR= #0000BB]$username[/COLOR][COLOR= #007700]=[/COLOR][COLOR= #DD0000]"a6671097_bram"[/COLOR][COLOR= #007700];[/COLOR] [COLOR= #FF8000]// Mysql username [/COLOR]
[COLOR= #0000BB]$password[/COLOR][COLOR= #007700]=[/COLOR][COLOR= #DD0000]"wachtwoord"[/COLOR][COLOR= #007700];[/COLOR] [COLOR= #FF8000]// Mysql password [/COLOR]
[COLOR= #0000BB]$db_name[/COLOR][COLOR= #007700]=[/COLOR][COLOR= #DD0000]"a6671097_forum"[/COLOR][COLOR= #007700];[/COLOR] [COLOR= #FF8000]// Database name [/COLOR]
[COLOR= #0000BB]$tbl_name[/COLOR][COLOR= #007700]=[/COLOR][COLOR= #DD0000]"forum_question"[/COLOR][COLOR= #007700];[/COLOR] [COLOR= #FF8000]// Table name
// Connect to server and select database.[/COLOR]
[URL="http://www.php.net/mysql_connect"]mysql_connect[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"mysql6.000webhost.com"[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]"a6671097_bram"[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]"wachtwoord"[/COLOR][COLOR= #007700])[/COLOR]or [URL="http://www.php.net/die"]die[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"cannot connect"[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/mysql_select_db"]mysql_select_db[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"a6671097_forum"[/COLOR][COLOR= #007700])[/COLOR]or [URL="http://www.php.net/die"]die[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"cannot select DB"[/COLOR][COLOR= #007700]);[/COLOR]
[COLOR= #FF8000]// Get value of id that sent from hidden field [/COLOR]
[COLOR= #0000BB]$id[/COLOR][COLOR= #007700]=[/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]id[/COLOR][COLOR= #007700]];[/COLOR]
[COLOR= #FF8000]// Find highest answer number. [/COLOR]
[COLOR= #0000BB]$sql[/COLOR][COLOR= #007700]=[/COLOR][COLOR= #DD0000]"SELECT MAX(a_id) AS Maxa_id FROM $tbl_name WHERE question_id=$id"[/COLOR][COLOR= #007700];[/COLOR]
[COLOR= #0000BB]$result[/COLOR][COLOR= #007700]=[/COLOR][URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$sql[/COLOR][COLOR= #007700]);[/COLOR]
[COLOR= #0000BB]$rows[/COLOR][COLOR= #007700]=[/COLOR][URL="http://www.php.net/mysql_fetch_array"]mysql_fetch_array[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$result[/COLOR][COLOR= #007700]);[/COLOR]
[COLOR= #FF8000]// add + 1 to highest answer number and keep it in variable name "$Max_id". if there no answer yet set it = 1 [/COLOR]
[URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$rows[/COLOR][COLOR= #007700]) {[/COLOR]
[COLOR= #0000BB]$Max_id[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$rows[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]Maxa_id[/COLOR][COLOR= #007700]]+[/COLOR][COLOR= #0000BB]1[/COLOR][COLOR= #007700];
}[/COLOR]
[URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]
[COLOR= #0000BB]$Max_id[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]1[/COLOR][COLOR= #007700];
}[/COLOR]
[COLOR= #FF8000]// get values that sent from form [/COLOR]
[COLOR= #0000BB]$a_name[/COLOR][COLOR= #007700]=[/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]a_name[/COLOR][COLOR= #007700]];[/COLOR]
[COLOR= #0000BB]$a_email[/COLOR][COLOR= #007700]=[/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]a_email[/COLOR][COLOR= #007700]];[/COLOR]
[COLOR= #0000BB]$a_answer[/COLOR][COLOR= #007700]=[/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]a_answer[/COLOR][COLOR= #007700]];[/COLOR]
[COLOR= #0000BB]$datetime[/COLOR][COLOR= #007700]=[/COLOR][URL="http://www.php.net/date"]date[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"d/m/y H:i:s"[/COLOR][COLOR= #007700]);[/COLOR] [COLOR= #FF8000]// create date and time
// Insert answer [/COLOR]
[COLOR= #0000BB]$sql2[/COLOR][COLOR= #007700]=[/COLOR][COLOR= #DD0000]"INSERT INTO $tbl_name(question_id, a_id, a_name, a_email, a_answer, a_datetime)VALUES($id, $Max_id, $a_name, $a_email, $a_answer, $datetime)"[/COLOR][COLOR= #007700];[/COLOR]
[COLOR= #0000BB]$result2[/COLOR][COLOR= #007700]=[/COLOR][URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$sql2[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$result2[/COLOR][COLOR= #007700]){[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"Successful<BR>"[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"<a href=view_topic.php?id="[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$id[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000]">View your answer</a>"[/COLOR][COLOR= #007700];[/COLOR]
[COLOR= #FF8000]// If added new answer, add value +1 in reply column [/COLOR]
[COLOR= #0000BB]$tbl_name2[/COLOR][COLOR= #007700]=[/COLOR][COLOR= #DD0000]"forum_question"[/COLOR][COLOR= #007700];[/COLOR]
[COLOR= #0000BB]$sql3[/COLOR][COLOR= #007700]=[/COLOR][COLOR= #DD0000]"UPDATE $tbl_name2 SET reply=$Max_id WHERE id=$id"[/COLOR][COLOR= #007700];[/COLOR]
[COLOR= #0000BB]$result3[/COLOR][COLOR= #007700]=[/COLOR][URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$sql3[/COLOR][COLOR= #007700]);
}[/COLOR]
[URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"ERROR"[/COLOR][COLOR= #007700];
}[/COLOR]
[COLOR= #FF8000]// Close connection[/COLOR]
[URL="http://www.php.net/mysql_close"]mysql_close[/URL][COLOR= #007700]();[/COLOR]
?>Ik hoop dat iemand me kan helpen!
Groet, Bram.
?
, het aan elkaar verbinden dan.... maar dit is alleen een test uitgave... en trouwens, ik heb nog een bug, probeer maar eens een reply te mkaen op "Test" en weet iemand hoe je het moet indelen in vakken, zoals: Aanbiedingen en Prijsvragen & Contest.... Wat is een XSS injectie?