Jump to content

What is wrong here


Ashoar

Recommended Posts

  • Replies 71
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

<?php

include "config.php"; 

$TEST=mysql_query("SELECT forumid FROM post_reply");

if (!$TEST){die(mysql_error());}

$num_rows = mysql_num_rows($TEST);

echo "I have $num_rows in the row forumid and here they are:<br /><br /><br />";

WHILE($row=mysql_fetch_array($TEST)){
$forumid=$row['forumid'];

if ($num_rows=="0"){

echo"
connecting to the wrong DB<br />
AND / OR<br />
connecting to the wrong table<br />
AND / OR<br />
forumid is empty<br />
";


}else {$forumid."<br />";}



}

// CLOSE YOUR CONNECTION??

?>

Link to comment
Share on other sites

Sorry, thought you wanted to see another text row.

 

Not to sure how to get that from inside the db, never had to do it before.

How do i? :)

 

EDIT: Only 1 column name forumid.

I have another table with a column called forum_id though, that table is used to create the boards through the admin panel, the id on that is used in the url to access it. e.g. board.php?id=3

Link to comment
Share on other sites

Then I am pretty sure forumid is empty.  The problem must be on post.

 

On your post page...

 

change:


$insertpost="INSERT INTO post_reply(author,title,post,forumid,showtime,realtime,lastposter) values('$name','$subject','$yourpost','$forumid','$displaytime','$thedate','$name')";

mysql_query($insertpost) or die("Could not insert post"); 

 

To:


$insertpost=mysql_query("INSERT INTO post_reply(author,title,post,forumid,showtime,realtime,lastposter) values('$name','$subject','$yourpost','$forumid','$displaytime','$thedate','$name')";

if (!$insertpost){die(mysql_error());}

 

 

 

Try this.

Link to comment
Share on other sites

Now I know it's empty.

 

You are inserting blank values int the row forumid...

 


$forumid = $_GET['id']; // THIS MIGHT APPLY TO SOMETHING ELSE BUT NOT ON SUBMIT


if(isset($_POST['submit']))

{
   $forumid=$_POST['forumid']; // YOUR VAR WAS EMPTY

   $name=$_POST['name'];

   $yourpost=$_POST['yourpost'];

   $subject=$_POST['subject'];

 

You have 4 empty rows.

Link to comment
Share on other sites

"Parse error: syntax error, unexpected ';' "

 

That is the one at the end of the mysql query.

 

If i remove it i get:

 

"Parse error: syntax error, unexpected T_IF"

 

-------

 

Added in the blank variable bit you mentioned and used the original post page.

Still now threads showing though.

 

EDIT:

$forumid = $_GET['id']; // THIS MIGHT APPLY TO SOMETHING ELSE BUT NOT ON SUBMIT

 

That is used to grab the ID from the url.

Link to comment
Share on other sites

here is the right code

 

$insertpost=mysql_query(" INSERT INTO post_reply(author,title,post,forumid,showtime,realtime,lastposter) values('$name','$subject','$yourpost','$forumid','$displaytime','$thedate','$name') ");

if (!$insertpost){die(mysql_error());}

Link to comment
Share on other sites

$forumid=$_POST['forumid']; // TAKE IT OUT

 

Stupid mistake on my part put this on the test page:

 


<?php

include "config.php"; 

$TEST=mysql_query("SELECT yourpost FROM post_reply");

if (!$TEST){die(mysql_error());}

$num_rows = mysql_num_rows($TEST);

echo "I have $num_rows in the row forumid and here they are:<br /><br /><br />";

WHILE($row=mysql_fetch_array($TEST)){

$yourpost=$row['yourpost'];

echo $yourpost."<br />";



}

// CLOSE YOUR CONNECTION??

?>

 

Why is your forumid a text field?

I imagine (since you can't get to phpAdmin) that $yourpost is a text field

Link to comment
Share on other sites

I assumed it would be the easiest mysql row to use, which is why i asked earlier if it was the correct one.

 

Now i get:

"Unknown column 'yourpost' in 'field list'"

 

I have no row called yourpost, the row for that is post, it is mediumtext.

 

EDIT: i know that, that row have data because if i remove or the id stuff and don't try to fetch it with the id, all the posts show up, just they show up in all the forums as well as the one it was posted in.

Link to comment
Share on other sites

<?php

include "config.php"; 

$TEST=mysql_query("SELECT post FROM post_reply");

if (!$TEST){die(mysql_error());}

$num_rows = mysql_num_rows($TEST);

echo "I have $num_rows in the row forumid and here they are:<br /><br /><br />";

WHILE($row=mysql_fetch_array($TEST)){

$post=$row['post'];

echo $post."<br />";



}

// CLOSE YOUR CONNECTION??

?>

Link to comment
Share on other sites

Fetched each test post i have made.

 

I have 6 in the row forumid and here they are:


This better work now.
Ok almost got this working.
Still not working
Getting on my nerves
Should work now
this better work now

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • 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.