Jump to content

Need PHP Database Help


TM3909

Recommended Posts

Hey all, I'm fairly new and need a little bit of help. I have a user submit data via a form, then it goes into the database, is pulled out, reformatted, and put back in into another table.

 

All of this works, until I get to the putting it back formatted. You can see the code here:

 

http://snipplr.com/view/16708/php-help/

 

and the issue starts at about line 56 I want to say.

 

Any help would be amazing, I've been coding for 10+ hours and need the help!!!

 

 

Link to comment
https://forums.phpfreaks.com/topic/165015-need-php-database-help/
Share on other sites

You cannot assign an echo to a variable.

$post_title = echo $rev_title;
$post_author = echo "7";
$post_content = echo $all;
$post_type = echo "post";
$post_status = echo "publish";
$comment_status = echo "publish";
$post_date_gmt = echo $gmtdate;
$post_date = echo $date;
$post_category = echo "1";

 

The correct syntax for defining variables is

$myVariable = 'somevalue';

// or

$myVariable = $someOtherVariable

 

You also do not need to keep connecting to/closing mysql everytime you perform a MySQL query. You should only connect once at the start of the script and close then connection at the end of the script (however PHP will automaitcally close the connection once the script has been processed).

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.