d22552000 Posted September 2, 2007 Share Posted September 2, 2007 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. Quote Link to comment https://forums.phpfreaks.com/topic/67600-vb-posting/ Share on other sites More sharing options...
trq Posted September 2, 2007 Share Posted September 2, 2007 You have $ in front of your calls to mysql_query() and mysql_close(), these are both functions, not variables. Quote Link to comment https://forums.phpfreaks.com/topic/67600-vb-posting/#findComment-339593 Share on other sites More sharing options...
d22552000 Posted September 2, 2007 Author Share Posted September 2, 2007 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); Quote Link to comment https://forums.phpfreaks.com/topic/67600-vb-posting/#findComment-339594 Share on other sites More sharing options...
trq Posted September 2, 2007 Share Posted September 2, 2007 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; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/67600-vb-posting/#findComment-339598 Share on other sites More sharing options...
d22552000 Posted September 2, 2007 Author Share Posted September 2, 2007 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. Quote Link to comment https://forums.phpfreaks.com/topic/67600-vb-posting/#findComment-339599 Share on other sites More sharing options...
trq Posted September 2, 2007 Share Posted September 2, 2007 Is there a way to NAME my handle to mysql_connect ? Of course... $link = mysql_connect(); Quote Link to comment https://forums.phpfreaks.com/topic/67600-vb-posting/#findComment-339602 Share on other sites More sharing options...
d22552000 Posted September 2, 2007 Author Share Posted September 2, 2007 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. Quote Link to comment https://forums.phpfreaks.com/topic/67600-vb-posting/#findComment-339604 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.