•
•
•
•
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
![]() |
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.
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.
•
•
Join Date: Nov 2007
Location: Bangalore, India
Posts: 3,026
Reputation:
Rep Power: 8
Solved Threads: 227
•
•
Join Date: Nov 2007
Location: Bangalore, India
Posts: 3,026
Reputation:
Rep Power: 8
Solved Threads: 227
•
•
•
•
You should actually try and avoid usingSELECT *and rather list the columns you want to be returnedSELECT col1, col2, col3It 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*
*PM asking for help will be ignored*
•
•
Join Date: Nov 2007
Location: Bangalore, India
Posts: 3,026
Reputation:
Rep Power: 8
Solved Threads: 227
When you use select query, you need to 'fetch' the rows and display it. You do it this way.
Cheers..
php Syntax (Toggle Plain Text)
<?php //connect //select db $query = "select * from table where id='$id'"; $result = mysql_query($query); while($row = mysql_fetch_array($result)){ echo $row['firstname']; echo $row['lastname']; //etc.. }
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*
*PM asking for help will be ignored*
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
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> </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 & 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> </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"> </td>
</tr>
</table></td>
<td width="20"> </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">© CMS Services. All rights reserved. </p>
</div></td>
</tr>
</table>
</body>
</html>•
•
Join Date: Nov 2007
Location: Bangalore, India
Posts: 3,026
Reputation:
Rep Power: 8
Solved Threads: 227
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*
*PM asking for help will be ignored*
•
•
Join Date: Nov 2007
Location: Bangalore, India
Posts: 3,026
Reputation:
Rep Power: 8
Solved Threads: 227
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb MySQL Marketplace
- 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)
- MySQL installation problem (*nix Software)
- Problem with MySQL Query (Database Design)
- Please help me out with MySQL query (MySQL)
- Error "Syntax" (Windows 9x / Me)
Other Threads in the MySQL Forum
- Previous Thread: Access denied when connecting to db
- Next Thread: i need help



Linear Mode