Jump to content

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).

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.