Jump to content

help please


adamdidthis

Recommended Posts

Where am I going wrong with this:

[code]mysql_connect("localhost","root","")or die(mysql_error);
mysql_select_db("joomla")or die(mysql_error);

$result1 = mysql_query("SELECT * FROM pn_v4b_journal_journal")or die(mysql_error);

while($row = mysql_fetch_array($result1)or die(mysql_error)){

if (isset($row['jjo_image'])){
$message = "<p><img height=\"38\" hspace=\"0\" src=\"images/stories/".$row['jjo_image']."></p>";
}else{
$message = $row['bodytext'];
}


$result2 = mysql_query("INSERT INTO jos_content (title, title_alis, introtext, fulltext, state, sectionid, mask, catid, created, created_by, created_by_alis, modified, modified_by, checked_out, checked_out_time, publish_up, publish_down, images, urls, attribs, version, parent_id, ordering, metakey, metadesc, access, hits) VALUES ("$row['jjo_title']","","","$message","1","3","0","10","$row['jjo_cr_date']","$row['jjo_owner_uid']","","$row['jjo_lu_date']","$row['jjo_lu_uid']","0","","","","","","allowcomments=0 showcomments=0","1","0","0","","","","0")")or die(mysql_error);

}[/code]

I keep getting:

Parse error: parse error, unexpected T_VARIABLE in on line 17
Link to comment
https://forums.phpfreaks.com/topic/35727-help-please/
Share on other sites

Try it this way:
[code]<?php
$q = "INSERT INTO jos_content (title, title_alis, introtext, fulltext, state, sectionid, mask, catid, created, created_by,
        created_by_alis, modified, modified_by, checked_out, checked_out_time, publish_up, publish_down, images, urls,
        attribs, version, parent_id, ordering, metakey, metadesc, access, hits) VALUES
        ('{$row['jjo_title']}', '', '', '$message', '1', '3', '0', '10', '{$row['jjo_cr_date']}', '{$row['jjo_owner_uid']}', '',
        '{$row['jjo_lu_date']}', '{$row['jjo_lu_uid']}', '0', '', '', '', '', '','allowcomments=0 showcomments=0', '1', '0', '0', '', '', '',
        '0')";
$result2 = mysql_query($q)or die("Problem with the query:<pre>$q</pre><br>" . mysql_error());
?>[/code]

Ken
Link to comment
https://forums.phpfreaks.com/topic/35727-help-please/#findComment-169520
Share on other sites

OK have sorted that but its now doing :

Problem with the query:<pre>INSERT INTO jos_content (title, title_alis, introtext, fulltext, state, sectionid, mask, catid, created, created_by, created_by_alis, modified, modified_by, checked_out, checked_out_time, publish_up, publish_down, images, urls, attribs, version, parent_id, ordering, metakey, metadesc, access, hits) VALUES      ('Line up', '', '', '<p><img height="38" hspace="0" src="images/stories/88986284dECkQq_ph.jpeg></p>', '1', '3', '0', '10', '2003-10-23 07:17:12', '14', '', '2003-10-23 21:50:47',  '14', '0', '', '', '', '', '','allowcomments=0 showcomments=0', '1', '0', '0', '', '', '', '0')</pre><br>You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'fulltext, state, sectionid, mask, catid, created, created_by, created_by_alis, m' at line 1[
Link to comment
https://forums.phpfreaks.com/topic/35727-help-please/#findComment-169526
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.