Jump to content

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

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.