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 373,366 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 3,737 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: 1973 | Replies: 31 | Solved
Reply
Join Date: Feb 2008
Posts: 269
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

  #21  
Mar 27th, 2008
what i want it to do is to display the save data on the page it is being recalled on as it is text for the homepage. it is being saved from an editor into the database and then should display on the pages the text is needed.

the problem is that it is saying that it is saving the data to the database but it will not display the data from the database. it will probably be something which is stupid stoping it from working as it usually is when it comes to code.

fresh eyes looking at it always helps.
Reply With Quote  
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

  #22  
Mar 27th, 2008
You should actually try and avoid using SELECT * and rather list the columns you want to be returned SELECT col1, col2, col3 It just helps speeding things up a bit and you don't have a ton of data flying around the web that you don't need.
Reply With Quote  
Join Date: Nov 2007
Location: Bangalore, India
Posts: 3,026
Reputation: nav33n has a spectacular aura about nav33n has a spectacular aura about 
Rep Power: 8
Solved Threads: 227
nav33n's Avatar
nav33n nav33n is offline Offline
Posting Sensei

Re: MySQL syntax error 1064

  #23  
Mar 27th, 2008
Where are you trying to display the records ?
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,026
Reputation: nav33n has a spectacular aura about nav33n has a spectacular aura about 
Rep Power: 8
Solved Threads: 227
nav33n's Avatar
nav33n nav33n is offline Offline
Posting Sensei

Re: MySQL syntax error 1064

  #24  
Mar 27th, 2008
Originally Posted by RoryGren View Post
You should actually try and avoid using SELECT * and rather list the columns you want to be returned SELECT col1, col2, col3 It just helps speeding things up a bit and you don't have a ton of data flying around the web that you don't need.


Very true. But if you don't know what columns you wanna display and what not, you can use *.
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,026
Reputation: nav33n has a spectacular aura about nav33n has a spectacular aura about 
Rep Power: 8
Solved Threads: 227
nav33n's Avatar
nav33n nav33n is offline Offline
Posting Sensei

Re: MySQL syntax error 1064

  #25  
Mar 27th, 2008
When you use select query, you need to 'fetch' the rows and display it. You do it this way.
  1. <?php
  2. //connect
  3. //select db
  4. $query = "select * from table where id='$id'";
  5. $result = mysql_query($query);
  6. while($row = mysql_fetch_array($result)){
  7. echo $row['firstname'];
  8. echo $row['lastname'];
  9. //etc..
  10. }

Cheers..
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: 269
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

  #26  
Mar 27th, 2008
the record is meant to be displayed within a table on the homepage. i have changed the code now so that it no longer displayed the message something is in the database and just left the new select line in and still nothing is being displayed.

the code for the full page looks looke this

<body onload="MM_preloadImages('global/home_over.gif','global/refurbs_over.gif','global/setups_over.gif','global/contact_over.gif')">
<?php
include ('includes/db_inc.php');
?>
<table width="740" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr>
        <td>&nbsp;</td>
        <td><img src="global/navTop.gif" width="370" height="60" /></td>
    </tr>
    <tr>
        <td><img src="global/logo.gif" alt="CMS Services" width="370" height="65" /></td>
        <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
                <tr>
                    <td><a href="index.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('home','','global/home_over.gif',1)"><img src="global/home_off.gif" alt="Home" name="home" width="370" height="17" border="0" id="home" /></a></td>
                </tr>
                <tr>
                    <td><a href="refurbishment/index.htm" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('refurbs','','global/refurbs_over.gif',1)"><img src="global/refurbs_off.gif" alt="Refurbishment Projects" name="refurbs" width="370" height="15" border="0" id="refurbs" /></a></td>
                </tr>
                <tr>
                    <td><a href="setups/index.htm" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('setups','','global/setups_over.gif',1)"><img src="global/setups_off.gif" alt="Set Ups &amp; Dismantles" name="setups" width="370" height="16" border="0" id="setups" /></a></td>
                </tr>
                <tr>
                    <td><a href="contact/index.htm" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('contact','','global/contact_over.gif',1)"><img src="global/contact_off.gif" alt="Contact CMS Services" name="contact" width="370" height="17" border="0" id="contact" /></a></td>
                </tr>
            </table></td>
    </tr>
    <tr>
        <td><img src="global/navSpacer.gif" width="10" height="20" /></td>
        <td>&nbsp;</td>
    </tr>
    <tr>
        <td><img src="images/img_home.jpg" width="370" height="160" /></td>
        <td><img src="images/header_home.gif" width="370" height="160" /></td>
    </tr>
</table>
<table width="740" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr>
        <td width="185" bgcolor="#F1DECB"><table width="185" border="0" cellspacing="0" cellpadding="10">
            <tr>
                <td bgcolor="#002C54" class="textWhite">&nbsp;</td>
            </tr>
        </table></td>
        <td width="20">&nbsp;</td>
        <td width="535" background="global/pageBg.gif"><table width="95%" border="0" cellspacing="0" cellpadding="0">
            <tr>
                <td>
					<?php
						
						$sql= "SELECT * FROM cms_core WHERE id= '1'";
						$query = mysql_query($sql);
						$result = mysql_fetch_array($query);
						
					?>								
				</td>
            </tr>
        </table></td>
    </tr>
</table>
<table width="740" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr>
        <td><img src="global/footer.gif" width="740" height="70" /></td>
    </tr>
    <tr>
        <td><div align="center">
            <p class="footer">&copy; CMS Services. All rights reserved. </p>
        </div></td>
    </tr>
</table>
</body>
</html>
Reply With Quote  
Join Date: Nov 2007
Location: Bangalore, India
Posts: 3,026
Reputation: nav33n has a spectacular aura about nav33n has a spectacular aura about 
Rep Power: 8
Solved Threads: 227
nav33n's Avatar
nav33n nav33n is offline Offline
Posting Sensei

Re: MySQL syntax error 1064

  #27  
Mar 27th, 2008
In your above script, you are getting the records to $result. But you aren't printing anywhere. Try printing out $result['columnname'] somewhere.
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: 269
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

  #28  
Mar 27th, 2008
just as i posted that last thread i realised that i had not echoed the result anywhere so it could never be displayed without this. i told you it would be something silly and i dont think it can get worse than that.
Reply With Quote  
Join Date: Nov 2007
Location: Bangalore, India
Posts: 3,026
Reputation: nav33n has a spectacular aura about nav33n has a spectacular aura about 
Rep Power: 8
Solved Threads: 227
nav33n's Avatar
nav33n nav33n is offline Offline
Posting Sensei

Re: MySQL syntax error 1064

  #29  
Mar 27th, 2008
Yep! lol.. Sometimes it happens..
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: 269
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

  #30  
Mar 27th, 2008
solved thanks for all your help i felt like punching myself when i seen i did not echo the result.
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:51 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC