So basically I’m trying to create my own message board.. just very simple features like CL has.. so here’s my thought process:
newmessagepost.php
(form data here that gets passed to process.php)
process.php
$_post data from newmessagepost.php gets inputted into database.
so because its a new message post, i will run two queries.. one that inputs the topic title and userid into a table called “mbtopics”. and then from there the auto increment will give each new “thread” a unique ID.
then i will run another query that pulls that unique ID that was created and input the first “post” in based on the topic ID.
well here is my code… am i off track?
[CODE]mysql_connect(“xxx”, “xxxxxx”, “xxx”);
mysql_select_db(“xxxx”);
$query = “INSERT INTO mbtopics (tc,title) VALUES (‘$uid’, ‘$topic’)”;
$result = mysql_query($query) or die (‘Error: ‘.mysql_error ());
while($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
$mbid= $row[‘mbid’];
}
$query2 = “INSERT INTO topic (mbid,poster,post) VALUES (‘$mbid’, ‘$uid’, ‘$message’)”;
$result2 = mysql_query($query2);
?>
If someone can please help.. i would REALLY appreciate it…
problems:
1) not sure if this whole thing is flawed logic
2) on this line [COLOR=”DarkGreen”]“while($row = mysql_fetch_array($result, MYSQL_ASSOC))”[COLOR=”Red”]Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource
3) its not pulling the mbid correctly int he second query… its coming up as “0”
Thanks in advance..