php-windows Digest 8 Feb 2004 10:07:52 -0000 Issue 2112
Topics (messages 22761 through 22763):
problems with variables
22761 by: Ciro
22762 by: Svensson, B.A.T. (HKG)
IMAGES IN DB
22763 by: zanzamarr
Administrivia:
To subscribe to the digest, e-mail:
[EMAIL PROTECTED]
To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]
To post to the list, e-mail:
[EMAIL PROTECTED]
----------------------------------------------------------------------
--- Begin Message ---
hi, i'm a new member from italy.
just a simple question:
why i have this output with my php script??
SCRIPT
<html>
<head>
<title>Entering Information into a Form</title>
</head>
<form action="form_results.php3" method="GET">
<p>First Name: <input type="text" name="first_name">
<br>Last Name: <input type="text" name="last_name">
<br>Address: <input type="text" name="address">
<br>City: <input type="text" name="city">
<br>State: <input type="text" name="state">
<br>Zip: <input type="text" name="zip">
<br>Home Phone: <input type="text" name="home_phone">
<p><input type="submit" name="Submit" value="Submit">
<input type="Reset">
</form>
</body>
</html>
OUTPUT form_result.php3
Below are the results of your Form Submission
First Name: $first_name\n"); print("
Last Name: $last_name\n"); print("
Address: $address\n"); print("
City: $city\n"); print("
State: $state\n"); print("
Zip: $zip\n"); print("
Home Phone: $home_phone\n"); ?>
--- End Message ---
--- Begin Message ---
I dopn't understand what you asking about (read: I don't bother to read
through all clutter to figure it out), but you may want to have a look at:
http://nl.php.net/manual/en/language.variables.external.php
-----Original Message-----
From: Ciro
To: [EMAIL PROTECTED]
Sent: 2004-02-07 19:40
Subject: [PHP-WIN] problems with variables
hi, i'm a new member from italy.
just a simple question:
why i have this output with my php script??
SCRIPT
<html>
<head>
<title>Entering Information into a Form</title>
</head>
<form action="form_results.php3" method="GET">
<p>First Name: <input type="text" name="first_name">
<br>Last Name: <input type="text" name="last_name">
<br>Address: <input type="text" name="address">
<br>City: <input type="text" name="city">
<br>State: <input type="text" name="state">
<br>Zip: <input type="text" name="zip">
<br>Home Phone: <input type="text" name="home_phone">
<p><input type="submit" name="Submit" value="Submit">
<input type="Reset">
</form>
</body>
</html>
OUTPUT form_result.php3
Below are the results of your Form Submission
First Name: $first_name\n"); print("
Last Name: $last_name\n"); print("
Address: $address\n"); print("
City: $city\n"); print("
State: $state\n"); print("
Zip: $zip\n"); print("
Home Phone: $home_phone\n"); ?>
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
Hello everyone!
I'm building a site about all the states of the world..... in the DB (MySql), I'm
going to insert many dates:
id, country,a, lot,of,informations,about,the,country and the image of the map of the
country and pf the flag.
The code I use to put into my db the image is this (see under) and it works...but when
I try to display the image I get this string:
What's wrong??????????????????
[EMAIL
PROTECTED],@?Ç??Ó???H???*\È?Ã#J?H??Å+?Q`ÇI?dI9?LÉä-?Ê93&Í6sÂY?'N?:{
?F?]Z?iD?&??D???ÕX?jÝ?+B?RMR?ÙhÓ?äpãK?+ÛÞÝ??_?wÛ?????W?#K?L??eËÕ?Ê?çñ?bM?Æ??ë?î?sÓ?x6ïs
"Æ?PFãViåÂa?\v?Ö^?)fV`?iæ??æÚ_?pÆÝrÖ??vÆ?râ]&ê?Ò(r??Wh_?ÎâF
i??E??sHZÚ?è?? ???a??è?jx???.??æ??H????Hk??Þë?yèÞà?*??????ÊAv
íM{]?x??ê"??îB×míä???ðb?Ñ/a?Æo???\?Næç?òÃ &1?êwì
?,òlò?òì0Ç?ËÖóé<ÇsÏ{?6tÑ?s%?J~>M??
I??~U??í]??uØ?m6Õ?Í?M?m(ÛÇÜ×ÖvçÝ?ß>?jm?í???W???.9á$î??yp?ëçÞäÎ?ñè^!ëê?ì.ßMÙk??Å2F?RËÅñ?ïÕ??ß??Ôg;[EMAIL
PROTECTED](X?~Ë?ná'? ?0\t` ÅÃ???ËÆ??PIJâ?È!i
yP?UázÕfÕ}5!a?)×?3???????Ë_\ÑÙV?k?:+C?Þ??åahZ??V??]??äÆf???!-
[?Ö?rM?Õg?êÆ? .S??V?Hp?È`t/[[ÛT?[ .rdkÞV?x=
wW7]Ï???kÙ???Ô.sg?W????ÞÕ???ÖF(N??????'Láx2
Î??ÉÃ?\<ÞÉ%%??ç?1ÄÝÕS6^???b"?H+?H?,dw??b???wF?c1Â?_ar??\d"???k?RÖ??Ü&??G?òe'sÙÅ&??*çÙxÎ??!?ARDIV
5.0 ! ;
--------------------------------------------------------------------------------------Code
to insert the image in the
DB-------------------------------------------------------------------------
<?Php
if(!isset($_POST)) $_POST = $HTTP_POST_VARS;
$self = isset($_SERVER) ? $_SERVER["PHP_SELF"] : $HTTP_SERVER_VARS["PHP_SELF"];
if($_POST["invia"]) {
//Definisco le variabili
$host = "localhost";
$user = "bubusettete";
$password = "";
$nomedb = "schedestati";
$tabella = "stati";
$stato = "Italia";
// Mi connetto a MySql e seleziono il database
$connessione = mysql_connect($host,$user,$password) or die ("Non mi riesco a
connettere al database");
mysql_select_db($nomedb, $connessione) or die ("Non riesco a selezionare il db
specificato");
$data = addslashes(fread(fopen($_FILES["file_binario"]["tmp_name"], "rb"),
$_FILES["file_binario"]["size"]));
$nomefile = $_FILES["file_binario"]["name"];
$sizefile = $_FILES["file_binario"]["size"];
$typefile = $_FILES["file_binario"]["type"];
$result = @mysql_query("
UPDATE $tabella
SET
dati_binari_cartina = \"$data\",
nome_carta_stato = \"$nomefile\",
dimensione_carta_stato = \"$sizefile\",
tipo_carta_stato = \"$typefile\"
WHERE stato ='$stato'
") or die("Query di inserimento fallita !");
echo "Il file " . basename($_FILES["file_binario"]["name"]) . " Ã stato correttamente
inserito nel Database.";
@mysql_close();
} else {echo
"<html>
<head>
<title>Form per l'inserimento</title>
</head>
<body>
<div align=\"center\">
<table>
<form action=\"$self\" method=\"POST\" enctype=\"multipart/form-data\">
<tr>
<td>File</td>
<td><input type=\"file\" name=\"file_binario\" size=\"40\"></td>
</tr>
<tr>
<td colspan=\"2\" valign=\"bottom\" align=\"center\" height=\"30\">
<input type=\"submit\" value=\"Invia il file\" name=\"invia\">
</td>
</tr></form>
</table></div></body></html>
";}
?>
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------Code
to diplay the
image------------------------------------------------------------------------------------
<?
// -------------------------------- Modulo per la visualizzazione dei dati di un
database -------------------------------//
$host = "localhost";
$user = "bubusettete";
$password = "";
$nomedb = "schedestati";
$tabella = "stati";
$stato = "Italia";
// Mi connetto a MySql e seleziono il database
$connessione = mysql_connect($host,$user,$password) or die ("Non mi riesco a
connettere al database");
mysql_select_db($nomedb, $connessione) or die ("Non riesco a selezionare il db
specificato");
// Query SQL per selezionare tutti i record della tabella
$sql = "
SELECT *
FROM $tabella
WHERE stato='$stato'
";
// Inserisco in un array tutte le voci del record che ha quel nome di stato
$elencodati = mysql_query($sql,$connessione) or die ("Impossibile avviare la query");
while($riga = mysql_fetch_array($elencodati)){
$stato = $riga['stato'];
$lingua = $riga['lingua'];
$area = $riga['area'];
$id = $riga['id'];
$immagine = $riga['dati_binari_cartina'];
$tipo = $riga['tipo_carta_stato'];
}
// Stampo le voci dell'array
echo "$stato <br />";
echo "$lingua <br />";
echo $immagine;
?>
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--- End Message ---