Jump to content

VB Posting?


d22552000

Recommended Posts

I am trying to make something to post a response to the user's new thread automatically.

 

mysql_connect("localhost", "root", "") or die(mysql_error());
mysql_select_db("forum") or die(mysql_error());

$do = "INSERT INTO `post` (`postid`, `threadid`, `parentid`,  `username`, `userid`, `title`, `dateline`, `pagetext`,
`allowsmilie`, `showsignature`, `ipaddress`, `iconid`, `visible`, `attach`, `infraction`, `reportthreadid`) 
VALUES (postid, ".$threadinfo.", 0, 'Staff Reviewer', 1337, '', now(), 'Thank You for submitting your application.\n\n
It will be reviewed by a staff member As soon as possible, please be patient. ', 0, 0, '1.3.3.7', 4, 1, 0, 0, 0)";
$mysql_query($do);
$mysql_close();

 

I am not sure, but shouldnt that work? I have it set to execute this code AFTER the original post has been posted. When I got to make a new post, I get a blank white page with no redirects. The thread is made but the auto post is NOT posted.

 

I have ran my code though phpmyadmin and it was sucessful.

Link to comment
https://forums.phpfreaks.com/topic/67600-vb-posting/
Share on other sites

oh,. LOL i didnt even noticed I did that! ill run the code again and see what happens:

 

 

it redirects to the new thread so its nto breaking the funciton anymroe, but still no new auto post.

 

mysql_connect("localhost", "root", "") or die(mysql_error());
mysql_select_db("forum") or die(mysql_error());

$do = "INSERT INTO `post` (`postid`, `threadid`, `parentid`,  `username`, `userid`, `title`, `dateline`, `pagetext`,
`allowsmilie`, `showsignature`, `ipaddress`, `iconid`, `visible`, `attach`, `infraction`, `reportthreadid`) 
VALUES (postid, ".$threadinfo.", 0, 'Staff Reviewer', 1337, '', now(), 'Thank You for submitting your application.\n\n
It will be reviewed by a staff member As soon as possible, please be patient. ', 0, 0, '1.3.3.7', 4, 1, 0, 0, 0)";
mysql_query($do);

Link to comment
https://forums.phpfreaks.com/topic/67600-vb-posting/#findComment-339594
Share on other sites

You might try some debugging. The minimum syntax for an insert should be....

 

<?php

  mysql_connect("localhost", "root", "") or die(mysql_error());
  mysql_select_db("forum") or die(mysql_error());

  $do = "INSERT INTO `post` (`postid`, `threadid`, `parentid`,  `username`, `userid`, `title`, `dateline`, `pagetext`,
`allowsmilie`, `showsignature`, `ipaddress`, `iconid`, `visible`, `attach`, `infraction`, `reportthreadid`) 
VALUES (postid, ".$threadinfo.", 0, 'Staff Reviewer', 1337, '', now(), 'Thank You for submitting your application.\n\n
It will be reviewed by a staff member As soon as possible, please be patient. ', 0, 0, '1.3.3.7', 4, 1, 0, 0, 0)";
  if (!mysql_query($do)) {
    echo mysql_error() . "<br />" . $do;
  }

?>

Link to comment
https://forums.phpfreaks.com/topic/67600-vb-posting/#findComment-339598
Share on other sites

I would try this but because VB auto redirects the page I cannot do any debuggingm unless I write all output to a file. It will not show up on screen.

here is what vb does:

 

You fill in info for post at newthread.php

you submit data to newthread.php

newthread.php mulls over the data

you INSTANTLY get redirected to showthread.php regardless if newthread.php is done or not.

 

so I cannot debug it in this way *cry*. I have run the sql through a seperate php document and got no errors so I think my code is somehow stopping cause of how VB is setup..

 

Is there a way to NAME my handle to mysql_connect ?

 

if it wasnt for VB copyright I would paste more of newthread.php.

Link to comment
https://forums.phpfreaks.com/topic/67600-vb-posting/#findComment-339599
Share on other sites

alright imma try that, cause I think my connection is interrupting vb's connection.  Since I don't know to much of VB I can't just use its connection -,-.  Trying code now...

 

$link = mysql_connect("localhost", "root", "") or die(mysql_error());
mysql_select_db("forum",$link) or die(mysql_error());

$do = "INSERT INTO `post` (`postid`, `threadid`, `parentid`,  `username`, `userid`, `title`, `dateline`, `pagetext`,
`allowsmilie`, `showsignature`, `ipaddress`, `iconid`, `visible`, `attach`, `infraction`, `reportthreadid`) 
VALUES (postid, ".$threadinfo.", 0, 'Staff Reviewer', 1337, '', now(), 'Thank You for submitting your application.\n\n
It will be reviewed by a staff member As soon as possible, please be patient. ', 0, 0, '1.3.3.7', 4, 1, 0, 0, 0)";
mysql_query($do,$link);

 

same thing.

Link to comment
https://forums.phpfreaks.com/topic/67600-vb-posting/#findComment-339604
Share on other sites

Archived

This topic is now archived and is closed to further replies.

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