May someone help me correct this script? there a few ' and " and ; in the wrong places: -
<?php
-
include "./comm.inc";
-
connectdb();
-
$sql = "SELECT imgid,imgtype FROM tblimage ORDER BY imgid";
-
-
$result = @mysql_query($sql) or die(mysql_error());
-
-
echo '<table border=1>n';
-
echo '<tr><th>imgid</th><th>imgtype</th><th>imgdata</th></tr>n';
-
while ($rs=mysql_fetch_array($result)) {
-
echo '<tr><td>.$rs[0].</td>';
-
echo '<td>.$rs[1].</td>';
-
echo '<td><img src="post.php?imgid=.$rs[0]."" width=100 height=100></td></tr>n';
-
echo '</table>n';
-
-
?>
-
-
-
-
-
-
26 2406
I'll post here the other two codes:
post.php --> - <?
-
if (!isset($submit)) {
-
?>
-
<form method="POST" action="" enctype=multipart/form-data>
-
<table>
-
<tr><td>Type</td><td><select name="imgtype"><option value="image/gif">GIF</option><option
-
value="image/jpeg">JPEG</option></select></td></tr>
-
<tr><td>File</td><td><input type="file" name="imgfile"></td></tr>
-
<tr><td></td><td><input type="submit" name="submit" value="upload"><input type="reset" value="reset"></td></tr>
-
</table>
-
</form>
-
<?
-
} else {
-
include "./comm.inc";
-
connectdb();
-
$hndl=fopen($imgfile,"rb");
-
$imgdata='';
-
while(!feof($hndl)){
-
$imgdata.=fread($hndl,2048);
-
}
-
-
{
-
$imgdata=addslashes($imgdata);
-
-
$sql = 'INSERT INTO tblimage VALUES(NULL,". $imgtype .",". $imgdata .")';
-
-
@mysql_query($sql) or die(mysql_error());
-
-
fclose($hndl);
-
-
echo '<a href="view.php">view image</a>';
-
}
-
?>
-
-
And
upload.php --> - <?php
-
if (!isset($submit)) {
-
?>
-
<form method="POST" action="" enctype=multipart/form-data>
-
<table>
-
<tr><td>Tipo</td><td><select name="imgtype"><option value="image/gif">GIF</option><option
-
value="image/jpeg">JPEG</option></select></td></tr>
-
<tr><td>File</td><td><input type="file" name="imgfile"></td></tr>
-
<tr><td></td><td><input type="submit" name="submit" value="upload"><input type="reset" value="reset"></td></tr>
-
</table>
-
</form>
-
<?
-
} else {
-
include "./comm.inc";
-
connectdb();
-
$hndl=fopen($imgfile,"rb");
-
$imgdata='';
-
while(!feof($hndl)){
-
$imgdata.=fread($hndl,2048);
-
}
-
-
$imgdata=addslashes($imgdata);
-
-
$sql = 'INSERT INTO tblimage VALUES(NULL,", $imgtype .",". $imgdata .")';
-
-
@mysql_query($sql) or die(mysql_error());
-
-
fclose($hndl);
-
echo '<a href="view.php">view image</a>';
-
}
-
?>
code green 1,726
Recognized Expert Top Contributor
This is a rather tiresome task you have set.
Do you think it is fair to expect people to trail through your code looking for syntax errors.
If you put some debugging in your code you might help yourself to find the problem
whell, I fexed a little things in view.php, and upload.php is correct, maybe the trouble is just in post, and dont get any error using the scripts, that's the problem but the image doesnt appear when I open view.php
This is how it appears on the browser: ![](/images/imgserve.php?url=http://mghospedagem.com/catalog/1.jpg)
And this is how I left view.php: - <?php
-
include "./comm.inc";
-
connectdb();
-
$sql = "SELECT imgid,imgtype FROM tblimage ORDER BY imgid";
-
-
$result = @mysql_query($sql) or die(mysql_error());
-
{
-
echo '<table border=1>n';
-
echo '<tr><th>imgid</th><th>imgtype</th><th>imgdata</th></tr>n';
-
while ($rs=mysql_fetch_array($result))
-
-
echo '<tr><td>".$rs[0]."</td>';
-
echo '<td>".$rs[1]."</td>';
-
echo '<td><img src="post.php?imgid=.$rs[0]." width=100 height=100></td></tr>n';
-
echo '</table>n';
-
-
-
}
-
-
?>
True is I'm not getting any bug anymore, but, it just doesn't appears.
Markus 6,050
Recognized Expert Expert
Variables are not parsed within single quoted strings. You'll have to concatenate the string or use double quotes: -
$name = "Mark";
-
// Works
-
echo "My name is $name";
-
// Also works
-
echo 'My name is ' . $name;
-
// Doesn't work: prints "My name is $name"
-
echo 'My name is $name';
-
Also, in future please provide all error details. Simply asking us to 'look at' something and deduce what is wrong with it simply isn't the proper way to ask a question to a bunch of volunteers.
Mark.
@Markus
Do I have to do that to view.php, post.php, upload.php, or both?
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Mike Daniel |
last post by:
I am attempting to use document.write(pageVar) that displays a new html page
within a pop-up window and the popup is failing. Also note that pageVar is
a complete HTML page containing other java scripts.
Being a javascript newbie and after significant testing, I suspect that the
document.write fails after finding a </script> within pageVar.
Does a trick exist that enables one to slightly alter pageVar whereby
enabling...
|
by: bayouprophet |
last post by:
Cant get menu script to to put linked page in the same frame. I am
new to Java
and I am wondering what am I doing wrong? below are my java applet
file, frame.html file, and my text file and one of my link file that
should load next to the menu on the same page. And Thank You in
advance.
Here is my menu applet:
<html>
|
by: Allen |
last post by:
I am trying to add an additional photo/hyperlink to the company web
site (I didn't create it) without any luck. The mouseover feature
'highlights' pics by swapping them with another pic using this command
in some type of array. I added the mailbox in the lower left corner
(see link below)http://www.aamechanical.com/indextemp.htm
but I cannot get it to swap. Here is the code for the page:
Thanks for your help in advance
|
by: Water Cooler v2 |
last post by:
Questions:
1. Can there be more than a single script block in a given HEAD tag?
2. Can there be more than a single script block in a given BODY tag?
To test, I tried the following code. None of the script gets executed.
Can someone please give me a direction as to what I may be missing?
Thanks.
|
by: bilaribilari |
last post by:
Hi all,
I am using Tidy (C) for parsing html pages. I encountered a page that
has some script as follows:
<script>
....
var abc = "<script>some stuff here</" + "script>";
....
</script>
| |
by: thisis |
last post by:
Hi All,
i have this.asp page:
<script type="text/vbscript">
Function myFunc(val1ok, val2ok)
' do something ok
myFunc = " return something ok"
End Function
</script>
|
by: rsteph |
last post by:
I have a script that shows the time and date. It's been working on my site for quite a while now. Suddenly it stops showing up, after getting my drop down menu to work.
If I put text between the <div id="datetime"></div> tags, the text shows up, but the javascript output being sent to those some divs doesn't seem to want to work. It should be showing up in the middle of the content pane, just below the first table box. (set by .css)
Here's...
|
by: Angus |
last post by:
I have a web page with a toolbar containing a Save button. The Save
button can change contextually to be a Search button in some cases.
Hence the button name searchsavechanges.
The snippet of html is:
<a class="searchsavechanges btn btn3d tbbtn" href="javascript:"
style="position:static">
<div id="TBsearchsavechanges">Search</div>
</a>
|
by: imtmub |
last post by:
I have a page, Head tag Contains many Scripts and style sheet for Menu and Page. This code working fine and displaying menus and page as i wanted.
Check this page for reference.
http://www.marco.com.cn/web-content/marco_re10.html
--------------------------------------------------------------
<head>
<!-- InstanceBeginEditable name="doctitle" -->
<title>Marco</title>
<!-- InstanceEndEditable -->
|
by: KevinADC |
last post by:
Note: You may skip to the end of the article if all you want is the perl code.
Introduction
Many websites have a form or a link you can use to download a file. You click a form button or click on a link and after a moment or two a file download dialog box pops-up in your web browser and prompts you for some instructions, such as “open” or “save“. I’m going to show you how to do that using a perl script.
What You Need
Any recent...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |