Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.

You have an error in your SQL syntax - gde gresim

[es] :: PHP :: PHP za početnike :: You have an error in your SQL syntax - gde gresim

[ Pregleda: 1314 | Odgovora: 2 ] > FB > Twit

Postavi temu Odgovori

Autor

Pretraga teme: Traži
Markiranje Štampanje RSS

milos 2
milos ljatkovic

Član broj: 148450
Poruke: 669
*.dynamic.sbb.rs.



+3 Profil

icon You have an error in your SQL syntax - gde gresim26.07.2012. u 16:38 - pre 143 meseci
greska:
Code:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'LIMIT 1' at line 1

a kod stranice:
Code:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<?php



$con = mysql_connect('mysql', "nikolate_milos", '********');

if (!$con)

{

    DIE('could not connect: ' . mysql_error());

}



$db_selected = mysql_select_db ("nikolate_db1", $con);



if (!$db_selected)

{

    die ('can not use' . "nikolate_db1" . ';' . mysql_error());

}

echo 'uspesno ste se registrovali';

$value = $_POST['ime'];

$value1 = $_POST['ime_o'];

$value2 = $_POST['mesto_datum'];

$value3 = $_POST['zvanje'];

$value4 = $_POST['zanimanje'];

$value5 = $_POST['ul_br_me'];

$value6 = $_POST['pb_o'];

$value7 = $_POST['drzava'];

$value8 = $_POST['tel_fax'];

$value9 = $_POST['mobilni'];

$value10 = $_POST['email'];

$value11 = $_POST['sajt'];

$value12 = $_POST['facebook'];

$value13 = $_POST['skype'];

$value14 = $_POST['talenat'];

$value15 = $_POST['clanarina'];

$value16 = $_POST['donacije'];

$value17 = $_POST['predlozi'];

$sql = "insert into registar (ime, ime_o, mesto_datum, zvanje, zanimanje, ul_br_me, pb_o, drzava, tel_fax, mobilni, email, sajt, facebook, skype, talenat, clanarina, donacije, predlozi) VALUES('$value', '$value1', '$value2', '$value3', '$value4', '$value5', '$value6', '$value7', '$value8', '$value9', '$value10', '$value11', '$value12', '$value13', '$value14', '$value15', '$value16', '$value17')";

?>

<?php 

if (!mysql_query($sql))

{

    die ('Error' . mysql_error());

}



mysql_select_db ("nikolate_db1", $con);

$id   = !empty($_GET['id']) ? intval($_GET['id']) : 0;

$rnd = !empty($_GET['rnd']) ? mysql_real_escape_string($_GET['rnd']) : '';

$result = mysql_query("SELECT * FROM registar WHERE id=$id AND rnd=$rnd LIMIT 1")  or die(mysql_error());

if (empty($result)) { echo "Greska!"; exit; }



$row = mysql_fetch_assoc($result);

$row_e = array_map('htmlspecialchars', $row);



echo "{$rows['ime']} , {$rows['ime_o']}, {$rows['mesto_datum']}, {$rows['zvanje']}, {$rows['zanimanje']}, {$rows['ul_br_me']}, {$rows['pb_o']}, {$rows['drzava']}, {$rows['tel_fax']}, {$rows['mobilni']}, {$rows['email']}, {$rows['sajt']}, {$rows['facebook']}, {$rows['skype']}, {$rows['talenat']}, {$rows['clanarina']}, {$rows['donacije']}, {$rows['predlozi']}";

?>

<?php 

$to = $info['email'];
 

$subject = "VAŠI PODACI: ".$info['ime']; 

$message = 'Ime i prezime/First and last name: '.$info['ime'].'
            Očevo ime/Father name: '.$info['ime_0'].'
            Datum i mesto rođenja/date and place of birth: '.$info['mesto_datum'].'
            Zvanje/title: '.$info['zvanje'].'
            Zanimanje/profession: '.$info['zanimanje'].'
            Ulica, broj i mesto stanovanja/street and city of resident: '.$info['ul_br_me'].'
            Poštanski broj i opština/postal code and state: '.$info['pb_o'].'
            Država/country: '.$info['drzava'].'
            Tel./ fax: '.$info['tel_fax'].'
            Mobilni/mobile: '.$info['mobilni'].'
            e-mail: '.$info['email'].'
            Sajt/site: '.$info['sajt'].'
            Facebook: '.$info['facebook'].'
            Skype: '.$info['skype'].'
            Talenat/tallent: '.$info['talenat'].'
            Članarina učlanjenja/membershipe price: '.$info['clanarina'].'
            Donacije/donations: '.$info['donacije'].'
            Predlozi za saradnju/proposals for cooperation: '.$info['predlozi'].'
            Datum/date: '.$today = date("dmY").'';
$headers = "From: [email protected]\r\n" .  

            'X-Mailer: PHP/' . phpversion() . "\r\n" . 

            "MIME-Version: 1.0\r\n" . 

                "Content-Type: text/plain; charset=utf-8\r\n" . 

                "Content-Transfer-Encoding: 8bit\r\n\r\n"; 
            
mail($to, $subject, $message, $headers);


?>


mysql verzija: 5.0.89-community

da li mozete da mi pomognete gde je greska?
 
Odgovor na temu

PHPovac

Član broj: 300013
Poruke: 168
*.dynamic.isp.telekom.rs.



+19 Profil

icon Re: You have an error in your SQL syntax - gde gresim26.07.2012. u 17:55 - pre 143 meseci
Ispravi rnd=$rnd u rnd = '$rnd'
 
Odgovor na temu

milos 2
milos ljatkovic

Član broj: 148450
Poruke: 669
*.dynamic.sbb.rs.



+3 Profil

icon Re: You have an error in your SQL syntax - gde gresim27.07.2012. u 10:06 - pre 143 meseci
hvala
 
Odgovor na temu

[es] :: PHP :: PHP za početnike :: You have an error in your SQL syntax - gde gresim

[ Pregleda: 1314 | Odgovora: 2 ] > FB > Twit

Postavi temu Odgovori

Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.