Problem sa PHP skriptom!!!

Problem sa PHP skriptom!!!

offline
  • Pridružio: 10 Jun 2005
  • Poruke: 270

E ovako, na netu sam nasao neku skriptu za Adresar. Kada je pokrenem prijavljuje mi neke greske, da li neko zna u cemu je problem?
Uspod su prvo fajlovi ove skripte, a ispod njih su greske koje se javljaju....
------------------------------------------------------------------------------------------------------
INDEX.PHP
--------------------------------------------------------------------------------

<html>

<head>
<LINK href="css.css" type=text/css rel=stylesheet>
<meta http-equiv="Content-Language" content="hr">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1250">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>Adresar</title>
<script type="text/javascript" language="JavaScript1.2" src="javascript/stm31.js"></script>
<SCRIPT language=JavaScript src="Adresar_files/time.js"
type=text/javascript></SCRIPT>
</head>

<body>

<div align="left">
<table width="352" height="30" bgcolor="#E0E8EB">
<tr>
<td width="183" height="30" valign="top"><b><font face="Comic Sans MS" size="6" color="#C0C0C0">ADRESAR</font></b></td>
<td width="347" height="30" valign="bottom"><b><font face="Comic Sans MS" size="2" color="#C0C0C0">
<SCRIPT language=JavaScript type=text/javascript>
<!--
ispisiDatumHr();
//-->
</SCRIPT>

</font></b></td>
</tr>
</table>
</div>
<table width="750" bgcolor="#C0C0C0" >
<tr>
<td width="22%">
<p align="center"><font size="2"><b>&nbsp;<font face="Comic Sans MS">UNESITE U BAZU</font></b></font></p>
</td>
<td width="178%">
<p align="center"><font face="Comic Sans MS" size="2"><b>PREGLED CIJELE BAZE</b></font></p>
</td>
</tr>
</table>
<table width="16%" height="220" bgcolor="#E0E8EB" align="left">
<tr>
<td width="24%" height="214">
<p align="center">
<form action="index.php" method="post">
Ime i prezime:
<input type="text" name="ImePrime">
<br>
Nick:
<input type="text" name="Nick">
<br>
E-mail:
<input type="text" name="Email">
<br>
Telefon:
<input type="text" name="Telefon">
<br>
Mobitel:
<input type="text" name="Mobitel">
<br>
Adresa:
<input type="text" name="Adresa">
<br>
<input name="Submit" type="Submit" value="Upiši">
<p>&nbsp;</td>

</tr>
</table>
<?PHP
$polj1 = $_POST['ImePrime'];
$polj2 = $_POST['Nick'];
$polj3 = $_POST['Email'];
$polj4 = $_POST['Telefon'];
$polj5 = $_POST['Mobitel'];
$polj6 = $_POST['Adresa'];


if ($polj1=="" || $polj2=="" ||$polj3=="" ||$polj4=="" || $polj5=="" ||$polj6=="")
{echo "Ukoliko pišete u bazu molim vas popunite sva polja!!!";}
else
{
$konekcija= mysql_connect("","","") or die("Nije se moguce spojiti na server!!!");

mysql_select_db("Adresar") or die("Nije moguce koristiti ovu bazu!!!");

$reuzultat=mysql_query("INSERT INTO podaci VALUES ('','$polj1','$polj2', '$polj3','$polj4','$polj5','$polj6')");
mysql_close($konekcija);

}

$a = mysql_connect("","","");
mysql_select_db("Adresar");

echo " <center><table align='left' bgcolor='gray' ><tr>";
echo "<p align='center'>
<td valign='top' width='95' align='center' bgcolor='#C0C0C0'>Ime i prezime
<td valign='top' width='95' align='center' bgcolor='#C0C0C0'>Nick
<td valign='top' width='95' align='center' bgcolor='#C0C0C0'>Email
<td valign='top' width='95' align='center' bgcolor='#C0C0C0'>Telefon
<td valign='top' width='95' align='center' bgcolor='#C0C0C0'>Mobitel
<td valign='top' width='95' align='center' bgcolor='#C0C0C0'>Adresa ";
echo "</tr>";


$b = mysql_query("SELECT * FROM podaci");

for ($i = 0; $i < mysql_num_rows($b); $i++)
{
$row = mysql_fetch_array($b);

echo "<tr>";

echo "<p align='center'>";
echo "<td align='center' bgcolor='#D2D5D5'><font size='2'>" . $row['imeprime'] . "</font></td>";
echo "<td align='center' bgcolor='#D2D5D5'><font size='2'>" . $row['nick'] . "<font></td>";
echo "<td align='center' bgcolor='#D2D5D5'><font size='2'><a href='mailto:'" . $row['email'] .">" . $row['email'] . "</a></font></td>";
echo "<td align='center' bgcolor='#D2D5D5'><font size='2'>" . $row['telefon'] . "</font></td>";
echo "<td align='center' bgcolor='#D2D5D5'><font size='2'>" . $row['mobitel'] . "</font></td>";
echo "<td align='center' bgcolor='#D2D5D5'><font size='2'>" . $row['adresa'] . "</font></td>";
echo "</tr>";


}
mysql_free_result($b);

mysql_close($a);

?>
</table>


</center>


</body>
</html>
------------------------------------------------------------------------------
------------------------------------------------------time.js(Adresar_files/time.js)---------------------------------------

<!--
function kreirajDatum(){
danas = new Date();
with(danas){
dan = getDay();
datum = getDate();
mjesec =getMonth();
godina = getFullYear();
return (dan, datum, mjesec, godina);
}
}
function ispisiDatumHr(){
dne = ["Nedjelja","Ponedjeljak", "Utorak", "Srijeda", "Èetvrtak", "Petak", "Subota"];
mj = ["01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"];
kreirajDatum();
document.write(dne[dan] + ", " + datum + "." + mj[mjesec] + "." + godina + ".")
}
//-->
------------------------------------------------------------------------------------------------------------------------

A ovo su greske:
---------------------
Notice: Undefined index: ImePrime in c:\program files\easyphp1-8\www\adresar\index.php on line 71

Notice: Undefined index: Nick in c:\program files\easyphp1-8\www\adresar\index.php on line 72

Notice: Undefined index: Email in c:\program files\easyphp1-8\www\adresar\index.php on line 73

Notice: Undefined index: Telefon in c:\program files\easyphp1-8\www\adresar\index.php on line 74

Notice: Undefined index: Mobitel in c:\program files\easyphp1-8\www\adresar\index.php on line 75

Notice: Undefined index: Adresa in c:\program files\easyphp1-8\www\adresar\index.php on line 76
Ukoliko pišete u bazu molim vas popunite sva polja!!!
Warning: mysql_connect(): Unknown MySQL Server Host 'Adresar' (11001) in c:\program files\easyphp1-8\www\adresar\index.php on line 92

Warning: mysql_select_db(): Access denied for user 'ODBC'@'localhost' (using password: NO) in c:\program files\easyphp1-8\www\adresar\index.php on line 93

Warning: mysql_select_db(): A link to the server could not be established in c:\program files\easyphp1-8\www\adresar\index.php on line 93


Warning: mysql_query(): Access denied for user 'ODBC'@'localhost' (using password: NO) in c:\program files\easyphp1-8\www\adresar\index.php on line 106

Warning: mysql_query(): A link to the server could not be established in c:\program files\easyphp1-8\www\adresar\index.php on line 106

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in c:\program files\easyphp1-8\www\adresar\index.php on line 108

Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in c:\program files\easyphp1-8\www\adresar\index.php on line 125

Warning: mysql_close(): supplied argument is not a valid MySQL-Link resource in c:\program files\easyphp1-8\www\adresar\index.php on line 127
----------------------------
Pozdrav.....

Tihomir Malesevic



Registruj se da bi učestvovao u diskusiji. Registrovanim korisnicima se NE prikazuju reklame unutar poruka.
offline
  • Pridružio: 15 Sep 2005
  • Poruke: 5

Prvo, Notice greske mozes da izbegnes dodavajuci ovako nesto na pocetku fajla

error_reporting(E_ALL ^ E_NOTICE);

osim ako ne zelis da ispravis notice poruke, sto bi eventualno mogao da postignes ovako nekako
if(isset($_POST["ImePrime"]))
{
$polj1 = $_POST['ImePrime'];
}

Drugo, sto se tice greske u vezi baze, gde god ti se poziva funkcija mysql_connect moras je pozvati sa svojim parametrima.

$db = mysql_connect("ime_mysql_servera","mysql_username","mysql_password");

kao i mysql_select_db('ime_baze',$db);

Ajd javi ako bude problema..



offline
  • Pridružio: 10 Jun 2005
  • Poruke: 270

Notice sam uspio iz prve, ali ovo oko warning...
Koristim easy php 8
Tu ubacim Adresar...
I sada kada ukljucim Adresar pojavljuju se samo warning greske...
Napravio sam mysql bazu u phpmyadmin... i u i mijenjao u adresaru database gdje da se konekruja, ali nisam uspijeo...

Sta dalje da radim...

offline
  • Pridružio: 15 Sep 2005
  • Poruke: 5

I dalje ti vraca potpuno iste warning-e?

Idi redom.. Pogledaj prvi warning, idi na liniju na koju se odnosi , pa vidi sta tu nije dobro.

Ko je trenutno na forumu
 

Ukupno su 821 korisnika na forumu :: 47 registrovanih, 8 sakrivenih i 766 gosta   ::   [ Administrator ] [ Supermoderator ] [ Moderator ] :: Detaljnije

Najviše korisnika na forumu ikad bilo je 3466 - dana 01 Jun 2021 17:07

Korisnici koji su trenutno na forumu:
Korisnici trenutno na forumu: _Rade, A.R.Chafee.Jr., Amigdala, antonije64, babaroga, bigfoot, Bobrock1, bojank, Boris90, chica, darkangel, debeli, Denaya, Dorcolac, dragoljub11987, FOX, Georgius, ikan, Jahorina, JimmyNapoli, Krvava Devetka, Leonov, madza, Marko Marković, mercedesamg, Mi lao shu, mile23, MiroslavD, Mixelotti, Mlav, nemkea71, nuke92, ostoja, pein, raptorsi, rikee, rodoljub, ruger357, simazr, Sirius, Sićko, slonic_tonic, Srky Boy, stegonosa, TheBeastOfMG, VJ, Vlad000