| | |
MySQL syntax error 1064
Please support our MySQL advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
why i am i getting this synyax error when trying to display data from the database
the code for saving the data is
and the code to get the data from the data base is
thanks if anyone can help
the code for saving the data is
MySQL Syntax (Toggle Plain Text)
// save content to db if(isset($_POST["inpContent"])) { $sContent=stripslashes($_POST['inpContent']); // remove slashes (/) $sContent=ereg_replace("'","''",$sContent); // fix SQL $sql="UPDATE cms_core SET editorial='$sContent' WHERE id=$id"; $query = mysql_query($sql); }
and the code to get the data from the data base is
MySQL Syntax (Toggle Plain Text)
$SQL = "SELECT cms_core FROM '$sContent' WHERE id=1"; $res = mysql_query( $SQL, $db ) OR die( "<br><br><b>MySQL Error:</b> " . mysql_errno() . " // " . mysql_error() . "<br><br>" ); if( $res !== "" ) { echo "Nothing in recordset."; } ELSE { echo "Something in recordset."; }
Syntax error while updating the record or while fetching ?
cms_core ? is it a table or a column name ?
•
•
•
•
$SQL = "SELECT cms_core FROM '$sContent' WHERE id=1";
•
•
•
•
$sql="UPDATE cms_core SET editorial='$sContent' WHERE id=$id";
Ignorance is definitely not bliss!
*PM asking for help will be ignored*
*PM asking for help will be ignored*
i am no getting a different problem with error codes. cmsservdb is the database cms_core is the table name and editorial is the coloum name. my database sewtup looks like this
and the error message i am getting now on the page that is recalling the data is
MySQL Error: 1146 // Table 'cmsservdb.editroial' doesn't exist
the code used to access this data is
MySQL Syntax (Toggle Plain Text)
<?php $db = mysql_connect("xxxxxxxx","xxxxx","xxxx"); mysql_select_db("cmsservdb", $db); // CREATE TABLE IN my_db database mysql_select_db("cmsserdb"); $sql = "CREATE TABLE cme_core ( editroial longblob )"; mysql_query($sql); ?>
and the error message i am getting now on the page that is recalling the data is
MySQL Error: 1146 // Table 'cmsservdb.editroial' doesn't exist
the code used to access this data is
MySQL Syntax (Toggle Plain Text)
$SQL = "SELECT * FROM editorial WHERE id= 1 "; $res = mysql_query( $SQL, $db ) OR die( "<br><br><b>MySQL Error:</b> " . mysql_errno() . " // " . mysql_error() . "<br><br>" ); if( $res !== "" ) { echo "Nothing in recordset."; } ELSE { echo "Something in recordset."; }
i have just edited the code used to recall the data so it looks like this and the error has gone it now tells me there is nothing in the record set.
the code looks like this
the code looks like this
MySQL Syntax (Toggle Plain Text)
$SQL = "SELECT editorial FROM cms_core WHERE id= 1 "; $res = mysql_query( $SQL, $db ) OR die( "<br><br><b>MySQL Error:</b> " . mysql_errno() . " // " . mysql_error() . "<br><br>" ); if( $res !== "" ) { echo "Nothing in recordset."; } ELSE { echo "Something in recordset."; }
$res will have the resource_id of the query you just executed. You can check if there are any records or not this way.
php Syntax (Toggle Plain Text)
$res = mysql_query($SQL,$db); if(mysql_num_rows($res) > 0){ echo "There is something!"; } else { echo "Nothing !"; }
Ignorance is definitely not bliss!
*PM asking for help will be ignored*
*PM asking for help will be ignored*
i echoed the $sql on both the pages and on the page where the data is being recall it gave the
Nothing in recordset.CREATE TABLE cms_core ( editroial longblob id int )
and when i echoed the $sql on the page where it is saving it gave me
UPDATE cms_core SET editorial='
then all the text that is being saved to the database with
WHERE id=$id
after the text.
it looks like the data is being saved to the database but why can i not recall the data on the other page.
Nothing in recordset.CREATE TABLE cms_core ( editroial longblob id int )
and when i echoed the $sql on the page where it is saving it gave me
UPDATE cms_core SET editorial='
then all the text that is being saved to the database with
WHERE id=$id
after the text.
it looks like the data is being saved to the database but why can i not recall the data on the other page.
![]() |
Similar Threads
- MySQL installation problem (*nix Software)
- Problem with MySQL Query (Database Design)
- mysql loading txt file to mysql db????????? (MySQL)
- inserting checkbox values in mysql +PHP (PHP)
- MySQL/PHP UPDATE Syntax error (MySQL)
- php and mysql insert...where making me tear my hairs out!!! help!!! (PHP)
- Please help me out with MySQL query (MySQL)
- Error "Syntax" (Windows 95 / 98 / Me)
Other Threads in the MySQL Forum
- Previous Thread: Access denied when connecting to db
- Next Thread: i need help
| Thread Tools | Search this Thread |
1 agplv3 alfresco amazon api artisticlicense aws bizspark breathalyzer camparingtocolumns cmg communityjournalism contentmanagement contractors copyright count court data database design developer development distinct drupal dui ec2 email enter enterprise error eudora facebook form foss gnu government gpl greenit groklaw hiring hyperic images innerjoins insert ip joebrockmeier join journalism keyword keywords kickfire law legal license licensing maintenance managing mariadb matchingcolumns metron micromanage microsoft microsoftexchange mindtouch montywidenius mozilla multiple music mysql mysqlcolumnupdating mysqldatetimeordermax() mysqlindex mysqlinternalqueries mysqlquery mysqlsearch news open-xchange opendatabasealliance opengovernment opensource oracle penelope php query referencedesign reorderingcolumns resultset saas select sharepoint simpledb sourcecode spotify sql sugarcrm syntax techsupport thunderbird transparency virtualization






