• 0

Cant grab urls from mysql db to display images


Question

My guestbook(http://adamb10.com/book) is going to let people edit those images u see in the menu bar. The problem is it's not quite working. :p

Click the link above and click Login

Username/pw is admin/3218812

Click Home followed by Admin.

Click Layout & Colors, finally click Edit/Change images.

For some reason the images wont display. :(

The code for the file...changeimages.php...:

<?

/*

+-------------------------------------------------------

|	UltraBook 1.1

|	==============================

|	by Adam Bailey

|	(c)Copyright Adam Bailey

|	http://adamb10.com

|	==============================

+-------------------------------------------------------

|

|  > Edit Images Frontend

|  > Written by Adam bailey

|  > Date started: Friday January 20, 2005

|

+-------------------------------------------------------

*/
error_reporting (E_ALL);
//Connect to the databas

database_connect();
//Grab the title of the guestbook

	$sql = "SELECT title FROM settings";

$result = mysql_query ($sql);

$row = mysql_fetch_array ($result);
//Header for the guestbook(real creative name I know =D)

guestbook_header();
//Grab everything from the customize table

$image1 = "SELECT * FROM customize";


$image2 = mysql_query ($image1);


$image = mysql_fetch_array ($image2, MYSQL_ASSOC);


echo '



<br>



<br>



<br>';
//Is the user logged in?

if(session_is_registered('Password')){

	adminpanel_side();

	echo '

<td>



	  <h3 style="text-align: center;"><span style="font-weight: bold;">Change Images</span></h3>



<p align=center>Change the default images to whatever you want.</p><span style="font-weight: bold;"><br>



	  <br>



		   <form method="post" action="?action=saveimages" name="saveimages" >

		   <img src="'.$image['homeimage'].'"><input size="30" name="homeimage" value="'.$image['homeimage'].'"><br><br>
<img src="'.$image['loginimage'].'"><input size="30" name="loginimage" value="'.$image['loginimage'].'"><br><br>
<img src="'.$image['logoutimage'].'"><input size="30" name="logoutimage" value="'.$image['logoutimage'].'"><br><br>
<img src="'.$image['adminimage'].'"><input size="30" name="adminimage" value="'.$image['adminimage'].'"><br><br>
<img src="'.$image['newpostimage'].'"><input size="30" name="newpostimage" value="'.$image['newpostimage'].'"><br><br>


		  <div style="text-align: center;"><input value="Save" type="submit"></div>

		  <br>

		  </form>



 </tr>



	  </tbody>

</table>

';

} else {
//User is NOT logged in?  OK, display this then! 

	echo '<table class="border" style="width: 25%; text-align: left; margin-left: auto; margin-right: auto;" border="0" cellpadding="4" cellspacing="1" class="border">



  <tbody>



	<tr class="titlebg">



	  <td>Error</td>



	</tr>



	<tr class="windowbg2">



	  <td>You are not allowed to access this area.<br>



	  </td>



	</tr>



  </tbody>

</table>';

}
//Stealing is bad kids
copyright();

?>
</body>
</html>

THANKS!! :)

13 answers to this question

Recommended Posts

  • 0

Until I can see the table structure for the customize table there is not much that can be changed. Anyways for now try and use:

<?
/*
+-------------------------------------------------------
|	UltraBook 1.1
|	==============================
|	by Adam Bailey
|	(c)Copyright Adam Bailey
|	http://adamb10.com
+-------------------------------------------------------
|
|  > Edit Images Frontend
|  > Written by Adam bailey
|  > Date started: Friday January 20, 2005
|
+-------------------------------------------------------
*/

error_reporting (E_ALL);

//Connect to the databas
database_connect();

//Grab the title of the guestbook
$result = mysql_query ("SELECT `title` FROM `settings` LIMIT 1;");
$row = mysql_fetch_array ($result);

//Header for the guestbook(real creative name I know =D)
guestbook_header();

//Grab everything from the customize table
$get_image = mysql_query ("SELECT * FROM `customize` LIMIT 1");
$image = mysql_fetch_array ($get_image);


echo '<br><br><br>';

//Is the user logged in?
if(session_is_registered('Password')){
	adminpanel_side();

	echo '<td>
			<h3 style="text-align: center;"><span style="font-weight: bold;">Change Images</span></h3>
			<p align=center>Change the default images to whatever you want.</p><span style="font-weight: bold;"><br>
			<br>

			<form method="post" action="?action=saveimages" name="saveimages" >

		   	<img src="'.$image['homeimage'].'"><input size="30" name="homeimage" value="'.$image['homeimage'].'"><br><br>
			<img src="'.$image['loginimage'].'"><input size="30" name="loginimage" value="'.$image['loginimage'].'"><br><br>
			<img src="'.$image['logoutimage'].'"><input size="30" name="logoutimage" value="'.$image['logoutimage'].'"><br><br>
			<img src="'.$image['adminimage'].'"><input size="30" name="adminimage" value="'.$image['adminimage'].'"><br><br>
			<img src="'.$image['newpostimage'].'"><input size="30" name="newpostimage" value="'.$image['newpostimage'].'"><br><br>
			<div style="text-align: center;"><input value="Save" type="submit"></div><br>

			</form>

		</tr>
	</tbody>
</table>';

} else {

	// User is NOT logged in?  OK, display this then! 
	echo '<table class="border" style="width: 25%; text-align: left; margin-left: auto; margin-right: auto;" border="0" cellpadding="4" cellspacing="1" class="border">
			  <tbody>
			 <tr class="titlebg">
			  <td>Error</td>
			 </tr>
			 <tr class="windowbg2">
			  <td>You are not allowed to access this area.<br></td>
			 </tr>
			</tbody>
		</table>';
}

//Stealing is bad kids
copyright();

?>

  • 0

are the images stored in another folder?

and by looking at that db pic the fields are blank anyways? can u give us an example on what is actually in the field, is it simply 'homeimage.gif'? or 'http://adamb10.com/book/homeimage.gif'?

because when viewing the site it has the link to the folder but nothing added on the end, that is to say the image is linking to http://adamb10.com/book/ and missing homeimage.gif...which makes me wonder if its even in the db?

  • 0

Try this script and see if you get the image urls in the output:

<?
/*
test script
*/

error_reporting (E_ALL);

//Connect to the databas
database_connect();

//Grab everything from the customize table
$get_image = mysql_query ("SELECT * FROM `customize` LIMIT 1") or die( "MySQL Error: " . mysql_error() );
$image = mysql_fetch_array($get_image, MYSQL_ASSOC)  or die( "MySQL Error: " . mysql_error() );

echo "<pre>";
var_dump( $image );
echo "</pre>";

?>

if it doesn't output, try again with this one:

<?
/*
test script
*/

error_reporting (E_ALL);

//Connect to the databas
database_connect();

//Grab everything from the customize table
$get_image = mysql_query ("SELECT * FROM `customize`") or die( "MySQL Error: " . mysql_error() );
$offset = 0;
while( $image = mysql_fetch_array($get_image, MYSQL_ASSOC) ) {
	echo "<pre>";
	echo "Result Number: $offset \n";
	var_dump( $image );
	echo "</pre>";
	$offset++;
}

?>

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Posts

    • Thank you for replying! Is MP600 also good? Where I'm looking they don't have MP700. I was also looking at Corsair T500, that comes with heatsink.
    • As someone who was born in 1980, I’m feeling this.
    • Amazon Deal: This Vifa Stockholm 2.0 is one of the best sounding bluetooth speakers by Sayan Sen A few days back we covered some great JBL bluetooth speaker deals across several of its popular models. The discounts are still live and you can check them out in this dedicated piece. Meanwhile for those who prefer more powerful home cinema sound systems, Nakamichi and Samsung are offering the Dragon and Shockwafe models, and the Q-series models, respectively, at their best ever prices. However, if you are someone who is looking for a bit of both, the portability of a bluetooth speaker and the fidelity of a good sounding hi-fi system then the Vifa Stockholm 2.0 Bluetooth Soundbar is something you should look at as it's currently a nice deal (purchase link under the specs table below). While you are not getting a subwoofer with the Vifa Stockholm as it is a 2.0 system, Vifa promises lows down to 42 Hz at +3dB and that should be pretty good for a device lacking a dedicated bass unit; it does pack passive radiators to help with the bass. The Stockholm 2.0 is praised for its sound quality (SQ) and one of the reasons behind it is becasue it has three-way drivers. The technical specifications of the Vifa Stockholm 2.0 Bluetooth Soundbar are given below: Specification Frequency Response 42 Hz – 20 kHz @ ±3 dB Materials Frame: One-piece die-cast aluminium; Enclosure: ABS reinforced; Grills: Kvadrat textile Connectivity Bluetooth® Qualcomm aptX™ HD audio; Wi-Fi Direct & networked (2.4 GHz); Wired optical or analog (3.5 mm mini-jack); USB-disk; Vifa®HOME, Vifa®LINK, Vifa®PLAY Driver Units Tweeter: 2 × 28 mm soft-dome drivers; Midrange: 2 × 80 mm aluminium-cone drivers; Woofer: 4 × 100 mm flat sandwich-cone drivers (force-balanced, backed by 4 passive radiators) Other Features Apple AirPlay & DLNA streaming; DSP signal processing; 6-channel high-performance power amplifier Get it at the link below: Vifa Stockholm 2.0 Bluetooth Soundbar, Nordic Design Soundbar, Smart APP Multi-Room System (Slate Black): $1156.99 (Sold and Shipped by Amazon US) This Amazon deal is US-specific and not available in other regions unless specified. If you don't like it or want to look at more options, check out the Amazon US deals page here. Get Prime (SNAP), Prime Video, Audible Plus or Kindle / Music Unlimited. Free for 30 days. As an Amazon Associate, we earn from qualifying purchases.
    • Explzh 9.81 by Razvan Serea Explzh is a free Windows archive manager for creating, extracting and managing archives. The program supports many different types of archives, including zip, 7z, rar, tar, ace, lzh, arj, cab, iso, img, msi, sfx and more. Apart from archive creation and extraction, you will also be able to verify compressed data for errors, initiate repair routines, split data into multiple items, and more. It additionally allows you to password protect your data and attach digital signatures to files. Key features of Explzh: Explorer-like GUI and operability. LHA, ZIP (ZIPX), JAR, CAB, RAR, TAR, TAR.XXX, 7z, ARJ, WIM, CHM, PE, HFS, NSIS Format Installer, ISO, InstallShield, MSI, and several other formats... Support for more archive formats by introducing the integrated archiver DLL. Self-extracting archive creation function that can create high-performance automatic installers. Digital signature addition function to created self-extracting archive. Office 2007 or later document compression / image optimization re-archiving function. Supports compression and decompression of Unicode file names. Supports compression and expansion exceeding 4GB. AES encryption function. You can create a robust secure ZIP encryption archive. Thumbnail function of image file. In-library file search function. . Equipped with archive file conversion function. File split function. The split file has a self-consolidation function, and can concatenate files larger than 4GB. (No need for batch file or connection software) UU (XX) Encode, Base64 decode function. FTP upload function Supports Windows 11 shell integration extended context menu. Explzh 9.81 changelog: Improved to send update notifications to the shell when making changes such as additional compression to existing zip and 7-zip files. This also updates the Explorer view of the open file in real time. (If the drop target feature is enabled, you can easily create an encrypted ZIP by dragging and dropping onto the ZIP icon while holding down the Ctrl key.) When the zip drop target setting is enabled, the "Compressed (zipped) Folder" item will be added to the "New" shell context menu if it does not already exist. Password manager bug fix: Fixed a bug that caused the app to crash when reading password.dat (password data) when changing authentication method. Updated to Visual Studio 2022 v.17.14.9. Download: Explzh 64-bit | Explzh 32-bit | ~6.0 MB (Freeware) Download: Explzh ARM64 | 5.9 MB View: Explzh Home Page | Screenshot | Themes Get alerted to all of our Software updates on Twitter at @NeowinSoftware
  • Recent Achievements

    • Week One Done
      Snake Doc earned a badge
      Week One Done
    • One Month Later
      Johnny Mrkvička earned a badge
      One Month Later
    • Week One Done
      Sender88 earned a badge
      Week One Done
    • Dedicated
      Daniel Pinto earned a badge
      Dedicated
    • Explorer
      DougQuaid went up a rank
      Explorer
  • Popular Contributors

    1. 1
      +primortal
      605
    2. 2
      Michael Scrip
      200
    3. 3
      ATLien_0
      190
    4. 4
      +FloatingFatMan
      138
    5. 5
      Xenon
      125
  • Tell a friend

    Love Neowin? Tell a friend!