Ok guys/girls, I been killing myself over this all morning.
This is what i'm trying to do, I need html to show up on another page, so I make an admin panel where someone puts in an ID an a Name.
This is what the code is,
The config has the mysql info. I can send the info the db and everything else fine, my problem is the variable $id2.
I need variable $id and $name to be in it (as you can see) and to send to the mysql as it's doing.
I know $id2 is a bit messy but I am getting all sorts of erorrs on strings/etc. I tried many different ways, but I need it to have " and not ', so it can be readable when i put the viarable in a php (eg, <? echo "$id"; ?>) and taking it from the database.
Any help would be appreciated
Thanks.
This is what i'm trying to do, I need html to show up on another page, so I make an admin panel where someone puts in an ID an a Name.
This is what the code is,
Code:
<?php
include ("config.php");
//initilize PHP
if($_POST['submit']) //If submit is hit
{
//convert all the posts to variables:
$name = $_POST['name'];
$id = $_POST['id'];
$id2 = "<tr>
<td width='55'><div align='center'><img src='nonew.png' width='32' height='32'></div></td>
<td width='345'><a href='vforum.php?id=$id' style='font-family: Arial, Helvetica, sans-serif; font-size: 12px'><font color='#333333'>$name</font></a></td>
<td width='60'><div align='center' style='font-family: Arial, Helvetica, sans-serif; font-size: 12px'>
<?=mysql_num_rows(mysql_query('SELECT * FROM `thread` WHERE fid =$id'))?>
</div></td>
<td><div align='center' style='font-family: Arial, Helvetica, sans-serif; font-size: 12px'>
<?=mysql_num_rows(mysql_query('SELECT * FROM `reply` WHERE fid =$id'))?>
</div></td>
<td>
<span style='font-family: Arial, Helvetica, sans-serif; font-size: 12px'>
<?php
$last_thread_info = mysql_fetch_array(mysql_query('SELECT * FROM `thread` WHERE fid = '$id' ORDER BY `id` ASC LIMIT 1'));
$last_reply_query = mysql_query('SELECT * FROM `reply` WHERE topicid = '$last_thread_info[id]' ORDER BY `id` ASC LIMIT 1');
if (mysql_num_rows($last_reply_query) > 0){
$last_reply_info = mysql_fetch_array($last_reply_query);
echo 'By ".stripslashes($last_reply_info["author"])." At ".$last_reply_info["date"]';
}
else {
echo "By ".stripslashes($last_thread_info["author"])." At ".$last_thread_info["date"];
}
?>
</span> </td>
</tr>";
//Insert the values into the correct database with the right fields
//mysql table = news
//table columns = id, title, message, who, date, time
//post variables = $title, $message, '$who, $date, $time
$result=MYSQL_QUERY("INSERT INTO forums (id,name)".
"VALUES ('NULL', '$id2', '$name')");
mysql_query("INSERT INTO `forums` ( `id` , `name` ) VALUES ('$id2', '$name')") or die(mysql_error());
//confirm
echo "Query Finished";
}
else
{
// close php so we can put in our code
?>
<form method="post" action="send.php">
<TABLE>
<TR>
<TD>ID:</TD>
<TD><INPUT TYPE='TEXT' NAME='id' VALUE='' size=60></TD>
</TR>
<TR>
<TD colspan="2"><strong>Please use a number higher than the previous forum. Example, your first forum is 1, your second would be 2, 3, and so on. Mixing up your id's may cause problems.</strong></TD>
</TR>
<TR>
<TD>Forum Name :</TD>
<TD><INPUT TYPE='TEXT' NAME='name' VALUE='' size=60></TD>
</TR><br>
<TR>
<TD></TD><br>
<TD><INPUT TYPE="submit" name="submit" value="submit"></TD>
</TR>
</TABLE>
</form>
<?
} //close the else statement
?>
<?
The config has the mysql info. I can send the info the db and everything else fine, my problem is the variable $id2.
I need variable $id and $name to be in it (as you can see) and to send to the mysql as it's doing.
I know $id2 is a bit messy but I am getting all sorts of erorrs on strings/etc. I tried many different ways, but I need it to have " and not ', so it can be readable when i put the viarable in a php (eg, <? echo "$id"; ?>) and taking it from the database.
Any help would be appreciated
Thanks.







