User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the MySQL section within the Web Development category of DaniWeb, a massive community of 375,199 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,043 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our MySQL advertiser:
Views: 1994 | Replies: 31 | Solved
Reply
Join Date: Oct 2007
Location: South Africa
Posts: 59
Reputation: RoryGren is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 6
RoryGren's Avatar
RoryGren RoryGren is offline Offline
Junior Poster in Training

Re: MySQL syntax error 1064

  #11  
Mar 27th, 2008
Also -

 if( $res !== "" ) { 
 echo "Nothing in recordset."; 
 } else {
 echo "Something in recordset.";
 } 

You are saying If $res is not == "" then echo "Nothing in Recordset" else ...

So if $res has anything in it, you will get the "Nothing" message.
Reply With Quote  
Join Date: Feb 2008
Posts: 271
Reputation: kevin wood is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 0
kevin wood's Avatar
kevin wood kevin wood is offline Offline
Posting Whiz in Training

Re: MySQL syntax error 1064

  #12  
Mar 27th, 2008
i tried the code you just put up and it gives me the same reply as before telling me there is nothing the database.

how can this be when i test the save to data base and it says it is saving the data that is needed. the as the data is being saved to the database it is stored in a variable called $sContent should i use the variable name when recalling the data in stead of the column name?

i will try this i see what the result is.
Reply With Quote  
Join Date: Feb 2008
Posts: 271
Reputation: kevin wood is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 0
kevin wood's Avatar
kevin wood kevin wood is offline Offline
Posting Whiz in Training

Re: MySQL syntax error 1064

  #13  
Mar 27th, 2008
i have changed the part of the code where it is asked to display the answer if there is something in the record set and changed the editorial to
$sContent
and it now says there is something and the message it leaves looks like this


There is something!CREATE TABLE cms_core ( editroial longblob id int )

why is the create table part showing up is this meant to?
Reply With Quote  
Join Date: Feb 2008
Posts: 271
Reputation: kevin wood is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 0
kevin wood's Avatar
kevin wood kevin wood is offline Offline
Posting Whiz in Training

Re: MySQL syntax error 1064

  #14  
Mar 27th, 2008
i just took the create table from the db set up page and i am now just left with the message


There is something!
Reply With Quote  
Join Date: Nov 2007
Location: Bangalore, India
Posts: 3,057
Reputation: nav33n has a spectacular aura about nav33n has a spectacular aura about 
Rep Power: 8
Solved Threads: 229
nav33n's Avatar
nav33n nav33n is offline Offline
Posting Sensei

Re: MySQL syntax error 1064

  #15  
Mar 27th, 2008
Huh! Can you post your complete code ?
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.

*PM asking for help will be ignored*
Reply With Quote  
Join Date: Nov 2007
Location: Bangalore, India
Posts: 3,057
Reputation: nav33n has a spectacular aura about nav33n has a spectacular aura about 
Rep Power: 8
Solved Threads: 229
nav33n's Avatar
nav33n nav33n is offline Offline
Posting Sensei

Re: MySQL syntax error 1064

  #16  
Mar 27th, 2008
Then obviously, the table has records. What do you want exactly ?
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.

*PM asking for help will be ignored*
Reply With Quote  
Join Date: Feb 2008
Posts: 271
Reputation: kevin wood is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 0
kevin wood's Avatar
kevin wood kevin wood is offline Offline
Posting Whiz in Training

Re: MySQL syntax error 1064

  #17  
Mar 27th, 2008
i need the code to display the item being called for from the database if there is something in the database and i am using the select statement should it not display what is being call for. i will upload the code for the saving and accessing the database. will you need any more?
Reply With Quote  
Join Date: Nov 2007
Location: Bangalore, India
Posts: 3,057
Reputation: nav33n has a spectacular aura about nav33n has a spectacular aura about 
Rep Power: 8
Solved Threads: 229
nav33n's Avatar
nav33n nav33n is offline Offline
Posting Sensei

Re: MySQL syntax error 1064

  #18  
Mar 27th, 2008
And you don't have that syntax error anymore. Right ? Now, if that solves your problem, well and good. If it doesn't, you need to be specific about your problem.
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.

*PM asking for help will be ignored*
Reply With Quote  
Join Date: Feb 2008
Posts: 271
Reputation: kevin wood is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 0
kevin wood's Avatar
kevin wood kevin wood is offline Offline
Posting Whiz in Training

Re: MySQL syntax error 1064

  #19  
Mar 27th, 2008
the code for saving it to the database is

include ('../includes/db_inc.php');

// 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 i have used to recall the data from the database is

$SQL = "SELECT '$sContnet' FROM cms_core WHERE id= '1' ";
      $res = mysql_query($SQL,$db);
      if(mysql_num_rows($res) > 0){
      echo "There is something!";
      } else {
      echo "Nothing !";
      }
 echo $sql;

if you need anymore let me know.
Reply With Quote  
Join Date: Nov 2007
Location: Bangalore, India
Posts: 3,057
Reputation: nav33n has a spectacular aura about nav33n has a spectacular aura about 
Rep Power: 8
Solved Threads: 229
nav33n's Avatar
nav33n nav33n is offline Offline
Posting Sensei

Re: MySQL syntax error 1064

  #20  
Mar 27th, 2008
Update query is correct. But select query is wrong.
  1. SELECT * FROM cms_core WHERE id= '1'

You can use this.
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.

*PM asking for help will be ignored*
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb MySQL Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the MySQL Forum

All times are GMT -4. The time now is 2:27 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC